Jump to content

is it possible to launch via alfred and send keystrokes in succession?


Recommended Posts

Hi all

 

complete neewb (also on mac coming from years of linux)

was wondering if one can launch and app via alfred and send keystrokes in succession?

 

for example i would like to launch/focus macpass and immediately send a Command-f keystroke to focus the search bar

 

is that possible at all?

 

best

 

Z

Link to comment

This AppleScript should work (I don't have MacPass to test it with, but it works with Safari). Put it in a Run Script box with Language = /usr/bin/osascript (AS)

 

tell application "MacPass"

    -- Bring app to the front, starting it if necessary

    activate

    -- Wait until app windows have opened (in case app wasn't running)

    repeat until (count of windows) > 0

    end repeat

end tell

-- Simulate CMD+F

tell application "System Events" to keystroke "f" using {command down}

Edited by deanishe
Link to comment

thx so much! that’s amazing @deanishe

 

any chance (and this may be asking to much so feel free to ignore) that it actually passes the string from alfred?

 

so once can go ?

 

Aflred> type my key for the above script> followed by `gmail` and the script sends the `gmail` string inside the CMD+F box?

 

thx again

 

Z

Edited by zeltak
Link to comment
  • 3 weeks later...

wow this is amazing

 

sorry for the late response (life, work, you name it this past few weeks :))

 

but for some reason this only brings up macpass focuses the search box but dosent seem to type anything

 

here are my current settings

 

image.thumb.png.78fc92b6a930734e5f82fa633723ebed.png

 

 

image.png.d06593e7b07263eb3357db6f01b51c66.png

 

 

 

any clue why?

 

thx!

 

z

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