Page 1 of 1

Clipboard use for image

Posted: Fri Mar 15, 2019 5:01 pm
by zapx
Hello here,
I'm trying to paste a image copied from a browser page to a object image, but I fail...

I tried with the property:
set the clipboardData["image"] to image 1, I read that in the Dictionary API

I tried also with full and raw Clipboarddata property, but I continue to fail

I tested tihs in Windows 10 and Linux system (manjaro)...

Live code version is 9 rc

Re: Clipboard use for image

Posted: Fri Mar 15, 2019 6:43 pm
by FourthWorld
Have you tried the paste command?

Re: Clipboard use for image

Posted: Fri Mar 15, 2019 7:04 pm
by [-hh]

Code: Select all

set the text of image 1 to the clipboardData["image"]

Re: Clipboard use for image

Posted: Fri Mar 15, 2019 8:00 pm
by jmburnod
Hi All,
I tried to copy an image diplayed by browser and checked clipboardData["image"] which is empty.
Is it possible to copy an image displayed by browser ?

Re: Clipboard use for image

Posted: Fri Mar 15, 2019 8:15 pm
by bogs
Here is what zapx is probably seeing (linux, lc8.x)
Selection_001.png
Clippy!
zapx wrote:
Fri Mar 15, 2019 5:01 pm
I tried with the property:
set the clipboardData["image"] to image 1, I read that in the Dictionary API
This fails as shown on 'nix just trying to work with two image objects on the same card.

Re: Clipboard use for image

Posted: Fri Mar 15, 2019 8:30 pm
by [-hh]
This works here, as long as the image is one of PNG, GIF or JPEG (or a dataURL of that).
Copy the image in your browser. Then use

Code: Select all

on mouseUp
  if there is no img "import" then create img "import"
  lock the clipboard
  set the text of img "import" to the fullClipboardData["image"]
  unlock the clipboard
end mouseUp
(With some browsers on some OS the clipboardData["image"] also works.)

Re: Clipboard use for image

Posted: Sat Mar 16, 2019 10:02 am
by jmburnod
I believed that first post was about browser widget not project browser

Code: Select all

set the clipboardData["image"] to image 1
@Bogs
First time I use it and it works (LC 9.0.1, OS X 10.13)

Copy and paste an image control works

After copy an image control

Code: Select all

set the text of img "myImg" to clipboardData["image"] 
doesnt work. clipboardData["image"] = empty

As Hermann said:

Code: Select all

set the text of img "myImg" to fullclipboardData["image"] 
works fine :D
Best
Jean-Marc

Re: Clipboard use for image

Posted: Tue May 30, 2023 7:06 pm
by dbeugeling
Hello,

Copy from clipboard does not work on Windows 10 or Windows 11.
I'm using LC 9.6.9 on a Mac, and it's working OK on a Mac!!
I tried different codes already.

Please Help!

Dirk

Re: Clipboard use for image

Posted: Tue May 30, 2023 7:37 pm
by richmond62
SShot 2023-05-30 at 21.34.55.png
-

Code: Select all

on mouseUp
   paste
   set the name of the last image to "XXX"
   set the loc of img "XXX" to 200,200
end mouseUp
I am not sure what all the fuss is about.

Works 100% on a Macintosh.

Re: Clipboard use for image

Posted: Wed May 31, 2023 8:42 pm
by dbeugeling
Hi richmond62 again,

I Tried your code, but it does not work on Windows 10/11!!
Sorry,

Now, I fount this code to be working

Code: Select all

put the fullclipboardData["image"] into tClipboardDataImage
         if tClipboardDataImage is no empty then
            put tClipboardDataImage into image "imgMyImage"
Dirk

Re: Clipboard use for image

Posted: Wed May 31, 2023 8:47 pm
by richmond62
I am sorry, Dirk: I only work with Macintosh and Linux.

I am glad you found a way to do whay you want on Windows.

Al het beste. Richmond.