Changes in osascript?
Changes in osascript?
- Subject: Changes in osascript?
- From: LuKreme <email@hidden>
- Date: Tue, 27 Jan 2009 19:28:46 -0700
I have the following script which I have been using via cron for along
time (Since I posted about it in Apr 08). It stopped working recently,
so I decided to make a LaunchAgent for it, but it still does not
work. The script is run, but the script cannot see that Mail is
running:
#!/bin/sh
/usr/bin/osascript \
-e "set myname to system attribute \"USER\"" \
-e "set shellscpt to \"ps -c -U \" & myname & \" | awk '/Mail/
{print \$4}'\""\
-e "set myMail to do shell script \"echo\" & space & (quoted form
of shellscpt) & space & \"| /bin/bash\" " \
-e "if myMail = \"Mail\" then "\
-e " set fortune to do shell script \"/opt/local/bin/fortune /Users/
syth/mysigs\""\
-e " tell application \"Mail\" to set content of signature \"Fortune
\" to \"-- \" & return & fortune"\
-e "end if"
touch $HOME/.sigrun
I know the script is getting run, because .sigrun is updated with the
appropriate time stamp. I did some debugging (not that I understood
it) and posted it at <http://home.kreme.com/randsig-debug.txt>
Running the script (~/bin/randsig) manually works fine; running the ps
command does exactly what is expected:
$ ps -c -U kreme | awk '/Mail/{print $4}'
Mail
the cron failure email message also contains these headers:
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=kreme>
X-Cron-Env: <USER=kreme>
X-Cron-Env: <HOME=/Users/kreme>
I went ahead and added the full path to osascript anyway, but no change.
It appears to me that the script no longer is able to see that
Mail.app is running, but ps and awk are in the path (/bin/ps /usr/bin/
awk).
--
I loved you when our love was blessed I love you now there's
nothing left But sorrow and a sense of overtime
_______________________________________________
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