Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I found a script on this site which I edited to make work with Mountain Lion, I thought. It works fine from Automator, but when I save as a service and assign a keystroke to it, it does not. Any help would be appreciated!

tell application "Mail" to activate

tell application "System Events"
    tell process "Mail"
        tell application "System Events" to keystroke "," using command down
        delay 0.1
        activate (first window whose name is "Viewing")
        click checkbox "Use classic layout" of group 1 of group 1 of window "Viewing"
    end tell
end tell
share|improve this question
add comment

2 Answers 2

The script didn't focus the Viewing tab. Try this instead:

activate application "Mail"
tell application "System Events" to tell process "Mail"
    keystroke "," using command down
    tell window 1
        click button "Viewing" of tool bar 1
        click checkbox "Use classic layout" of group 1 of group 1
        click button 1
    end tell
end tell

If it still doesn't work, it might be because of a bug where the shortcuts for Automator services don't always work until you hover the services menu from the menu bar. See this question for other ways to assign shortcuts to scripts.

share|improve this answer
    
Thanks! That script indeed works from within Automator as my other did, but does not work from within Mail via keystroke. I'll look into other ways assign the shortcut. System Preferences works for my other scripts...oh well. –  Evin Carvill-Ziemer Jun 27 '13 at 0:45
add comment

Fixed it! It turns out that a service has to be accessed once from the drop down menu. Then it will work with a short cut...finally!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.