Page 1 of 1

Set File Icon?

Posted: Wed Jan 10, 2018 4:28 pm
by cmhjon
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 :)

Re: Set File Icon?

Posted: Wed Jan 10, 2018 4:36 pm
by Klaus
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

Re: Set File Icon?

Posted: Wed Jan 10, 2018 10:10 pm
by bogs
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) -
Image

Re: Set File Icon?

Posted: Thu Jan 11, 2018 5:32 pm
by jacque
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?

Re: Set File Icon?

Posted: Thu Jan 11, 2018 7:24 pm
by cmhjon
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

Re: Set File Icon?

Posted: Fri Jan 12, 2018 6:58 pm
by jacque
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.

Re: Set File Icon?

Posted: Fri Jan 12, 2018 7:42 pm
by cmhjon
Other than changing the icon of the file, my app makes no changes to the file whatsoever.

Re: Set File Icon?

Posted: Sat Jan 13, 2018 2:30 am
by jacque
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?