The attached AppleScript retrieves a random line from a file called quotes.txt. This file should be saved in utf8 encoding. (Use TextWrangler or BBedit to create it and fill it with your favorite quotes manually) Every quote in this file has to be on one line. Make sure to remove all empty lines, especially at the end of the file or you will get an empty quote sometimes.
The code of the Applescript is thus:
set quoteFile to "/Users/det/Documents/Geeklets/quotes.txt" set tmpFile to "/Users/det/Documents/Geeklets/tmp.txt" open for access quoteFile set theQuote to some paragraph of (read quoteFile as «class utf8») close access quoteFile open for access tmpFile with write permission set eof tmpFile to 0 -- delete old quote write theQuote to tmpFile as «class utf8» close access tmpFile
Modify the two paths above according to your system. The file tmp.txt does not have to exist. It will be created automatically if its not at the location specified.
Then call this script in GeekTool with a new shell geeklet using the command:
#!/bin/bash osascript /Users/det/Documents/Geeklets/randomQuote.scpt cat /Users/det/Documents/Geeklets/tmp.txt | fold -sw60
Again, modify the path to the AppleScript accordingly. I placed all files in a folder called Geeklets in my documents folder. Modify the line length in the fold command "fold -sw60" to fit the width of your geeklet.
Why do I write the retrieved quote to a temp file? Because the output of osascript is not utf8 savvy. Therefore the AppleScript writes the retrieved quote output to a file from which it is retrieved with a simple cat command.
Have fun Detlef