Icon of files, volumes, apps

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
paulclaude
Posts: 121
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 3683 times

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

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: 9580
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: 9802
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
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

MaxV
Posts: 1579
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: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

bogs
Posts: 5435
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”