Mail initiated applescripts

Discussion in 'Mac Basics and Help' started by Gambuchi, Jun 11, 2007.

  1. Gambuchi macrumors member

    Joined:
    Nov 15, 2003
    Location:
    Oregon
    #1
    Why won't the following rule in mail (I've included the script file, the apple mail rule and my system config) work... I can send the mail to myself, it arrives and sits in the inbox but for whatever reason does not execute the rule which calls the applescript... If I run the script outside of mail, it works perfectly... HELP.
     

    Attached Files:

  2. elfin buddy macrumors 6502a

    elfin buddy

    Joined:
    Sep 16, 2001
    Location:
    Tuttlingen, Germany
    #2
    I see no problem with that script you wrote and it seems to work fine for me (12" PowerBook). Alternatively, you could try a more explicit version of the same script:

    Code:
    tell application "Finder"
    	set tempVar to display dialog "This computer will go to sleep in 1 minute unless cancelled." buttons {"Sleep", "Cancel"} default button "Cancel" giving up after 60
    	set buttonReturned to button returned of tempVar
    	set givenUp to gave up of tempVar
    	
    	if buttonReturned is "Sleep" then
    		sleep
    	else if givenUp is true then
    		sleep
    	else
    		return
    	end if
    end tell
     

Share This Page