MacOS – Is it possible for an AppleScript .app file to retain its custom icon, even after edits have been made to the code

applescriptapplicationscustomizationiconmacos

I've created an AppleScript .app file in Script Debugger.app.

I assigned a custom icon to this .app file by pasting a new icon over the default icon in the application's Get Info window in Finder. The custom icon is set immediately.

However, when I open the app in Script Debugger or Script Editor, to edit the code, and then resave the file, the custom icon disappears.

On save, the following icon immediately takes the place of the custom icon:

Of course, having to go through the process of setting the custom icon every time that I save (i.e., edit) the file is an inconvenience.

Is there a way for my custom application icon to remain in place, even after the .app file has been modified?


Here is a similar post:

App made in Applescript; Icon won't change

The answer to the above post gave me the idea to delete the default icon file located at /Contents/Resources/applet.icns (which I accessed by right-clicking the .app file in Finder and clicking the Show Package Contents context menu item). I then pasted my custom icon into this Resources folder, and renamed my icon applet.icns.

The effect of this was a custom icon in informational dialogs in my AppleScript application, but it did not actually change the actual application icon (i.e., the icon that is inserted into the Dock while the application is running). But, at least this custom dialog icon did remain in place upon re-saving/editing the AppleScript code.

Best Answer

I followed your exact same procedure and found the exact same problem on operating system Sierra as well. After trying a few things I decided (in addition to changing the main Applications icon in the get info window) to do the exact same thing in the get info window of the applet.icns file and change it's icon as well. I then opened that script editor app in scripteditor and saved the file. The new icons remained as I changed them. Tested in script debugger also and my custom icons remained untouched.

enter image description here