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?





Share this post

Link to post

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


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

Share this post

Link to post

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



Edited by zeltak

Share this post

Link to post

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









any clue why?





Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...