Page 1 of 1

Save Image Clipboard to file

Posted: Wed Feb 15, 2017 3:15 am
by capellan
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

Re: Save Image Clipboard to file

Posted: Wed Feb 15, 2017 9:12 pm
by richmond62
cap1.png
No joy over here I'm afraid: LiveCode 8.1.3 rc2, Mac OS 10.7.5

Re: Save Image Clipboard to file

Posted: Thu Feb 16, 2017 6:34 pm
by capellan
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.

Re: Save Image Clipboard to file

Posted: Thu Feb 16, 2017 8:07 pm
by richmond62
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!

Re: Save Image Clipboard to file

Posted: Thu Feb 16, 2017 10:23 pm
by capellan
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

Re: Save Image Clipboard to file

Posted: Fri Feb 17, 2017 6:41 pm
by jacque
The syntax in line 13 should be

Code: Select all

put empty into the clipboardData["image"] 

Re: Save Image Clipboard to file

Posted: Sat Feb 18, 2017 10:37 pm
by capellan
Richmond,

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

Re: Save Image Clipboard to file

Posted: Sat Feb 18, 2017 11:53 pm
by jmburnod
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

Re: Save Image Clipboard to file

Posted: Sun Feb 19, 2017 12:54 am
by bn
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

Re: Save Image Clipboard to file

Posted: Sun Feb 19, 2017 1:00 am
by jacque
Bernd to the rescue. I was on auto-pilot when I wrote that.

Re: Save Image Clipboard to file

Posted: Sun Feb 19, 2017 11:16 am
by bn
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

Re: Save Image Clipboard to file

Posted: Sun Feb 19, 2017 11:23 am
by jmburnod
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

Re: Save Image Clipboard to file

Posted: Mon Feb 20, 2017 6:59 pm
by capellan
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: