Skip to main content
Added link to download resource files.
Source Link
ssent1
  • 171
  • 4

A general solution is to combine your AppleScript (Script Editor)(/System/Applications/Utilities/Script Editor.app) with an app launcher like Alfred.

Script

tell application "Safari" to tell document 1
    set the clipboard to "[#]: " & URL & " \"" & name & "\""
end tell

In this case, the result string is formatted as the second part of a Markdown reference-style link. E.g.:

[link text][1]

[1]: url "title"

Hotkey Trigger

  1. In your app launcher, create a hotkey workflow
  2. In Alfred, click Settings > Workflows, then click + > Blank workflow
  3. Add a Workflow Name; other values are optional
  4. Click + > Triggers > Hotekey
    1. In the Hotkey Settings tab, assign a Hotkey value. E.g. ⌥C
    2. Leave Action as Pass through to workflow or your launcher's equivalent
    3. Leave Argument set to None.
    4. Go to the Related Apps tab
    5. Verify have focus is the value assigned to Hotkey is...active when..apps
    6. Click Save
  5. Click + Actions > Run Script
  6. Set Language to /usr/bin/osascript (AS); leave other options set to their default values
  7. Paste your version of the above script into the Script box
  8. Click Save
  9. Drag the Hotkey box's node and connect it to the Run Script box

That's it! Now clicking ⌥C in Safari lets you paste URL and title values in any app in any format with the standard Paste keyboard shortcut — ⌘P.

As above, you should be able to run your script as a service. You can assign a shortcut key to run the service by going to System Preferences > Keyboard > Services.

PS: You can also download my Alfred Workflow and scripts (plain text and .scpt) from GitHub.

A general solution is to combine your AppleScript (Script Editor)(/System/Applications/Utilities/Script Editor.app) with an app launcher like Alfred.

Script

tell application "Safari" to tell document 1
    set the clipboard to "[#]: " & URL & " \"" & name & "\""
end tell

In this case, the result string is formatted as the second part of a Markdown reference-style link. E.g.:

[link text][1]

[1]: url "title"

Hotkey Trigger

  1. In your app launcher, create a hotkey workflow
  2. In Alfred, click Settings > Workflows, then click + > Blank workflow
  3. Add a Workflow Name; other values are optional
  4. Click + > Triggers > Hotekey
    1. In the Hotkey Settings tab, assign a Hotkey value. E.g. ⌥C
    2. Leave Action as Pass through to workflow or your launcher's equivalent
    3. Leave Argument set to None.
    4. Go to the Related Apps tab
    5. Verify have focus is the value assigned to Hotkey is...active when..apps
    6. Click Save
  5. Click + Actions > Run Script
  6. Set Language to /usr/bin/osascript (AS); leave other options set to their default values
  7. Paste your version of the above script into the Script box
  8. Click Save
  9. Drag the Hotkey box's node and connect it to the Run Script box

That's it! Now clicking ⌥C in Safari lets you paste URL and title values in any app in any format with the standard Paste keyboard shortcut — ⌘P.

As above, you should be able to run your script as a service. You can assign a shortcut key to run the service by going to System Preferences > Keyboard > Services.

A general solution is to combine your AppleScript (Script Editor)(/System/Applications/Utilities/Script Editor.app) with an app launcher like Alfred.

Script

tell application "Safari" to tell document 1
    set the clipboard to "[#]: " & URL & " \"" & name & "\""
end tell

In this case, the result string is formatted as the second part of a Markdown reference-style link. E.g.:

[link text][1]

[1]: url "title"

Hotkey Trigger

  1. In your app launcher, create a hotkey workflow
  2. In Alfred, click Settings > Workflows, then click + > Blank workflow
  3. Add a Workflow Name; other values are optional
  4. Click + > Triggers > Hotekey
    1. In the Hotkey Settings tab, assign a Hotkey value. E.g. ⌥C
    2. Leave Action as Pass through to workflow or your launcher's equivalent
    3. Leave Argument set to None.
    4. Go to the Related Apps tab
    5. Verify have focus is the value assigned to Hotkey is...active when..apps
    6. Click Save
  5. Click + Actions > Run Script
  6. Set Language to /usr/bin/osascript (AS); leave other options set to their default values
  7. Paste your version of the above script into the Script box
  8. Click Save
  9. Drag the Hotkey box's node and connect it to the Run Script box

That's it! Now clicking ⌥C in Safari lets you paste URL and title values in any app in any format with the standard Paste keyboard shortcut — ⌘P.

As above, you should be able to run your script as a service. You can assign a shortcut key to run the service by going to System Preferences > Keyboard > Services.

PS: You can also download my Alfred Workflow and scripts (plain text and .scpt) from GitHub.

Source Link
ssent1
  • 171
  • 4

A general solution is to combine your AppleScript (Script Editor)(/System/Applications/Utilities/Script Editor.app) with an app launcher like Alfred.

Script

tell application "Safari" to tell document 1
    set the clipboard to "[#]: " & URL & " \"" & name & "\""
end tell

In this case, the result string is formatted as the second part of a Markdown reference-style link. E.g.:

[link text][1]

[1]: url "title"

Hotkey Trigger

  1. In your app launcher, create a hotkey workflow
  2. In Alfred, click Settings > Workflows, then click + > Blank workflow
  3. Add a Workflow Name; other values are optional
  4. Click + > Triggers > Hotekey
    1. In the Hotkey Settings tab, assign a Hotkey value. E.g. ⌥C
    2. Leave Action as Pass through to workflow or your launcher's equivalent
    3. Leave Argument set to None.
    4. Go to the Related Apps tab
    5. Verify have focus is the value assigned to Hotkey is...active when..apps
    6. Click Save
  5. Click + Actions > Run Script
  6. Set Language to /usr/bin/osascript (AS); leave other options set to their default values
  7. Paste your version of the above script into the Script box
  8. Click Save
  9. Drag the Hotkey box's node and connect it to the Run Script box

That's it! Now clicking ⌥C in Safari lets you paste URL and title values in any app in any format with the standard Paste keyboard shortcut — ⌘P.

As above, you should be able to run your script as a service. You can assign a shortcut key to run the service by going to System Preferences > Keyboard > Services.