Jump to content

Execute another workflow

Recommended Posts

How can I create a new workflow that, with the press of a hotkey, would run an "alfred command", meaning something I type in the alfred window. Maybe an "Alfred command" would be a nice action to add.



If you share a little bit more about the actual action you'd like to achieve, I'm sure we can help you create a workflow to do what you need. :)




Link to comment

You can do this with AppleScript. Create a workflow and add a Run Script Action with language set to /usr/bin/osascript (AS), and paste the following in the Script box:

tell application "Alfred 2" to search "Timer 25"
delay 0.2
tell application "System Events" to keystroke return

Then add your Hotkey and connect it to the Run Script Action.

The first line will open Alfred with the query "Timer 25" and the third line simulates pressing RETURN.
AppleScript doesn't wait for Alfred to react to the search command, so you need the delay to give Alfred time to open before you simulate the RETURN keypress (otherwise the keypress will be sent to whichever application is active instead).
If you end up with Alfred open and "Timer 25" in the search box, increase delay 0.2 to delay 0.5 or higher.

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