Demo of putting thumbnail icon on txt file (MAC users)

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
micmac
Posts: 29
Joined: Mon May 30, 2011 9:00 am

Demo of putting thumbnail icon on txt file (MAC users)

Post by micmac » Tue Jan 28, 2020 1:49 pm

Hi there

This is a quick demonstration of concept of putting a thumbnail icon on txt file used to store graphic information.

Michael
Attachments
Set icon of txt file.zip
(1.78 KiB) Downloaded 26 times
Skærmbillede 2020-01-28 kl. 13.39.14.png
Skærmbillede 2020-01-28 kl. 13.38.50.png

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3345
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Demo of putting thumbnail icon on txt file (MAC users)

Post by bn » Tue Jan 28, 2020 11:59 pm

Hi Michael,

that is a nifty workaround.

I had to add a second delay

Code: Select all

tell application "Finder"
	activate
	open information window of file POSIX file "filePath"
	tell application "System Events" to key code 48
	delay 1
	tell application "System Events" to keystroke "v" using command down
        delay 1
	close information window of file POSIX file "filePath"
end tell
Then it worked for me.

Kind regards
Bernd

micmac
Posts: 29
Joined: Mon May 30, 2011 9:00 am

Re: Demo of putting thumbnail icon on txt file (MAC users)

Post by micmac » Sat Feb 01, 2020 2:44 pm

plus even a little more :-)

...to go back to livecode again

Code: Select all

tell application "Finder"
	activate
	open information window of file POSIX file "filePath"
	tell application "System Events" to key code 48
	delay 1
	tell application "System Events" to keystroke "v" using command down
        delay 1
	close information window of file POSIX file "filePath"
end tell

tell application "Livecode"
	activate
end tell
BTW: key code 48 = Tab

Michael

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”