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: Mon, 19 May 2008 07:50:04 -0600
On 11-Apr-2008, at 11:54, Laine Lee wrote:
set myname to system attribute "USER"
set shellscrpt to "ps -c -U " & myname & " | awk '/Mail/{print $4}'"
do shell script "echo" & space & (quoted form of shellscrpt) & space
& "|
/bin/bash"
--> "Mail"
Took me a while, but I did finally get a working shell version of this.
#!/bin/sh
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/
kreme/mysigs\""\
-e " tell application \"Mail\" to set content of signature \"Fortune
\" to \"-- \" & return & fortune"\
-e "end if"
I should probably throw it in a try/on error loop for those times
mail.app misbehaves, but that will need to be a project for tomorrow.
just something like "with timeout of 5 seconds" after that if, I
suppose.
--
My little brother got his arm stuck in the microwave. So my mom had
to take him to the hospital. My grandma dropped acid this
morning, and she freaked out. She hijacked a busload of
penguins. So it's sort of a family crisis. Bye!
_______________________________________________
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