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: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
zapx
Posts: 1
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: 6432
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
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1935
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: 2293
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 ?

bogs
Posts: 2989
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: 1935
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: 2293
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

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”