Jump to content

[Workflow] Copy to Clipboard as an Action or as an option in Keyword Input


Carlos-Sz

Recommended Posts

I’d like to be able to use {query} in an AppleScript but as far as I could understand it is not possible because AppleScript can’t be used in Script Filter.

 

So I would like to be able to set a Keyword (with an argument required) and copy this argument ({query}) to the clipboard then add an AppleScript action that could read the clipboard and use the {query} this way.

 

To do so it would be necessary an action to Copy to Clipboard or an option in Keyword input to copy the argument ({query}) to the clipboard before running the action.

 

Thanks! :)

 

 

Link to comment
Share on other sites

You are correct in that Applescript isn't available as a default available language in the script filters, however, since bash is an available option, you could easily run scripts through that using osascript and passing the {query} value into the script as a parameter.

Link to comment
Share on other sites

Thank you David.

 

I’m still learning about AppleScript and Shell/Bash and things like these.

 

I think it is working:

 

http://d.pr/f/5Jp7

 

Basically it is a New Text File with clipboard content created in the current Finder folder:

 

1) you can use a hotkey to create a new text file, or

 

2) you can use Alfred (key “newf”) to write the filename followed automatically by date and time or press CTRL key to use only the filename

 

Right now the workflow does not check anything e.g. if a file already exists...

 

PS: I studied some workflows in this forum and applescript samples from the web in order to compile this workflow.

Link to comment
Share on other sites

You look like you're already well down the track now, but FYI — the bash functions "pbcopy" and "pbpaste" are exactly what you need to interact with the clipboard without resorting to Applescript.

 

Thank you CarlosNZ. I’ll take a look at those commands.

 

I know a little about AppleScript but almost nothing of Bash. What I know is the old Visual Basic 6 (for Windows). :)

Link to comment
Share on other sites

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