Lion AppleScripts not working in Mountain Lion?

Discussion in 'OS X Mountain Lion (10.8)' started by inaka, Aug 2, 2012.

  1. macrumors 6502

    Apr 26, 2010
    Hey all, I purchased and installed ML on the first day it was available, but had to revert back to my Lion clone because it seemed quite a few crucial AppleScripts no longer worked in ML.

    A really easy AppleScript that I had to simply speak the name of the sender in AppleMail as a rule no longer worked. I moved the AppleScript into the mail scripts folder, (I think it was "/Library/Scripts/Mail Scripts") but still no dice.

    I also had a key automator service what would create a To Do list item in iCal, but that too was broken since, I guess, iCal is now Calendar, etc.

    Anyone else have this experience with broken AppleScripts in ML?
  2. C64
    macrumors 6502a


    Sep 3, 2008
    I'm haven't noticed any problems with AppleScripts in ML. Don't use any in Mail or Calendar though. If I try to add an AppleScript to a new rule in Mail in ML, the default folder is ~/Library/Application Scripts/ So that's in the user's Library, not the system's Library.
  3. thread starter macrumors 6502

    Apr 26, 2010
    Since I have removed Mountain Lion, I can't check my exact path for scripting and mail rules, but I know it was correct. In fact, if I remember correctly, you can no longer select any path to your AppleScript, and instead it must be in the correct scripts folder (and only there) where you can then select it as a pull-down menu, right?

    ML came with some existing scripts and I made sure my script was in that same folder to be selected, similar to audio sounds as mail alerts, etc.
  4. macrumors 6502a


    May 11, 2012
    The few Applescripts I made for everyday routines stopped working in ML :mad:
  5. thread starter macrumors 6502

    Apr 26, 2010
    Me too.
    It was a deal breaker since I use them all the time. Argh.

    Had to go back to Lion because my AppleScript skills aren't good enough to know what's breaking them.
  6. macrumors 6502a

    Feed Me

    Jan 7, 2012
    Location Location
    Is it just that these AppleScripts simply don't work in ML or is it that they just need to be tweaked a bit to run on the new operating system? I noticed several of mine don't work any more, too.
  7. macrumors member

    Dec 25, 2007
    I run a lot of AppleScripts here as well as various shell scripts and after upgrading to Mountain Lion, everything is working just as well as before. I'd be interested to see the source of the script that no longer works. Im pretty good with AppleScript so I'd be happy to have a look and see if I can fix it for you.
  8. thread starter macrumors 6502

    Apr 26, 2010
    Thanks phobox. Maybe you can make heads/tails of this.

    Once again, my knowledge of AppleScript is fairly limited, so what I usually do is simply find scripts that people post, and then slightly tweak them for my needs.

    Here is my simple AppleScript that I setup as a rule in Mail, and it works great in Lion. This didn't work when I upgraded to ML as mail rule.

    It's setup to simply say the name of the sender only:

    on perform_mail_action(info)
    	-- see if iTunes is playing
    	set itunes_playing to false
    	tell application "System Events"
    		if (get name of every process) does not contain "iTunes" then
    			set itunes_playing to false
    			tell application "iTunes"
    				if player state is playing then set itunes_playing to true
    			end tell
    		end if
    	end tell
    	-- pause iTunes if needed	
    	if itunes_playing is true then tell application "iTunes" to pause
    	tell application "Mail"
    		set the_messages to |SelectedMessages| of info
    		repeat with a_message in the_messages
    			set the_sender to extract name from sender of a_message
    			if (junk mail status of a_message) is not true then
    				say "Mail from " & the_sender
    			end if
    		end repeat
    	end tell
    	-- resume iTunes if it was playing before
    	if itunes_playing is true then tell application "iTunes" to play
    end perform_mail_action
    Once again, I saved this script in the proper mail scripts folder and directory for ML's version of, and selected it as a pull-down rule option to play the script on a new mail, but it didn't do anything. Same exact rule works fine in Lion, not ML.

    Any info is appreciated, thanks.
  9. macrumors 6502a


    May 11, 2012
    Thanks for the offer Phobox, but I plan on downgrading for numereous reasons.
  10. macrumors newbie

    Dec 10, 2009
    I have a version of this same script and it does not work in ML. Very irritating.
  11. macrumors member

    Dec 21, 2007

    I have the exact same problme. I kept my speak items script the in the Library/Scripts folder. I place them in the new mail app scripts folder and they no longer work
  12. macrumors member

    Dec 21, 2007
    Apple has included some new scripts that speak senders name

    look in the system Library folder under Scripts/Mail Scripts

    copy them into your user library/Application Scripts/com.Apple.Mail

    they work from there. This seems like an error on apples part that mail cant see them in system library.

    Im going to compare them to my old scripts to see why they no longer work and these do
  13. macrumors newbie

    Dec 10, 2009
    Found a working version

    After much digging I finally found a version that works. I modified it a little to also speak the Subject. I'm sure the iTunes portion can be added to it also. I found the script here.

    The only issue I have found so far is if you open mail and more than one message comes in at the same time it reads all of them at the same time.

    using terms from application "Mail"
    on perform mail action with messages newMessages
    repeat with newMessage in newMessages
    tell application "Mail"
    set senderName to (extract name from sender of newMessage)
    set senderSubject to (extract name from subject of newMessage)

    say "Mail from " & senderName
    say "Regarding" & senderSubject

    end tell
    end repeat
    end perform mail action with messages
    end using terms from
  14. macrumors newbie

    Sep 5, 2012
    Apple Script Mountain Lion Mail

    Had the same annoying experience but found out the following:

    While Mountain Lion talks about

    /Library/Scripts/Mail Scripts

    for the proper location to run a script from within Mail it has to be:

    /Library/Application Scripts/

    Saving my former script to this location did the job!

  15. thread starter macrumors 6502

    Apr 26, 2010
    I'm not sure if Apple changed something, but this script works great for me in testing.

    I just got a new Mac with Mountain Lion shipped on it, so there's no turning back for this machine. The script above worked great, and I sent multiple emails to myself as a test and even if I received a few at once, the script spoke each sender separately and not at the same time.

    Wanted to say a BIG thanks!

    I wonder if Apple maybe corrected this in a or OSX update?
  16. thread starter macrumors 6502

    Apr 26, 2010
    Looks like I spoke too soon.

    After a really detailed bit of testing, it appears that in Mountain Lion, Applescripts as rules work fine with IMAP accounts, and don't work with POP accounts.

    Most frustrating. :(

Share This Page