Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Fix iChat AppleScripts in Mountain Lion System 10.8
I noticed that my iChat-related AppleScripts had stopped working after the 10.8 upgrade. Apparently, Messages no longer answers to the name iChat; you have to edit your scripts to call "Messages" instead, like this:
tell application "Messages" to set status message to "On Mountain Lion"
I'm pretty sure the beta didn't break backwards compatibility like that, and I really can't think of a good reason for it.

[kirkmc adds: It's true that the name of an application like this changes it should probably still respond to the old name. So scripters beware. It's worth noting that both Contacts and Messages do respond to their old names if you search for them in Spotlight, though Calendar does not.]
    •    
  • Currently 3.75 / 5
  You rated: 5 / 5 (4 votes cast)
 
[3,495 views]  

Fix iChat AppleScripts in Mountain Lion | 4 comments | Create New Account
Click here to return to the 'Fix iChat AppleScripts in Mountain Lion ' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Fix iChat AppleScripts in Mountain Lion
Authored by: XDave on Aug 24, '12 09:10:27AM

Also mail scripts seem to have broken. I have used this one as a rule for a long time successfully. The Mountain Lion OSX has rendered it useless. Hoping someone can help.

on perform_mail_action(info)
tell application "Mail"
set theMessages to |SelectedMessages| of info
repeat with thisMessage in theMessages
set AppleScript's text item delimiters to {""}
set thisSender to sender of thisMessage as string
set quotepos to offset of "\"" in thisSender
if (quotepos is not 0) then
set thisSender to (text items (quotepos + 1) through -1) ¬
of thisSender as string
set quotepos to offset of "\"" in thisSender
if (quotepos is not 0) then
set thisSender to (text items 1 through (quotepos - 1)) ¬
of thisSender as string
end if
else
set atpos to offset of "@" in thisSender
if (atpos is not 0) then
set thisSender to (text items 1 through (atpos - 1)) ¬
of thisSender as string
end if
set brkpos to offset of "<" in thisSender



[ Reply to This | # ]
Fix iChat AppleScripts in Mountain Lion
Authored by: pbeyersdorf on Aug 24, '12 12:00:43PM

After upgrading to mountain lion I expected to have trouble with a few scripts I had been using with "iCal". I was suprised that they kept working, and when I opened them in applescipt editor the lines that said "tell app iCal" had magically changed to "tell app Calendar". I'm not sure why it did this and why iChat doesn't make the same transition (maybe because more than just the name changed?".



[ Reply to This | # ]
Re: Fix iChat AppleScripts in Mountain Lion
Authored by: Uncle Asad on Aug 24, '12 07:36:49PM

Compiled AppleScripts (every type of AppleScript with an extension other than .applescript) are saved as, well, compiled “code” rather than the text you type. For commands, properties, and so forth, the pieces of the script are compiled into the appropriate Apple Event signature. When Script Editor opens a script, it “decompiles” the Apple Events back to human-readable text (whereas when running the scripts, those Apple Events are just sent to apps).

References to applications themselves are stored in a couple of ways in compiled scripts, including by path and by creator code. It’s possible this has been changed/expanded in newer OS versions (to use bundle identifier rather than creator code, for instance), but the creator code app reference is what allows Script Editor to pick up on app name changes like the “iCal” to “Calendar” change you saw.

All of which is a long way of saying that perhaps Messages has a different creator code or bundle id from iChat, whereas iCal and Calendar both share the same code/id. Since Messages is in some ways a “new” app while Calendar is just a simple name change, it would not be unreasonable for Messages to get a new creator code and bundle id.



[ Reply to This | # ]
Re: Fix iChat AppleScripts in Mountain Lion
Authored by: pbeyersdorf on Aug 26, '12 10:31:54PM

Thanks for the explanation. This makes sense now.



[ Reply to This | # ]