another questioin: getting Mac application icons

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
rfarnold
Posts: 7
Joined: Mon Feb 19, 2007 5:35 am

another questioin: getting Mac application icons

Post by rfarnold » Sat Feb 24, 2007 8:57 pm

Hello again,

Does anyone know how to capture an application's icon as an image in a Rev stack, ideally through drag and drop or conversely through answer file/folder? I can handle the drag & drop or answer functions to identify the application, but how might I trigger an import of its application either as an icon or a graphic? This is on Mac OSX by the way.

If someone doesn't know this but can tell me where the icons for an application are in OSX that might help -- I can't find them in the app package anywhere.

Thank you

Bob Arnold

Obleo
Posts: 174
Joined: Mon Apr 10, 2006 10:35 pm
Contact:

Post by Obleo » Sun Feb 25, 2007 12:15 am

The icons should be located in the resource folder of package contents.

To make an icon or (icns); the easy and free way is use Icon Composer, part of the development tools that come with OSX .It is simple drag in drop. There is a few 3rd party icon builders such as icon factory, but cost a little much and require photoshop and do basically the same thing.

also In the standalone builder for OSX card, there is a button for adding your application icon.

Oh one other thing there also a tool called icon browser also part of the OSX where you can search your application for all icons, if you are unable to locate them manually.

If the development tools are not installed they should be on your install disc as extras. or can be download at apple's adc web site.

hope this helps.

-ob

Obleo
Posts: 174
Joined: Mon Apr 10, 2006 10:35 pm
Contact:

Post by Obleo » Sun Feb 25, 2007 12:33 am

To get an image from an icon format with OSX, they only way I know is by shell script. I have heard Tiff, PNG, and Jpeg have worked.

This is the shell script I had; in my script achive. You would need to figure out how the get it to work with revolution. I hope it helps part of your question.

Code: Select all

sips -s format png /Path/To/Icon.icns --out /Path/To/ConvertedImage.png

--- use the above code. well do it.

% find . -iname "*.jpg" | xargs sips -

-- this was also part of my script notes not sure what for.
I forgot, it only works with 10.4 or later.

edit; I only tried it with png, I would belive any sip image format should work.

-ob

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Sun Feb 25, 2007 12:21 pm

Hi,

I am working on a library that displays application icons in Revolution. Basically, it converts icns files, which appeared pretty easy. There are still a few problems, though.

You can download a demo here:

http://economy-x-talk.com/software/Icon ... 20Demo.sit

One of the problems is that it works only with application packages that contain an icns file.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

xApple
Posts: 113
Joined: Wed Nov 29, 2006 10:21 pm

Post by xApple » Sun Feb 25, 2007 2:06 pm

Yup, usually the icon of an application is located exactly here:
"/Applications/iTunes/Contents/Resources/iTunes.icns"

However, these documents never contain spaces, hence for Address Book:
"/Applications/Address%20Book/Contents/Resources/AddressBook.icns"

But there are some exception like iCal and Safari have their icons here:
"/Applications/iCal/Contents/Resources/App.icns"
"/Applications/Safari/Contents/Resources/compass.icns"

An other thing to check is if the user has pasted a custom icon onto the application, then the icon will be located here:
"/Applications/iTunes/Contents/Icon"
This file is invisible and contains the icns not in it's data fork, but in it's resource fork.

To import them automatically into revolution you can use a shell script after having located them.

If you are ready to do it manually the easiest way is just to copy the icon of the application from its info box and paste that into a new Preview document that you export into PNG and import back into your stack.

Garrett
Posts: 386
Joined: Sat Apr 08, 2006 8:15 am
Contact:

Post by Garrett » Sun Feb 25, 2007 7:44 pm

I was looking for a solution to this some time ago, but not quite as
experienced as some of the others here. So I gave up for the time.

But it looks as though Mark there has not given up and has got something
in the works there :-)

Thanks Mark :-)

rfarnold
Posts: 7
Joined: Mon Feb 19, 2007 5:35 am

Thanks

Post by rfarnold » Sun Feb 25, 2007 11:19 pm

Thanks to everyone for the quick and helpful replies to my query. I'm not sure I am up to the task (or if the application I am building is really worth the effort) but this is very useful info to start with.

Bob Arnold

Post Reply