Save Image Clipboard to file

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

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
capellan
Posts: 381
Joined: Wed Aug 15, 2007 11:09 pm
Contact:

Save Image Clipboard to file

Post by capellan » Wed Feb 15, 2017 3:15 am

Hi All,

This utility stack saves as a png file
an image in the clipboard. There is
an option to automate this task.

Tell me if this works fine in your
own setup.

Al
SaveImageClipboardToFile.zip
LC 7 Compressed file
(1.9 KiB) Downloaded 31 times

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

Re: Save Image Clipboard to file

Post by richmond62 » Wed Feb 15, 2017 9:12 pm

cap1.png
No joy over here I'm afraid: LiveCode 8.1.3 rc2, Mac OS 10.7.5

capellan
Posts: 381
Joined: Wed Aug 15, 2007 11:09 pm
Contact:

Re: Save Image Clipboard to file

Post by capellan » Thu Feb 16, 2017 6:34 pm

Hi Richmond,

That error is a surprise for me.
Does MacOSX stops LiveCode from
empty the image clipboard?

Could you test it in Ubuntu and Windows?
It works fine in these platforms, as far
as I know.

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

Re: Save Image Clipboard to file

Post by richmond62 » Thu Feb 16, 2017 8:07 pm

Removing line 13 of the script the stack works:
Screen Shot 2017-02-16 at 9.06.18 pm.png
HOWEVER: the original file came to 553 KB, the one your stack produced came to 5.3 MB!

capellan
Posts: 381
Joined: Wed Aug 15, 2007 11:09 pm
Contact:

Re: Save Image Clipboard to file

Post by capellan » Thu Feb 16, 2017 10:23 pm

Looks like the original image file is compressed
and the image in the clipboard is not compressed.

Which image file format uses MacOSX for
images copied in the clipboard? TIFF?

https://discussions.apple.com/thread/4883983?tstart=0
https://discussions.apple.com/thread/1849000?tstart=0

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3938
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Save Image Clipboard to file

Post by jacque » Fri Feb 17, 2017 6:41 pm

The syntax in line 13 should be

Code: Select all

put empty into the clipboardData["image"] 
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

capellan
Posts: 381
Joined: Wed Aug 15, 2007 11:09 pm
Contact:

Re: Save Image Clipboard to file

Post by capellan » Sat Feb 18, 2017 10:37 pm

Richmond,

Did you noticed Jacque message?
Does clearing the image clipboard
works now on MacOSX?

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1992
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Save Image Clipboard to file

Post by jmburnod » Sat Feb 18, 2017 11:53 pm

Hi All,
On OS X 10.12.3 i get for

Code: Select all

put empty into the clipboardData["image"]
"Script compile error:
Error description: Chunk: can't create a variable with that name (explicitVariables?)"

and for

Code: Select all

set the clipboarddata["image"] to empty
"Message execution error:
Error description: set: can't set property
Hint:
Best
Jean-Marc

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

Re: Save Image Clipboard to file

Post by bn » Sun Feb 19, 2017 12:54 am

Hi Jean-Marc
On OS X 10.12.3 i get for
CODE: SELECT ALL
put empty into the clipboardData["image"]

"Script compile error:
Error description: Chunk: can't create a variable with that name (explicitVariables?)"
Could you try this, it works for me. Actually the "the" is for properties, here you want to put it into a container.

Code: Select all

put empty into clipboardData["image"]
Kind regards
Bernd

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3938
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Save Image Clipboard to file

Post by jacque » Sun Feb 19, 2017 1:00 am

Bernd to the rescue. I was on auto-pilot when I wrote that.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

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

Re: Save Image Clipboard to file

Post by bn » Sun Feb 19, 2017 11:16 am

jacque wrote:Bernd to the rescue. I was on auto-pilot when I wrote that.
According to the dictionary (LC 9DP4) Alejandro's script should have worked

Code: Select all

 set the clipboarddata["image"] to empty
and it does indeed work in LC 6.1.3

from the dictionary:

Code: Select all

set the clipboardData["text"] to "привет"
And your code works too in LC 6.1.3

Code: Select all

put empty into the clipboardData["image"]
But not in LC 9 anymore.

I noticed that with more recent versions there are subtle changes especially being more strict in some cases.

This might be one of those where something changed for the put version.

But I think the set version should work or it should be documented that it does not.

Kind regards
Bernd

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1992
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Save Image Clipboard to file

Post by jmburnod » Sun Feb 19, 2017 11:23 am

Hi Bernd,
I don't know where was my brain for don't try without "the" :D

Code: Select all

put empty into  clipboarddata["image"] 
works for me LC 8.1.3
Kind regards
Jean-Marc

capellan
Posts: 381
Joined: Wed Aug 15, 2007 11:09 pm
Contact:

Re: Save Image Clipboard to file

Post by capellan » Mon Feb 20, 2017 6:59 pm

Hi All,

Many thanks for keeping alive this thread! :D

Looks like there are many subtle changes in the
syntax of LiveCode... changes that nobody notices
until it breaks some code. :shock:

Post Reply

Return to “Talking LiveCode”