Two More AppleScripts

Here’s two more AppleScripts I use all the time with some key shortcuts using Red Sweater Software’s FastScripts.

Link as Tiny URL
Just a variation of the “Clipboard to Tiny URL” I posted recently that works with the URL of the frontmost window in Safari instead of the clipboard:

	tell application "Safari"
		set longURL to URL of front document
	end tell

	set cmd to "curl http://tinyurl.com/api-create.php?url=" & longURL
	set shortURL to do shell script cmd
	set the clipboard to shortURL as text
	beep

Open Selected Yojimbo Bookmarks
I use this with Bare Bones Software’s excellent Yojimbo information organizer. What this script does is iterate through the list of selected items in Yojimbo, and open any Bookmark items in your default browser. I bookmark a lot of blog entries and articles in Yojimbo, and often want to open a few of them at once. I use FastScripts to have this run when I press Command-Shift-O.

	set myURLs to {}

	tell application "Yojimbo"
		set selectedItems to the selection

		repeat with currentItem in selectedItems
			if the class of currentItem is bookmark item then
				set myURLs to myURLs & the location of currentItem
			end if
		end repeat
	end tell

	repeat with currentURL in myURLs
		open location currentURL
	end repeat

Download: URLScripts.zip (2kb)

Leave a Reply