jjaybe Posted May 13, 2023 Posted May 13, 2023 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?
vitor Posted May 13, 2023 Posted May 13, 2023 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" jjaybe and giovanni 2
jjaybe Posted May 14, 2023 Author Posted May 14, 2023 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
vitor Posted May 14, 2023 Posted May 14, 2023 That regex won’t work if you rename the folder. Use instead the Automation Task to get the basename. Also, prefer with input as argv jjaybe 1
xilopaint Posted May 14, 2023 Posted May 14, 2023 @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.
xilopaint Posted May 14, 2023 Posted May 14, 2023 2 hours ago, giovanni said: @xilopaint WeWorkflow also does that Just installed. Thanks!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now