Apple mail initiated AppleScript.

Gambuchi

Purveyor of Thought...
I am trying to impliment a applescript I got from one of the forums to put my computer to sleep using the arrival of a 'certain' email to trigger an applescript... here is the information you might need to help me figure why it refuses to work.:

The email arrives in the inbox but will not execute the applescript but if I run the applescript outside of mail, it works perfectly. I am lost. If you can help, please do so
 

Attachments

  • Picture 1.jpg
    Picture 1.jpg
    26.4 KB · Views: 6
  • Picture 2.jpg
    Picture 2.jpg
    11 KB · Views: 7
  • Picture 3.jpg
    Picture 3.jpg
    44.4 KB · Views: 5
  • Picture 4.jpg
    Picture 4.jpg
    31.4 KB · Views: 7
I'm not exactly sure as to how to get it to work, but I know why it's not working. Your Apple script is only programed to show a dialog box to ask the user whether they want the computer to be put to sleep or not. Nothing in that script tells it to look for whether there is any mail present.

It's not the script that is causing a problem. The problem that the script isn't being launched when you get that mail.
 
I'm not exactly sure as to how to get it to work, but I know why it's not working. Your Apple script is only programed to show a dialog box to ask the user whether they want the computer to be put to sleep or not. Nothing in that script tells it to look for whether there is any mail present.

It's not the script that is causing a problem. The problem that the script isn't being launched when you get that mail.
Actually, supanatral, the mail program does call the script and the script does launch... the problem is that it hangs just before the "display dialect" line and goes no further or possibly drops out at that point. I've placed some 'beep' commands in it to determine how far it gets so I know it does at least start to work. Odd thing is that if I run the script from the desktop, it works perfectly. I cannot, for the life of me, figure out why it stops right at the 'display dialog' line of code. Perhaps you have an answer for me... also there is a line there that tells the system to 'sleep' and that works from desktop running also. I am curious is perhaps an earlier version of 'Mail' would run it properly and if that is the case then the problem could be related to a programming change in subsequent versions of Mail.
 
Back
Top