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