I collect little quotes and funny thoughts and have them randomly shown below my mail, one at a time. Over the years I have done this in a number of ways, but never found a really practical solution other than running a dedicated program, when I was on Windows. I was never able to find a proper solution for OSX.
The only way forward was writing a shell script. This was relatively easy and I found some easy hints for selecting a line from one file and inserting it is another HTML/text file. Let’s just say I never bothered to understand ‘sed’ but copy-pasted a nice solution from the ‘Net.
The problem was that I want to repeat the job every 15 seconds or so, to create a new tag-line over and over again. The script I found did it with an infinite loop and a sleep=command. Not the nicest way, to put it mildly. The other obvious reason is creating a cronjob, but it seems OSX has a better solution for running scripts repeatedly.
The trick is to create a plist file. It is a bit of a weird crossover between an XML and a property file (i.e. order matters!), but the syntax is straightforward. And by adding the <StartInterval> you control the number of seconds the app is restarted. Easy!
So my plist file is
<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE plist PUBLIC “-//Apple//DTD PLIST 1.0//EN” “http://www.apple.com/DTDs/PropertyList-1.0.dtd”>
<plist version=”1.0″>
<dict>
<key>Label</key>
<string>net.strelitzia.signaturerandomizer</string>
<key>ProgramArguments</key>
<array>
<string>/Users/uid/scripts/signature/signaturerandomizer.sh</string>
</array>
<key>StartInterval</key>
<integer>30</integer>
</dict>
</plist>
The next step is to copy this file to ~/Library/LaunchAgents and the next time you login (or restart?) the script runs.
An easy solution, out of the box, when you know what to look for on OSX.
How do I add the shadows to a Joomla template?
n9en73
cwq7iq
r43xc1
7d0ppr