Jump to content
dfay

Case Converter (including Title Case)

Recommended Posts

Hey, great workflow.

 

One question. Is the expected behaviour to place a linefeed at the end of the converted text. After a bit of experimenting, there seems to be cases where the conversion adds a line feed.

 

Share this post


Link to post

Nice script.

 

My problem with it is, it requires too much focus to use. I can't invoke a particular keyword or hotkey because the order of the items (Upper Case, Lower Case, Title Case etc.) depends on what was the last used.

 

Is there any way to order them statically? Or even better, to invoke a different keyword for each, which reduces 3 steps (keyword + Cmd+number + paste) to 2 (keyword + paste).

Share this post


Link to post

To always have the actions in the same order, you need to edit the workflow so it doesn't give the actions UIDs.

 

The UID is how Alfred identifies actions and remembers what you selected in the past. Without UIDs, results are always shown in the same order they're emitted. 

Share this post


Link to post
On 12/27/2016 at 2:39 PM, deanishe said:

To always have the actions in the same order, you need to edit the workflow so it doesn't give the actions UIDs.

 

The UID is how Alfred identifies actions and remembers what you selected in the past. Without UIDs, results are always shown in the same order they're emitted. 

Hi tried to look around in the workflow and couldn't see any obvious place to change this. Any tips?

Share this post


Link to post

In the xml.scpt and xml-paste.scpt files. The simplest thing to do is probably to edit the xmlItem() function so it doesn't add uid to the output.

Share this post


Link to post
1 hour ago, deanishe said:

In the xml.scpt and xml-paste.scpt files. The simplest thing to do is probably to edit the xmlItem() function so it doesn't add uid to the output.

I deleted instances / mention of uid in those two files, but now the workflow doesn't really work. Nothing pops up when i choose "case" or "casep". Oh well...

Share this post


Link to post

Glad that is working for you.  To be honest, I don't think I've used the keyword version in several years.  You can also delete the two osascript lines in each of the bash scripts and just paste manually (that's actually how I use it).  Or try a shorter delay.

Share this post


Link to post
4 hours ago, Fnantier said:

I deleted instances / mention of uid in those two files, but now the workflow doesn't really work. Nothing pops up when i choose "case" or "casep". Oh well...

 

You're not supposed to delete all the mentions. Just the bit that generates the feedback for Alfred

uid.png

Share this post


Link to post

I have a slight problem with the hotkey version. After using e.g. "Title case" hotkey, it doesn't just alter the letter cases, but also adds a line break. Any way to avoid / fix this?

Share this post


Link to post
On 1/11/2017 at 7:26 PM, dfay said:

Here's a completely rewritten version (in Python) which combines the two workflows into one:

 

https://dl.dropboxusercontent.com/u/6601556/Alfred/Case Converter 2.alfredworkflow

 

It uses Alfred's built in Copy to Clipboard with automatic pasting to frontmost app instead of pbcopy in Bash and AppleScript pasting, which seems to give better results.  

 

Works wonderfully! Much appreciated. You should update your first post with this if you haven't :-)

Edited by Fnantier

Share this post


Link to post

I saw your nice service. But how do I install it? :-)

 

I am a newbie to macOS automator, macOS 10.12, i rename the file to workflow and double click, but it says the file is damaged. I guess i do it wrong somehow?

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×