0

I've read here around but I didn't find any fix for this stupid problem. BBEdit, the most famous Mac text editor, should be widely scriptable and actually so it is. But,.. using Applescript I was trying to execute a menu command and there is no way at all. Or better, if I alternatively try:

tell application "System Events"
    tell process "BBEdit"
        tell menu bar 1
            tell menu bar item "Markup"
                tell menu "Markup"
                    tell menu item "CSS"
                        tell menu "CSS"
                            click menu item "Format"
                        end tell
                    end tell
                end tell
            end tell
        end tell
    end tell
end tell

Or also:

 tell application "System Events" to keystroke "+" using {command down, shift down}

They works both running the Script from the Editor, but they don't work once I save the script and I choose it from BBEdit's AS Menu. Any idea ? Thanks.

Steve
  • 355
  • 3
  • 8

2 Answers2

1

Check how your script is saved: BBEdit's Script menu only runs compiled Applescripts (.scpt files), not text Applescripts (.applescript).

RyanWilcox
  • 13,890
  • 1
  • 36
  • 60
-1

BTW, instead of the 7-way nested tell in the first snippet, just one nest suffices:

tell application "System Events"
    tell process "BBEdit"'s menu bar 1's menu bar item "Markup"'s menu "Markup"'s ¬
        menu item "CSS"'s menu "CSS" to click menu item "Format"
end tell
  • This does not answer the question however. This would have been better as a comment, than an answer, because it does impart useful information, just not the information requested. – Dave Newman Apr 12 '13 at 19:09