Jump to content

How to fire shortcut as an action in Workflow?


Recommended Posts

Hi all! I want to make shortcut (ex. Option+T) than opens Telegram app with search already opened (command+K shortcut in this app).

 

First step is easy, but how to emulate shortcut fire as a part of Workflow? 
Tried apple script:

Quote

on alfred_script(q)
  tell application "System Events"
      key down command
      keystroke "k"
    key up command
end tell
end alfred_script


It's give no result. 

Need a piece of advice 🙏

Screenshot 2023-03-27 at 12.43.35.png

Link to comment

Welcome @Veniamin,

 

You don’t need AppleScript, Alfred has an object for sending key combos. But you might need a delay between launching the app and firing the combo, otherwise it will happen too soon and Telegram won’t register it.


A better solution would be to tell Telegram to do the search (e.g. via its own AppleScript dictionary) but that depends on the Telegram app itself and if it is scriptable.

 

Edited by vitor
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...