Skip to content

Commit

Permalink
Merge pull request #958 from iloveitaly/safari-download-url
Browse files Browse the repository at this point in the history
download current safari url
  • Loading branch information
adilrc authored Aug 30, 2024
2 parents 69fbaf7 + 30675f7 commit d6efbd9
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions commands/apps/safari/safari-download-url.applescript
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/osascript

# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Download Current URL
# @raycast.mode silent

# Optional parameters:
# @raycast.packageName Safari
# @raycast.icon images/safari.png

# @Documentation:
# @raycast.author Michael Bianco
# @raycast.authorURL https://github.com/iloveitaly
# @raycast.description Download the currently active tab's URL.

tell application "Safari"
activate
set currentTab to current tab of window 1
set theURL to URL of currentTab
end tell

-- Simulate pressing Option key and clicking the link
tell application "System Events"
keystroke "l" using {command down} -- Select the address bar (Cmd + L)
delay 0.5
keystroke return using {option down} -- Press Option + Return to download the file
end tell

0 comments on commit d6efbd9

Please sign in to comment.