Clipboard use for image

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
zapx
Posts: 4
Joined: Sat Feb 23, 2019 8:21 am

Clipboard use for image

Post by zapx » Fri Mar 15, 2019 5:01 pm

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

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9842
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Clipboard use for image

Post by FourthWorld » Fri Mar 15, 2019 6:43 pm

Have you tried the paste command?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Clipboard use for image

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

Code: Select all

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

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

Re: Clipboard use for image

Post by jmburnod » Fri Mar 15, 2019 8:00 pm

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 ?
https://alternatic.ch

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Clipboard use for image

Post by bogs » Fri Mar 15, 2019 8:15 pm

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.
Image

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Clipboard use for image

Post by [-hh] » Fri Mar 15, 2019 8:30 pm

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.)
shiftLock happens

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

Re: Clipboard use for image

Post by jmburnod » Sat Mar 16, 2019 10:02 am

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
https://alternatic.ch

dbeugeling
Posts: 12
Joined: Thu Feb 12, 2015 12:22 pm

Re: Clipboard use for image

Post by dbeugeling » Tue May 30, 2023 7:06 pm

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

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

Re: Clipboard use for image

Post by richmond62 » Tue May 30, 2023 7:37 pm

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.
Attachments
Paster.livecode.zip
Stack.
(825 Bytes) Downloaded 67 times

dbeugeling
Posts: 12
Joined: Thu Feb 12, 2015 12:22 pm

Re: Clipboard use for image

Post by dbeugeling » Wed May 31, 2023 8:42 pm

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

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

Re: Clipboard use for image

Post by richmond62 » Wed May 31, 2023 8:47 pm

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.

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”