Jump to content

Format for running key combo from input with function keys and modifiers

Recommended Posts

I'm building a workflow that finds all hotkeys assigned to my workflows and I want to run those using the "Dispatch Key Combo" output. This works if I just want to run a single key, like F13 (passing code "105") or if I run something with a modifier and a standard key like "⇧⌘G". But if I want to run command+shift+F17, it doesn't work. The output I get is;


1. If I pass "⇧⌘F17" I get "Interpreted '⇧⌘F17' as 'F17' with mod code 9568256 (using code 64)"

2. If I pass it with the keycode instead ("⇧⌘86"), I get "Unable to interpret key string '⇧⌘86'"


So for 1, it seems like it's fine but it doesn't actually trigger the combo (because the workflow assigned to that key combo doesn't run). And 2 is clearly invalid.


I searched the forum and found a number of threads mentioning function keys possibly working differently (for other scenarios, not this specifically) Is this just one of those cases where this won't work if I'm passing input into Dispatch Key Combo?

Link to comment

Have you considered using inbound configuration on the items you want to group, then using call external trigger to call items in workflows directly from your workflow?




This will allow for directly calling items without needing to simulate hotkeys.


There is actually a built-in example of this using the older External Trigger object (before you could configure the external id directly onto any object) in Alfred's Workflow prefs Getting Started menu from the + button under the workflows list.

Link to comment
27 minutes ago, Andrew said:

then they will work as expected


I'm thinking more of user-added triggers.


I mean, if you want to call a workflow that only has Hotkeys defined, not External Triggers, it makes more sense to call it via Hotkey – even if External Triggers are technically a much better solution – because that won't break on every single workflow update.

Link to comment

Apologies for not replying to this, I didn't get notified of the replies. External triggers would work, but this was partially about just bringing up a list of set hot keys regardless of if it's my workflow or a third party one and not having to add external triggers to each one. I was able to work around it by running with Applescript instead https://github.com/rknightuk/alfred-workflows/blob/main/workflows/hotkey-list/src/run.sh (I had some issues running it directly hence the temp file being generated which is not ideal but does the job).

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