Re: Snow Leopard and my randsig script
Re: Snow Leopard and my randsig script
- Subject: Re: Snow Leopard and my randsig script
- From: Paul Scott <email@hidden>
- Date: Thu, 3 Sep 2009 09:49:54 -0700
One potential problem is if fortune returns text with embedded double
quotes. You may have to pipe the fortune through 'tr' to replace the
double quotes with single quotes.
Paul
On Sep 3, 2009, at 9:03 AM, LuKreme wrote:
I have the following script:
#!/bin/bash
MAIL=`ps -U"$USER" -co command | grep "\bMail\b"`
$HOME/bin/fortune $HOME/mysigs > $HOME/.signature
MYSIG="$(<$HOME/.signature)"
if [ "$MAIL" ]; then
osascript <<EOF
tell application "Mail" to set content of signature "Fortune" to
"-- " & return & "$MYSIG"
EOF
fi
--END OF SCRIPT
It is controlled with a LaunchAgent:
<?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>com.kreme.home.randsig</string>
<key>ProgramArguments</key>
<array>
<string>/Users/kreme/bin/randsig</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StartInterval</key>
<integer>15</integer>
</dict>
</plist>
This now gives the following error in Console.app
com.kreme.home.randsig[58548] syntax error: A identifier can’t go
after this “"”. (-2740)
com.apple.launchd.peruser.601[237] (com.kreme.home.randsig[58754])
Exited with exit code: 1
com.apple.launchd.peruser.601[237] (com.kreme.home.randsig)
Throttling respawn: Will start in 7 seconds
com.apple.launchd.peruser.601[237] (com.kreme.home.randsig)
Throttling respawn: Will start in 4 seconds
com.apple.launchd.peruser.601[237] (com.kreme.home.randsig)
Throttling respawn: Will start in 8 seconds
com.apple.launchd.peruser.601[237] (com.kreme.home.randsig)
Throttling respawn: Will start in 1 seconds
com.apple.launchd.peruser.601[237] (com.kreme.home.randsig)
Throttling respawn: Will start in 5 seconds
com.apple.launchd.peruser.601[237] (com.kreme.home.randsig)
Throttling respawn: Will start in 9 seconds
com.apple.launchd.peruser.601[237] (com.kreme.home.randsig)
Throttling respawn: Will start in 2 seconds
This is new in Snow Leopard, as it all worked (finally) in 10.5
without any errors. It still works in Snow Leoaprd, it just throws
all these errors all over the console.
If I run the script manually, there are no errors.
If it matters, this user is NOT an admin user.
--
Penny! *Everything* is better with BlueTooth
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden