Jump to content

Open workflow in Alfred given the path to workflow folder


Recommended Posts

Posted

I have a workflow with a script filter action that queries all my Alfred workflows and passes the path to the selected workflow folder (e.g. `.../Alfred.alfredpreferences/workflows/user.workflow.0D987BB0-9A2B-4162-9A68-A9905DFEF52F`) to the next action such that

 

  • ↵ opens the workflow folder in VSCode
  • ⌘+↵ opens the folder in Finder.

 

My goal is to open the workflow in Alfred to edit it with ⌥ + ↵. Is this possible based on the file path to the workflow folder?
 

CleanShot2023-05-13at21_29.01-AlfredPreferences@2x.png.8dda0c911c0011cd86b8e1ddb7bd1fd5.png

Posted

Yes, see the AppleScript dictionary. You can use the basename of the folder with reveal workflow.

 

tell application id "com.runningwithcrayons.Alfred" to reveal workflow "user.workflow.0D987BB0-9A2B-4162-9A68-A9905DFEF52F"

Posted

Thanks @vitor, that worked perfectly!

For completeness, I post the new version below. Since the output of the script filter is the full path and the AppleScript only requires the folder name, I included a Search and Replace Utility with the search regex

.*(user\.workflow\..*)

 

and `$1` as the replacement to strip everything before the folder name.

 

The Run Script action then looks as follows:
 

on run
  tell application id "com.runningwithcrayons.Alfred" to reveal workflow "{query}"
end run

 

CleanShot2023-05-14at11_00.09-AlfredPreferences@2x.thumb.png.bf723ac9948b5cb5d67ea9dac1cb24e2.png

Posted

 

@jjaybe this workflow would be even more useful if it could reveal the data and cache folders of the workflows in Finder. I often find myself navigating to these folders to clear their contents. If you do this, please release the workflow.

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