Set File Icon?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Set File Icon?
Hello,
Is there a way to set the icon of a file (a Microsoft Word file) for example? After checking the dictionary, there doesn't seem to be a way to do this?
Thank you so much,
Jon
Is there a way to set the icon of a file (a Microsoft Word file) for example? After checking the dictionary, there doesn't seem to be a way to do this?
Thank you so much,
Jon
Re: Set File Icon?
Hi Jon,
if you mean OUTSIDE of LC, then you might be able to do this in LC via AppleScript on a Mac
and VBScript on WIndows, but not with the build-in means of LC.
Best
Klaus
if you mean OUTSIDE of LC, then you might be able to do this in LC via AppleScript on a Mac
and VBScript on WIndows, but not with the build-in means of LC.
Best
Klaus
Re: Set File Icon?
I think it can be done inside Lc though, depending on the situation. If your trying for a system wide reset, then I believe Klaus is correct.
Inside Lc, you have to come up with a character to represent the icon you want to use, then set it in the field so it will look like this (field on left and menu button above) -
Inside Lc, you have to come up with a character to represent the icon you want to use, then set it in the field so it will look like this (field on left and menu button above) -
-
- VIP Livecode Opensource Backer
- Posts: 7230
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Set File Icon?
Most operating systems use the file extension to determine the icon and the default app that will open the file. Name your file with a ".doc" extension and it should work. Of course, if the file isn't actually a Word file, MS Word won't be able to read it.
Or did you mean you want to show the icon inside a LC stack?
Or did you mean you want to show the icon inside a LC stack?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Set File Icon?
Hi Jacque,
I am building an app that determines which version of an app a file was built with and then open said file with the appropriate app version (see viewtopic.php?f=7&t=30056).
I have all that working but because I have set several file types to open with my app, the icons of the files being opened with my app are changing to a generic file icon (which I am guessing is expected behavior) so I was trying to figure out a way to set the icon of said file back to the appropriate one.
Cheers,
Jon
I am building an app that determines which version of an app a file was built with and then open said file with the appropriate app version (see viewtopic.php?f=7&t=30056).
I have all that working but because I have set several file types to open with my app, the icons of the files being opened with my app are changing to a generic file icon (which I am guessing is expected behavior) so I was trying to figure out a way to set the icon of said file back to the appropriate one.
Cheers,
Jon
-
- VIP Livecode Opensource Backer
- Posts: 7230
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Set File Icon?
So you're writing the file back to disk? There may be a shell call that will do it, since the user can assign a default app in the Get Info box in Finder, but I don't know what it might be. You may be able to find something with a Google search.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Set File Icon?
Other than changing the icon of the file, my app makes no changes to the file whatsoever.
-
- VIP Livecode Opensource Backer
- Posts: 7230
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Set File Icon?
If you aren't saving the file then the icon shouldn't change. How are you opening it? Did you try opening for read-only?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Set File Icon?
Hi Jacque,
My apologies for the very slow response. After changing the 'Open With' setting (in the Get Info dialog box) for the file types I have designed my app to work with, I just double-click one of files (of course, my app also has the necessary CFBundleTypeExtension info within it). My app opens for a split second and then the appropriate app version opens the file.
Example: I double-click an Adobe InDesign file. My app opens, determines the correct version of InDesign the file was built with, and then opens the corresponding version of InDesign (and my app quits).
Thank you,
Jon
My apologies for the very slow response. After changing the 'Open With' setting (in the Get Info dialog box) for the file types I have designed my app to work with, I just double-click one of files (of course, my app also has the necessary CFBundleTypeExtension info within it). My app opens for a split second and then the appropriate app version opens the file.
Example: I double-click an Adobe InDesign file. My app opens, determines the correct version of InDesign the file was built with, and then opens the corresponding version of InDesign (and my app quits).
Thank you,
Jon
-
- VIP Livecode Opensource Backer
- Posts: 7230
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Set File Icon?
I'm guessing this is a Finder thing. If you change the "open with" app, the next time the Finder opens the file, Finder tries to reset the icon. It doesn't see an appropriate one because the file extension doesn't match the LC extension so it uses a generic one.
I don't see a way around that unless you can find a shell command to reset the icon. It's a system thing, not a LC thing. I'm speculating though.
I don't see a way around that unless you can find a shell command to reset the icon. It's a system thing, not a LC thing. I'm speculating though.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com