Jump to content

Lazy Hyperlink with twist


Recommended Posts

I'm trying to create the following workflow but I have no idea where to start. Here is what I want to do 

 

1- Copy some Text 

2- Copy a URL

3- Hit Hotkey

4- Paste a hyperkink <a href="{clipboard:0}">{clipboard:1}</a>

 

I've this workflow that would paste an image url as a hyper text on hotkey trigger.

on alfred_script(q)
    set rawHTML to "<img src=\"" & q & "\"style='width: 600px'> <br> (<a href=\"" & q & "\">view image larger</a>)"
    set escapedData to do shell script "echo " & (quoted form of rawHTML) as «class HTML»
    set the clipboard to escapedData
    tell application "System Events" to keystroke "v" using command down
end alfred_script

 

I cant seem to find a way to access {clipboard:0} or {clipboard:1} inside the script.

Link to comment
4 hours ago, Ibz said:

I cant seem to find a way to access {clipboard:0} or {clipboard:1} inside the script.

 

Only the {query} macro works in scripts (and then not in Run NSAppleScript). Use an Arg & Vars to set variables from {clipboard:0} and {clipboard:1} and read the variables from the environment in your script. Note: variables also don’t work in Run NSAppleScript. Don’t use it.

 

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