Jump to content

Always use Alfred’s bundle identifier when invoking via AppleScript or JavaScript for Automation / JXA


vitor

Recommended Posts

When interacting with an app via AppleScript or JavaScript for Automation (JXA), it is common to do so via its name:

 

tell application "Safari" to activate -- AppleScript

Application("Safari").activate() // JXA

 

But often the bundle identifier is a better choice:

 

tell application id "com.apple.Safari" to activate -- AppleScript

Application("com.apple.Safari").activate() // JXA

 

In Alfred’s case, the latter is always preferred. It’s what the External Trigger uses in the example. Instead of Alfred 5, which changes with new versions, com.runningwithcrayons.Alfred is unchanging so it always points to the latest one installed.

Link to comment
Share on other sites

  • vitor locked this topic
Guest
This topic is now closed to further replies.
×
×
  • Create New...