DEVONthink to Tweetie

Hello everone,

I just created a script to post links from DEVONthink (that is, web links beginning with , not file links, email mailto links, etc.) to the Twitter client Tweetie, optionally shortening the URL in the process. The script is below:

--Thanks to Geoffrey Braaf for posting his script on posting to Twitter from NetNewsWire, which I have modified for DEVONthink

--Do you wish to use a URL shortener?
set useShort to true
--If you wish to use a URL shortener, what is the address prefix to request it:
set shortenerURL to ""


set this_URL to ""
set this_name to ""

tell application id "com.devon-technologies.thinkpro2"
		if not (exists think window 1) then error "No window is open."
		set this_URL to the URL of think window 1
		if this_URL does not start with "http://" then error "There is no web URL for this DEVONthink record."
		set this_name to the name of (content record of think window 1)
		if useShort is true then
			set s to shortenerURL & this_URL
			set this_URL to (do shell script "curl --url \"" & s & "\"")
		end if
	on error error_message number error_number
		if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
	end try
end tell

tell application "System Events"
	if this_name is not "" and this_URL is not "" then
		open location "tweetie:" & this_name & " " & this_URL
	end if
end tell

Thanks for posting the script! For those not using Tweetie, here’s a generic script: viewtopic.php?f=20&t=10850