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??
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.