Jump to content

[SOLVED] Applescript to Paste Text from Alfred Clipboard


Recommended Posts

I have a workflow where I copy 6 different lines of text and then paste them into 6 different browser fields. I am trying to write an Alfred workflow using Applescript to do this for me automatically.

 

Therefore I need to copy the six different lines of text, invoke the workflow, so that it:
 

  1. Invokes the Alfred clipboard history viewer.
  2. Paste the sixth entry.
  3. Tabs to the next field.
  4. Repeats....

 

I have this script so far which invokes the Alfred clipboard history viewer, but the next "System Events" line in which command-6 keyboard shortcut is executed still targets the browser....and not the Alfred clipboard history viewer prompt window:

 

tell application "System Events"
	keystroke "v" using {command down, option down}
end tell

tell application "System Events"
	keystroke "6" using {command down}
end tell

 

I tried targeting the app itself "Alfred 4" like below, but it does nothing:

 

tell application "System Events"
	keystroke "v" using {command down, option down}
end tell

tell application "System Events"
	tell application "Alfred 4" to activate
	keystroke "6" using {command down}
end tell

 

Can someone help? Thank you!

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