How do I write an AppleScript that clicks a menu item in a specific app (ie “File > New Email” in Spark)? Is using the “click” command the best way? Is there a more direct script structure?
Here’s what I have:
tell application "System Events" to tell process "Spark"
set frontmost to true
click menu item "File"
click menu item "New Email" of menu 1
end tell
I get this error message:
I got the script idea from this StackExchange thread.
Use case:
I often have to shoot out emails while I’m working on something else. This means I have to app-switch to my email client, (Spark), and then hit a key command to open a “new email” window. To decrease mental load, I want to create a universal key command (shift+command+n) that opens the “new email” window right away. To do that, I think I need to assign an AppleScript to an “All Applications” key command.