change the file icon of the current applet

Hi, hope someone can help. I am trying to add an extra code to my applet. The idea is to avoid others from changing the icon i assigned to it.

I added this code:


set ggg to (path to desktop folder) & "untitled.PNG" as text
set the icon of x to ggg

this returns a overflow error, so I download this from the internet:


set exePath to (path to home folder as text) & "UnixBins:SetFileIcon"

set imagePath to (path to desktop folder as text) & "theImage.png"
set theFile to (path to desktop folder as text) & "Some File.txt"

do shell script quoted form of POSIX path of exePath & " -image " & quoted form of POSIX path of imagePath & " -file " & quoted form of POSIX path of theFile

but i was not capable of making it run, to be honest i do not even know what the exePath variable is for… some help will be appreciated.

thank you for your time!

Brian

Hi,

assuming you downloaded the SetFileIcon executable
the script expects it in the folder “UnixBins” in your home folder

thank you! :slight_smile: … another solution would be just to remove the custom icon, I will post a new topic on this one!

SetFileIcon can remove the custom icon too


.
do shell script quoted form of POSIX path of exePath & " -removeCustomIcon -file " & quoted form of POSIX path of theFile

thank you but i can see the exePath again! I did not download anything I just have applescript! but this is the right idea! thank you very much!!! :smiley: