The file:
I created an AppleScript .scpt file in Script Debugger.app.
Here is how I assigned a custom icon to this .scpt file:
I downloaded a unique icon (in the "512px PNG" format) from IconArchive.com.
I opened the .png file with Preview.app. In Preview, I clicked Edit ⟶ Copy, to place this image on my clipboard.
I opened the .scpt file's Get Info window in Finder. I left-clicked on the default icon, found in the top-left corner of the Get Info window. A blue outline then appeared around the default icon, reflecting that the icon was selected.
Finally, I pasted the custom icon over the default icon via the keyboard shortcut, ⌘ command + V. The custom icon was set immediately. I closed out of the Get Info window.
The bug:
When I open the .scpt file in Script Debugger, to edit the code, and then resave the .scpt file, the custom icon disappears.
On save, the following icon immediately takes the place of the custom icon:
(This is OS X's default icon for .scpt files.)
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.
But, there is also a second, corollary bug: Each time that I re-add the custom icon in the Get Info window, the file size of the .scpt file cumulatively increases. In other words, when Script Debugger deletes the custom file icon, the icon's file size is still included, somehow, as part of the overall .scpt file size.
Case in point: the file size of the .scpt file in question is 12.6 MB, at the moment. The file should not be larger than .5 MB.
The question:
I understand how to set a custom file icon to an AppleScript .app file, so that this custom icon remains in place after editing, but I am curious if the same can be done for an .scpt file.
Is there a way for my custom script icon to remain in place, even after the .scpt file has been modified in Script Debugger?
This is an .scpt file that is launched via the FastScripts.app menu bar drop-down menu. (The .scpt file is located in /Users/Me/Library/Scripts
.) The FastScripts drop-down menu actually displays the file icons of the scripts, which is a nice feature. This is the reason why I want to set a custom icon to the .scpt file (i.e., so that I can observe an apposite icon in the FastScripts shortcut menu).
No, it is not a big deal to simply convert the AppleScript .scpt files that I want to have a custom file icon to AppleScript .app files. I ask this question just to see if there is something that I am missing or overlooking here.
What about Script Editor?
It appears that this bug is unique to Script Debugger.
When I follow the same steps in OS X's native AppleScript editing program, Script Editor.app, the .scpt file icon remains in tact, upon save. However, I could've sworn that I have, in fact, experienced this issue in Script Editor, in the past.
For example, I recall that, once, Script Editor refused to save a .scpt file that I had edited; a vague error dialog was presented on Save. To successfully save the file, I had to either delete the custom icon from Finder's Get Info window, or copy the code text and paste it into a new .scpt file (which, of course, would necessarily possess the default .scpt file icon).
But, at this time, I can no longer reproduce the error in Script Editor.
At any rate, I try to not use Script Editor to edit my AppleScripts anymore. This is because Script Editor is laggy, potentially crashes when using a third-party script library, and can be temperamental when it comes to opening and saving files.
In my experience, so far, Script Debugger has none of these issues.
Of course, Script Debugger does have at least one issue, though (i.e., the issue detailed in this post).
OS X El Capitan, version 10.11.6.