Saturday, October 1, 2022

#1 2022-09-11 07:44:48 am

KniazidisR
Member
From:: Greece
Registered: 2019-03-03
Posts: 2524

Any app: Get app Icon's reference with bundle ID

I am not sure, following handler is the best way to get icon file reference for chosen app.

At least, it doesn't launch the app to do this simple task.

Applescript:


set appIconPath to my getAppIcon:(id of (choose application))

on getAppIcon:theID
   tell application "Finder" to set appHFS to (application file id theID) as text
   try
       set iconHFS to appHFS & ":Contents:Resources:" & (do shell script "defaults read '" & POSIX path of (appHFS & ":Contents:Info") & "' CFBundleIconFile")
       if iconHFS does not end with ".icns" then set iconHFS to iconHFS & ".icns"
       return iconHFS as alias
   end try
   return missing value
end getAppIcon:

Last edited by KniazidisR (2022-09-11 10:27:39 am)


Model: MacBook Pro
OS X: Catalina 10.15.7
Web Browser: Safari 14.1
Ram: 4 GB

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)