hello,
i'm having a strange problem with applescript+keynote. when i try to use system events to invoke menu commands via a script like
click menu item "Copy Animation" of menu bar item "Format" of menu bar 1
(inside of enough tell...-brackets).
the problem seems to boil down to the fact that (at least on my computer) the following script returns {}
tell application "System Events"
tell process "Keynote"
return entire contents of menu bar 1
click menu item "Copy Animation" of menu bar item "Format" of menu bar 1
end tell
end tell
this script works for every app i've tried it for, but not keynote, where it always returns {}
i see two possibilities: keynote is fundamentally broken in a way that its menu bar circumvents the canonical process to make a menu bar, or keynote is broken on my machine, in which case (i already reinstalled) i'm wondering what i can do to restore a good version.
thanks for any help in advance
peter purgathofer
well, what would you know, i solved this myself!
it turns out, keynote starts not one but TWO application processes, both named »keynote«. the first process has no menu bar, i suspect it is there for presenting; the second process though has the menu bar and can be addressed properly.
the script from my original post (as corrected in the first comment) works well, if it is written like this:
tell application "System Events"
set goodK to id of second application process whose name is "Keynote"
tell application process id goodK
return entire contents of menu bar
end tell
end tell
so far, the SECOND process was always the 'good' process 🤷