Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Copy title and URL of the current page in Safari to a new tweet in Tweetbot for Mac
-- TweetViaTweetbot.applescript
-- Copy title and URL in the front most window of Safari to Tweetbot with link
-- Author: Romain Briche
on copyTitleAndLinkToTweetbot(theTitle, theURL)
tell application "System Events"
set tweet to theTitle & " " & theURL & " via @"
set the clipboard to tweet as text
delay 0.2 -- to make sure the clipboard will be set correctly
keystroke "n" using {command down}
keystroke "v" using {command down}
delay 0.2 -- to make sure the clipboard will be set correctly
end tell
end copyTitleAndLinkToTweetbot
tell application "System Events"
if not (exists application process "Tweetbot") or not (exists application process "Safari") then
display alert "Tweetbot and Safari Required" message "You have to launch Tweetbot and Safari before executing script"
end if
end tell
tell first document of application "Safari"
set pageTitle to name
set pageURL to URL
end tell
tell application "Tweetbot" to activate
set theClipboard to the clipboard
copyTitleAndLinkToTweetbot(pageTitle, pageURL)
set the clipboard to theClipboard
Copy link

xenatt commented Apr 23, 2013

What's your license?
Can I share my forks Script?


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment