Icon of files, volumes, apps

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

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

Post Reply
paulclaude
Posts: 98
Joined: Thu Mar 27, 2008 10:19 am

Icon of files, volumes, apps

Post by paulclaude » Wed Nov 08, 2017 4:11 pm

There's a way to import the icon of an app or a volume, to display it as imagesource in a list (the files, the folders) ?
screenshot-08.11.2017_155247.png
screenshot-08.11.2017_155247.png (16.98 KiB) Viewed 494 times

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2679
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: Icon of files, volumes, apps

Post by richmond62 » Wed Nov 08, 2017 6:54 pm

Is your screenshot from something inside a Livecode stack, or just from the Macintosh operating system's Finder?

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5488
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Icon of files, volumes, apps

Post by dunbarx » Wed Nov 08, 2017 6:55 pm

Hi.

You can always take a screen shot of the icon and get a PNG. Not sure if there is a more "direct" way.

Craig Newman

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6108
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Icon of files, volumes, apps

Post by FourthWorld » Wed Nov 08, 2017 7:17 pm

A more direct way would be to use LiveCode Builder to talk directly to the OS APIs to obtain that image data. A bit of work, but doable.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

MaxV
Posts: 1535
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

Re: Icon of files, volumes, apps

Post by MaxV » Thu Nov 09, 2017 3:06 pm

You can extract the icons this way:
  1. Import the screenshot image in Livecode
  2. Use another empty image as rectangle, call it "borders". Place it where you want to extract the image.
  3. Code: Select all

    put the rect of image "borders" into temp
    import snapshot from rect temp of this card
Tested and works!
Livecode Wiki: http://livecode.wikia.com
My blog: http://livecodeitalia.blogspot.it
To post code use this: http://tinyurl.com/ogp6d5w

bogs
Posts: 2093
Joined: Sat Feb 25, 2017 10:45 pm

Re: Icon of files, volumes, apps

Post by bogs » Thu Nov 09, 2017 3:14 pm

Max, that is awesome and simple. I am tucking it away for future use :D
Image

Post Reply

Return to “Talking LiveCode”