Trouble importing image

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

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
david_fff
Posts: 29
Joined: Wed Nov 12, 2014 5:29 pm

Trouble importing image

Post by david_fff » Sun Apr 26, 2015 5:35 am

I created an import button on card 1 of a window with the script:
on mouseup
answer file "Select jpeg file"
put there is a file it into Isfilethere
put Isfilethere
import paint from file it
end mouseup
Isfilethere comes back as true, but no image file is imported. I have tried this on images with .png and .jpg extensions and no go.
Any help would be appreciated! Thanks!

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

Re: Trouble importing image

Post by jmburnod » Sun Apr 26, 2015 9:27 am

Hi David,

I tried your script with LC 6.7.0 and it works for me
Which version of liveCode you use ?
Best regards
Jean-Marc

david_fff
Posts: 29
Joined: Wed Nov 12, 2014 5:29 pm

Re: Trouble importing image

Post by david_fff » Sun Apr 26, 2015 5:58 pm

Livecode 7.00 with OS X Yosemite 10.3.3.

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

Re: Trouble importing image

Post by FourthWorld » Sun Apr 26, 2015 6:03 pm

It's almost always helpful to check "the result" after any command that may have errors. Those involving disk I/O can often benefit from checking sysError() as well, as that will return any OS error code if something went wrong.

So in your case, right after your import command add this:

Code: Select all

if the result is not empty then
  answer "An error occured: "& the result &"("& sysError() &")"
end if
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/

david_fff
Posts: 29
Joined: Wed Nov 12, 2014 5:29 pm

Re: Trouble importing image

Post by david_fff » Mon Apr 27, 2015 12:18 am

Well, the result was empty. Nothing came up with your script, Richard. But I did learn that
it's the operating system: the import worked just fine on a MacBook Pro running 10.8.5. It
just does not work on 10.10.3 ("Yosemite"). Hopefully the next Livecode update will fix it.
Thanks,
Dave

david_fff
Posts: 29
Joined: Wed Nov 12, 2014 5:29 pm

Re: Trouble importing image

Post by david_fff » Mon Apr 27, 2015 12:32 am

Ok, Murphy was just having his way with me. Believe it or not, I went back to the stack on Yosemite
(and this is the same file, mind, because it's syncing via Dropbox) and now it's importing. I did not
touch the script, it is the exact script that did not work before and now, since I guess it got "permission"
when it worked on OSX 10.8.5, decided to join the land of the living scripts. Go figure...

Post Reply

Return to “Talking LiveCode”