Jump to content
zeltak

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

Share this post


Link to post
Posted (edited)

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

Share this post


Link to post
Posted (edited)

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

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

 

image.thumb.png.78fc92b6a930734e5f82fa633723ebed.png

 

 

image.png.d06593e7b07263eb3357db6f01b51c66.png

 

 

 

any clue why?

 

thx!

 

z

Share this post


Link to post
8 minutes ago, zeltak said:

any clue why?

 

Sorry, no. I can't seen anything wrong with your settings, and it works for me.

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.

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