Re: Setting signatures in Mail.app from osascript
Re: Setting signatures in Mail.app from osascript
- Subject: Re: Setting signatures in Mail.app from osascript
- From: LuKreme <email@hidden>
- Date: Thu, 10 Apr 2008 07:18:15 -0600
No one has any idea why this script works as a script editor script
but not as a osascript?
On 8-Apr-2008, at 04:45, LuKreme wrote:
I have the following shell script:
osascript \
-e "if ((do shell script \"ps -c -U user | awk '/Mail/{print $4}'\")
= \"Mail\") then" \
-e " set fortune to do shell script \"/opt/local/bin/fortune /Users/
user/mysigs\"" \
-e " tell application \"Mail\"" \
-e " set content of signature \"Fortune\" to \"-- \" & return &
fortune" \
-e " end tell" \
-e "end if"
Which when run, appears to do nothing at all. That is, the contents
of the signature named "Fortune" do not change. If I run the
following from Script Editor:
if ((do shell script "ps -c -U user | awk '/Mail/{print $4}'") =
"Mail") then
set fortune to do shell script "/opt/local/bin/fortune /Users/user/
mysigs"
tell application "Mail"
set content of signature "Fortune" to "-- " & return & fortune
end tell
end if
It works perfectly, changing the signature every time the script runs.
I've looked over the two numerous times and even repasted the SE
version into the shell script and reapplied the "'s and -e's and
such. I am stumped.
I actually made a recent change to the script, but got no difference
in behavior:
set myname to system attribute "USER"
if ((do shell script "ps -c -U " & myname & " | awk '/Mail/{print
$4}'") = "Mail") then
I also saved the Applescript as an app and I can launch it from cron
periodicially to change the signature, but the osascript version
simply will not work.
--
I said pretend you've got no money, she just laughed and said, 'Eh
you're so
funny.' I said, 'Yeah? Well I can't see anyone else smiling in here.'
_______________________________________________
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