Open Wikipedia Topic from Script Menu

May 30, '07 07:30:00AM

Contributed by: matth

This short Applescript prompts you for a Wikipedia topic and opens the resulting page in Safari. There is a nice Wikipedia Dashboard widget, but sometimes you might want full browser access. You can save the script in the Script Menu (~/Library/Scripts/), so it's accessible no matter what application you're in. Wikipedia is smart enough to convert spaces to underscores in the URL, so it's no problem if your topic has spaces in it.

-- Wiki-Lookup
-- Quickly look up an item in Wikipedia

on run
	set Entry to display dialog "Lookup a Wikipedia entry:" default answer ""
	set textEntry to text returned of Entry
	set theURL to "http://en.wikipedia.org/wiki/" & textEntry
	tell application "Safari"
		activate
		make new document with properties {URL:theURL}
	end tell
end run
kirkmc adds: If you don't see the AppleScript menu in your menu bar, open AppleScript Utility (located in /Applications/AppleScript), and check Show Script Menu in menu bar. If you use a different browser, you can change the "Safari" in the script to the name of your browser.

Comments (11)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20070528090709539