Topic: https://brettterpstra.com/2011/12/31/desktop-quotes-geeklet/
hide preview

What's next? verify your email address for reply notifications!

Bastian 12y, 172d ago

The quotation marks are a nice touch. I'm guessing it's an PNG? Could you maybe upload it or do you know which typeface it's from?

hide preview

What's next? verify your email address for reply notifications!

Nick B 12y, 328d ago

Great !! that works a treat! thank you!!. Cause I'm a n00b canyou tell me what the script means so help my understanding and you used a bash not applescript would this have made any difference?

hide preview

What's next? verify your email address for reply notifications!

Nick B 12y, 332d ago

Hi I'ma total nOOb and was thinking of another way to use your script.. which is great!!I'm trying to think of a way to get your script to get quotes from a my Mac and not a website and then display them in random orderm changing every 5 minutes or so. I only have to create small text files and place them into thesame folder for the list to grow. Can you please help??

remark link
hide preview

What's next? verify your email address for reply notifications!

Brett 12y, 332d ago

Using Bash, it would just be a matter of creating an array using ls of the files in the folder, picking a random number between 0 and the numbers of items in the array, and then using cat to print the file at the randomly selected index.

For example:

#!/bin/bash

QUOTES_DIR=~/Desktop/quotes
IFS='
'
quotefiles=(`ls -1 "${QUOTES_DIR}"`)
count=${#quotefiles[@]}
cat ${QUOTES_DIR}/${quotefiles[$((RANDOM%$count))]}

Picks a random file from a "quotes" folder on the Desktop and outputs its contents. Just set a script like that as the command for a geeklet with a 5 minute delay. Hope that gets you started.

hide preview

What's next? verify your email address for reply notifications!

Gary L. Gray 13y, 13d ago

Long quotes don't seem to wrap for me (either that, or the wrapping is set longer than I like). What do I change in the above command to set the wrapping to a shorter width?

Thank you.

hide preview

What's next? verify your email address for reply notifications!

Bluereef 13y, 39d ago

How can I make my own quote geeklets? I have about 30 quotes in a txt file that I would like to use. Is this possible?

hide preview

What's next? verify your email address for reply notifications!

Dr. Drang 13y, 79d ago

Cute idea. Could also use fortune so it works when you're offline or the server is down.

hide preview

What's next? verify your email address for reply notifications!

RObert 13y, 80d ago

What typeface are you using in your example above?

remark link
hide preview

What's next? verify your email address for reply notifications!

Brett 13y, 79d ago

Raleway. It's free.

hide preview

What's next? verify your email address for reply notifications!