(* Man oh Man 1.0 by Jim DeVona http://anoved.net/2007/02/man-oh-man.html This script simply prompts the user for a term to look up in the system manual (man) pages. By default the results are displayed with Bwana, but the user can also opt to render the man pages as nice printable PostScript (converted to PDF) with Preview. The latter option takes longer. Bwana is a free utility available at http://www.bruji.com/bwana/ that renders man pages in your browser. It implements the "man:" URI scheme. The Preview method is based on this Mac OS X hint: http://www.macosxhints.com/article.php?story=20051225101106519 Issues: Not much error checking, and its absence is particularly conspicuous around "do shell script", which could be confused by malformed input or a man query that yeilds no results. *) set _dlog to display dialog "Consult manual:" default answer "" buttons {"Cancel", "Preview", "Bwana"} default button 3 cancel button 1 with title "Man Oh Man" giving up after 60 set _query to the text returned of _dlog set _action to the button returned of _dlog if _action is equal to "" or _action is equal to "Cancel" then return else if _action is equal to "Preview" then do shell script "man -t " & _query & " | open -f -a /Applications/Preview.app" tell application "Preview" to activate return else if _action is equal to "Bwana" then open location "man:" & _query return end if