Jump to content

workflow assistance with transform


Recommended Posts

I'm brand new to workflows in Alfred. I have dozens of automations set up in Keyboard Maestro, and I am converting as many as possible into Alfred Workflows & Snippets.

 

I cannot understand how the Transform Utility works for what I'm trying to do. Any explanation would be most appreciated.

 

What I'm trying to do:

Select a block of text > Invoke an Alfred keyword "Case" > Choose an Alfred Result (e.g. Uppercase) > Run a Key Combo "⌘C" to copy text selection > Use theTransform Utility to convert the clipboard to Uppercase > Copy Clipboard Action with Paste

 

Screenshot:

image.thumb.png.24cf1d09ee0593e986bc08b3f5fdc397.png

 

Debug:

[20:26:05.014] Case: Upper[Keyword] Processing complete
[20:26:05.029] Case: Upper[Keyword] Passing output '' to Debug
[20:26:05.030] Case: Upper[Debug] '', {}
[20:26:05.030] Case: Upper[Debug] Processing complete
[20:26:05.031] Case: Upper[Debug] Passing output '' to Dispatch Key Combo
[20:26:05.031] Case: Upper[Dispatch Key Combo] Processing complete
[20:26:05.032] Case: Upper[Dispatch Key Combo] Passing output '' to Debug
[20:26:05.033] Case: Upper[Debug] '', {}, {clipboard}
[20:26:05.033] Case: Upper[Debug] Processing complete
[20:26:05.034] Case: Upper[Debug] Passing output '' to Transform
[20:26:05.034] Case: Upper[Transform] Processing complete
[20:26:05.035] Case: Upper[Transform] Passing output '' to Debug
[20:26:05.035] Case: Upper[Debug] '', {}
[20:26:05.036] Case: Upper[Debug] Processing complete
[20:26:05.036] Case: Upper[Debug] Passing output '' to Copy to Clipboard
[20:26:05.038] Case: Upper[Copy to Clipboard] Processing complete
[20:26:05.040] Case: Upper[Copy to Clipboard] Passing output '' to Debug
[20:26:05.040] Case: Upper[Debug] '', {}

Link to comment

Hi @deanishe

Thanks for the heads up and sorry for making you repeat what you must have said a thousand times.

 

Here is the workflow, however this is now a modified version that is working.

But I would still like some help as I don't understand what I have done that works.

https://www.dropbox.com/s/fsge2546jg4c4ie/[TXT] Case Changer.alfredworkflow?dl=0

 

This workflow works only if I have all the steps. Removing any steps prevents it from successfully completing.

My question now is: As I'm aiming for short, clean workflows - are all the steps I have necessary?

 

thanks

Link to comment
28 minutes ago, rvnds said:

Removing any steps prevents it from successfully completing.

 

It doesn't work at all on my computer, probably because it's rather fast.

 

I presume you're wondering about the doubled Copy to Clipboard elements where you should logically only need the last one?

 

If so, the problem is the way Key Combo works. User input, like keypresses or mouse clicks, whether real or simulated, is asynchronous. Key Combo puts the keypress in the application’s event queue and then finishes. It doesn’t—and can’t—wait for the application to actually handle the keypress. So the rest of your workflow is running before the ⌘C has been handled by the application it was fired at and the selection has been copied to the clipboard.

 

The solution is to add a Delay utility with a value of 0.3s (or however long it takes for the copy to reliably complete on your machine) after the Key Combo to give the copy operation time to complete before you try to get the contents of the clipboard.

Edited by deanishe
Link to comment

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
×
×
  • Create New...