PDA

View Full Version : Applescript Application icon won't change




Link1010
Jun 6, 2013, 03:50 PM
Okay, so I just got Front row back on my macbook pro, but in order to activate it i needed to make an applescript. The script works fine and will activate front Row, but when I save my script as an application it wont let me change the icon of it. every time I try to replace the icns file with my own (yes changed the name to match of my icns file to match the previous one) all that it shows is the preview applications icon with the letters icns below it.

I have also tried to change it by copy and pasting it using finder.

Can someone please help me? I dont know what to try :(

P.S. If you want I can upload my file to dropbox so you can try and change it yourself.



kryten2
Jun 6, 2013, 04:06 PM
Okay, so I just got Front row back on my macbook pro, but in order to activate it i needed to make an applescript. The script works fine and will activate front Row, but when I save my script as an application it wont let me change the icon of it. every time I try to replace the icns file with my own (yes changed the name to match of my icns file to match the previous one) all that it shows is the preview applications icon with the letters icns below it.

I have also tried to change it by copy and pasting it using finder.

Can someone please help me? I dont know what to try :(

P.S. If you want I can upload my file to dropbox so you can try and change it yourself.

Does the icns file show when you preview it in the Finder? Or does it also show with the letters icns below it? Could be a wonky icns file. Please attach it to your post and the application as well.

Link1010
Jun 6, 2013, 06:04 PM
Does the icns file show when you preview it in the Finder? Or does it also show with the letters icns below it? Could be a wonky icns file. Please attach it to your post and the application as well.

I'm currently changing up my script a bit, so I'll upload it soon, but for now here is the icon (it wont let me attach it because it is in the icns format)

https://www.dropbox.com/s/zh0nzl4tg04kuw3/applet.icns

Link1010
Jun 6, 2013, 06:35 PM
Does the icns file show when you preview it in the Finder? Or does it also show with the letters icns below it? Could be a wonky icns file. Please attach it to your post and the application as well.

Yes i can see the icon when i quick view it. Here is the application.
**NOTE: it will probably not work or do anything for you unless you have front row installed** (or it might not work period cause im not that good with applescript yet)

https://www.dropbox.com/sh/ccasvifc0j14n5m/J__BevW2Wh

kryten2
Jun 6, 2013, 07:01 PM
Copy and pasting the original Front Row icon using the Finder works for me.
Changing the applet.icns file in the Resources folder of the application with the one from the Resources folder of Front Row (eg frontrow.icns) also works.
The third attached thumbnail is your applet.icns file. Something wrong there. It's missing the 256 x 256 and 512 x 512 pixels images. Try the one in the attached zip file.

Note : By application I mean something I made not yours.

Edit : I downloaded your application and it shows the Front Row icon just fine.128 x 128 pixels that is.

Link1010
Jun 6, 2013, 10:04 PM
Copy and pasting the original Front Row icon using the Finder works for me.
Changing the applet.icns file in the Resources folder of the application with the one from the Resources folder of Front Row (eg frontrow.icns) also works.
The third attached thumbnail is your applet.icns file. Something wrong there. It's missing the 256 x 256 and 512 x 512 pixels images. Try the one in the attached zip file.

Note : By application I mean something I made not yours.

Edit : I downloaded your application and it shows the Front Row icon just fine.128 x 128 pixels that is.

Okay so, I copied you icon into the resources folder and nothing happened, I also tried doing the finder way and then restarted my mac to see if it would change then, but of course again, nothing changed unfortunately :(. But when I started spamming the paste button, the icon appeared for a couple seconds and then went away. Check out my screen recording, it'll show you what happens.

BTW thanks for all your help so far! :)

kryten2
Jun 9, 2013, 02:39 PM
Really don't know what's causing this. Could be corrupted caches or quicklook acting strange. You'll have to look up how to clear caches or fix quicklook.
One last thing you can try is to use SetFileIcon (http://www.hamsoftengineering.com/codeSharing/SetFileIcon/SetFileIcon.html).

Asanga
Jun 11, 2014, 02:33 PM
Really don't know what's causing this. Could be corrupted caches or quicklook acting strange. You'll have to look up how to clear caches or fix quicklook.
One last thing you can try is to use SetFileIcon (http://www.hamsoftengineering.com/codeSharing/SetFileIcon/SetFileIcon.html).

This may be already solved for the OP. Since the solution was not written, I thought of writing what I found when I tried to do the same (i.e., change the icon of the Apple Script based app).

I copied a new icon file (applet.icns) and even though the file was there, it did not appear in the Finder beside the app. After some unsuccessful experiments, I found that in the .app directory, in addition to the Contents directory there was a hidden file starting with the name “Icon?”. This was only visible once I opened a terminal and ran a “ls -la”. I removed this file and voila!, the icon appeared beside the app.

I have no idea how that file got there. Maybe it was my experimenting.

Hope this will help others who may have the same issue.

Best regards,

Asanga

An update:

Feels extremely silly to explain this, but this is how I changed the icon.

- select app in Finder and open app directory through “Show Package Contents”
- go to Contents/Resources and copy/paste the new icon (.icns file) onto applet.icns
- select the app, again in Finder and this time, click on “Get Info”
- select the app icon at the top - a blue outline will appear
- copy the icon (.icns file) onto this outlined icon (command-v)
- now, check the .app directory using a terminal - “ls -la”
- the “Icon?” file should be there
- delete this file - “rm Icon^M”
- immediately, the app should have the copied icon beside it in the Finder

BTW, I have OS X 10.9.3 (13D65)

zeppenwolf
Jun 11, 2014, 10:58 PM
...in addition to the Contents directory there was a hidden file starting with the name “Icon?”

Actually, that's not quite exactly the name of the file. That's how UNIX represents a file whose name is "Icon
".

The reason it's called "Icon
" is so that it's utterly impossible for the user to type the same name while in the Finder. Get it? Once you hit the Return key, you've got the name "Icon", so you can never actually type "Icon
".

Are you using Mavericks ? Well, one thing hasn't changed from 1984 until Snow Leopard, which I'm using now as I type, (long story), but I won't be surprised if it's still the same on Mavericks, (whatever the heck a Maverick is???)

Select and Copy a graphic; select a folder, Get Info, and Paste the Copied graphic onto the default folder icon... It works, of course-- the folder now has your custom graphic. What hasn't changed is the way it is implemented: a hidden file is created in the folder with the name "Icon
", and it has a resource fork, with one single resource of type "ICNS", or "icns", (I can't remember), and resource ID -16455.

It might sound strange now, but there was a time when it seemed like ResEdit was the coolest program ever written...

Asanga
Jun 12, 2014, 03:48 AM
Are you using Mavericks ?

Yes.

Select and Copy a graphic; select a folder, Get Info, and Paste the Copied graphic onto the default folder icon... It works, of course-- the folder now has your custom graphic. What hasn't changed is the way it is implemented: a hidden file is created in the folder with the name "Icon
", and it has a resource fork, with one single resource of type "ICNS", or "icns", (I can't remember), and resource ID -16455.

I tried this and saw the “Icon?” file as you mentioned. But, the folder lost the folder icon and shows some other icon, not the one I copied. When I deleted the “Icon?” file, it reverted back to the original folder icon.