0

I've attempted to make a shortcut that will tell me the bundle ID of an app. It seems to be not working at the applescript part - rather than displaying the result of the script, it simply tells me the combined text from the previous stage. It is meant to:

Request user to select an app, Take the name of that app and insert it into the bundle ID command, Run that command in applescript Show the result and copy to clipboard enter image description here

1 Answer 1

-1

This following AppleScript code will do everything you need...

  • Asks user to choose an application
  • Gets the bundle id of chosen app
  • Copies the bundle id to the clipboard
  • Displays a Notification with that info

activate
set chosenApp to choose file with prompt ¬
    "Choose An Application" of type "com.apple.application-bundle"

tell application "System Events" to set chosenApp to chosenApp's name

tell application chosenApp to set appID to id

set the clipboard to appID

display notification "The ID For " & chosenApp & ¬
    " Was Copied To Your Clipboard" & linefeed & appID with title "Get App ID"
2
  • You don't need to use System Events to get the application name, as the application specifier accepts file paths. Since choose file returns an alias, you can either coerce this to text and use that; or you can use the alias provided you use construct the application reference using the named key form, i.e. either tell application ":HFS:path:to:file.app:" or tell application "/posix/path/to/file.app" or tell the application named (alias "..."). Although, it's best to avoid tell, as that will cause some apps to launch, whereas id of application "..." shouldn't.
    – CJK
    Nov 12, 2022 at 20:55
  • All that being said, I think you've missed the main focus of the OP's issue. Their issue wasn't with formulating a functioning AppleScript; it was incorporating the AppleScript into a Shortcut. As such, this fails to answer the OP's question.
    – CJK
    Nov 12, 2022 at 20:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .