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

  • 1 month later...

Some do, some don’t. SideNotes is com.apptorium.SideNotes in the MAS and com.apptorium.SideNotes-paddle outside. That -paddle suffix is somewhat common in these cases. Affinity Designer was com.seriflabs.affinitydesigner and changed to com.seriflabs.affinitydesigner2, both from the MAS. In their case it likely has to do with it being a paid upgrade so needing to make it technically a different app since the MAS doesn’t support that.


So it depends on the app if you should use the name or bundle identifier. In Alfred’s case, the latter is the way to go.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...