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
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

This workflow is amazing I use it A LOT.

I've thought of an improvement, but when I looks at hacking it, I can't work out how to implement it. I was wondering if it would be possible to mimic the cases in Alfred. 
For example, (see screenshot) instead of current options change this to:

Title Case
Sentence case
UPPER CASE
Capitalize
lowercase

or to be clear between Title Case and Capitalise, show an example

Title Case (The Quick Brown Fox Jumps Over a Lazy Dog)
Sentence Case (The quick brown fox jumps over a lazy dog)
Upper Case (THE QUICK BROWN FOX JUMPS OVER A LAZY DOG)
Capitalize (The Quick Brown Fox Jumps Over A Lazy Dog)
Lowercase (the quick brown fox jumps over a lazy dog)

But the first option would be ok for me just so I can quickly see CAPS!

Screen Shot 2018-03-13 at 09.48.25.png

Share this post


Link to post
1 minute ago, robgill said:

This workflow is amazing I use it A LOT.

I've thought of an improvement, but when I looks at hacking it, I can't work out how to implement it. I was wondering if it would be possible to mimic the cases in Alfred. 
For example, (see screenshot) instead of current options change this to:

Title Case
Sentence case
UPPER CASE
Capitalize
lowercase

or to be clear between Title Case and Capitalise, show an example

Title Case (The Quick Brown Fox Jumps Over a Lazy Dog)
Sentence Case (The quick brown fox jumps over a lazy dog)
Upper Case (THE QUICK BROWN FOX JUMPS OVER A LAZY DOG)
Capitalize (The Quick Brown Fox Jumps Over A Lazy Dog)
Lowercase (the quick brown fox jumps over a lazy dog)

But the first option would be ok for me just so I can quickly see CAPS!

Screen Shot 2018-03-13 at 09.48.25.png

 

I prefer keyboard shortcut to a keyword for this workflow, but I can see why others would prefer keyword.

 

I use Cmd+Ctrl+Opt+Shift (yes all modifier keys) +

* L (lower case)

* U (upper case)

* S (sentence case - but I almost never use this)

* T (title case)

 

In the beginning it felt a little like doing finger gymnastics (I use little, ring, middel and thumb for the four modifiers on the left, and index on right hand for the letter), but I've gotten used to it now. On the other hand, the heavy use of modifier keys, it never interferes with anything ?

 

Anyway just for inspiration. Regarding your question, isn't it just a matter of connecting all the python scripts in the workflow to an Input -> Keyword, and then making the keyword titles that you want? See attached screenshots.

 

 

Screen Shot 2018-03-13 at 11.19.31-800.png

Screen Shot 2018-03-13 at 11.19.37-800.png

Screen Shot 2018-03-13 at 11.19.45-800.png

Share this post


Link to post
2 minutes ago, Fnantier said:

I prefer keyboard shortcut to a keyword for this workflow, but I can see why others would prefer keyword.


Thanks very much, I didn't even know that was an option! And I prob will prefer that too.
Great tips for splitting the workflow too! :)

Share this post


Link to post
8 hours ago, robgill said:

I was wondering if it would be possible to mimic the cases in Alfred. 
For example, (see screenshot) instead of current options change this to:

Title Case
Sentence case
UPPER CASE
Capitalize
lowercase

This is built into the latest version of the workflow as a script filter - see the top post.

Share this post


Link to post
On 5/5/2019 at 7:31 PM, gandalfsaxe said:

Would you mind putting this on GitHub? :)

 

Agreed, @dfay I follow your github to keep aware of updates to your very helpful workflows.

Share this post


Link to post

I know this is for Alfred. But is there any chance someone could make an Aktion like that for LaunchBar. Pretty please. And please don't hate me for using LaunchBar. 

Share this post


Link to post
Posted (edited)
1 hour ago, Ptujec said:

And please don't hate me for using LaunchBar.

 

Of course not, but why are you asking for a LaunchBar plugin here? I mean, of all the Mac-related forums you could ask on, can you think of one that has fewer LaunchBar users than the Alfred forum? :) 

Edited by deanishe

Share this post


Link to post
1 minute ago, deanishe said:

 

Of course not, but why are you asking for a LaunchBar plugin here? I mean, of all the Mac-related forums you could ask on, can you think of one that has fewer LaunchBar users than the Alfred forum? :) 

 

hahahaha It's not my intention to make the troll here, but this is the undeniable proof of how Alfred Community rules.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...