Android mobile snapshot help

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
davidmills
Posts: 16
Joined: Tue Jan 13, 2015 1:21 am

Android mobile snapshot help

Post by davidmills » Tue Jan 13, 2015 1:59 am

Hi all,
Just started on LC Community 7.0.1 windows and trying if possible to take a snapshot of the open card on my mobile and then save that to an image file.
From the reading I have done it seems saving to a file is not possible and so is it possible to have that freeze display in another card named "snapshot" used specifically for this action, even if only temporary whilst one continues to run the app.
My script is

Code: Select all

on mouseUp
   import snapshot
   end mouseUp
I guess adding export after the import line is the way but nothing I have tried works.
Thanks, Dave

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Android mobile snapshot help

Post by Simon » Tue Jan 13, 2015 2:55 am

Hi Dave, welcome to the forum.
This line works on Android

Code: Select all

on mouseUp
   import snapshot from rectangle "28,102,148,222" of this cd
end mouseUp
The file can be saved or use

Code: Select all

on mouseUp
   set the defaultFolder to specialFolderPath("documents")
   export snapshot from rectangle "28,102,148,222" of this cd to file "Snap.png"
   if there is a file "Snap.png" then
      answer "Got a file here"
   end if
end mouseUp
You'll have to do more for saving to a different card.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

davidmills
Posts: 16
Joined: Tue Jan 13, 2015 1:21 am

Re: Android mobile snapshot help

Post by davidmills » Tue Jan 13, 2015 10:39 am

Thanks.
With this I get an error on line 11 and so not correct. What should it be, or perhaps it's not a put?
Dave

Code: Select all

on mouseUp
import snapshot from rectangle "1,290,314,360" of this cd
end mouseUp

on mouseUp
set the defaultFolder to specialFolderPath("documents")
export snapshot from rectangle "1,290,314,360" of this cd to file "Snap.png"
if there is a file "Snap.png" then
answer "Got a file here"
   put file "Snap.png" in to card "ShouldBeHere"
   go to card "ShouldBeHere"
end if
end mouseUp

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Android mobile snapshot help

Post by Simon » Wed Jan 14, 2015 4:47 am

Hi Dave,
Nope it's not a put.
Try searching the forums on export snapshot.

I think you can benefit from going through these stacks;
http://www.hyperactivesw.com/revscriptc ... ences.html

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

davidmills
Posts: 16
Joined: Tue Jan 13, 2015 1:21 am

Re: Android mobile snapshot help

Post by davidmills » Wed Jan 14, 2015 11:18 am

Thank you Simon. But I have spent a great deal of time looking for examples on import/export snapshot just as I did to get this far starting from scratch as a raw beginner. It could be I'm thick or particularly slow on the learning curve and what I'm really looking for is an answer example to carry on from the line "Got a file here" rather than researching for many hours which in my case invariably ends up with no answer.

Your first reply was great in that I had not thought about selecting the area I really wanted rather than the whole display.
So presently using your code I'm looking at the taken snapshot area in the middle of the screen and need to copy that into a file, but not sure if that has an impact on devices other than my own mobile, or alternatively have that area placed temporally onto a card.
Using another button I need that area I'm looking at to be removed and the app to start again. So far this button still leaves that snapshot area still in place when the app starts again.

So if you or anyone else could give me your ideas for the two lots of code it would be appreciated.

An observation:
It must be difficult for the very experienced members on here to define what a beginner to LC is. In this beginners forum there is me at the thick to slow end not having a clue how to code anything and this person below who probably could answer all my questions:
http://forums.livecode.com/viewtopic.php?f=7&t=22492

Dave

morrell
Posts: 84
Joined: Sat Dec 13, 2014 1:12 am
Location: United Kingdom

Re: Android mobile snapshot help

Post by morrell » Wed Jan 14, 2015 12:11 pm

Hello Dave,

Your not on your own as I'm also at the start of your beginners scale for this Forum.

I'm also working on a similar problem to yours, but can't give you my solution as I don't have it yet and so very interested in the replies you get.

Kind regards,

Ruth

SparkOut
Posts: 2157
Joined: Sun Sep 23, 2007 4:58 pm

Re: Android mobile snapshot help

Post by SparkOut » Wed Jan 14, 2015 6:45 pm

Here's a little stack which should give you both some insights. Try switching between the cards and see what the stored image contains before and after you try saving or storing on the card. Read the scripts and get an idea of what possibilities there are.
If you need anything more specific, ask and we can try and help more.



[EDIT] The previous stack seemed to be corrupt. I've uploaded another one now which should hopefully work OK.
Attachments
ScreenCaptureTest.zip
(1.53 KiB) Downloaded 45 times

morrell
Posts: 84
Joined: Sat Dec 13, 2014 1:12 am
Location: United Kingdom

Re: Android mobile snapshot help

Post by morrell » Thu Jan 15, 2015 12:05 am

Thank you very much SparkOut. Your excellent example script demonstrated I was completely up the wrong road in all my tests.

Kind regards,

Ruth

newtronsols
Posts: 192
Joined: Tue Mar 11, 2014 12:57 pm

Re: Android mobile snapshot help

Post by newtronsols » Thu Jan 15, 2015 12:25 am

I haven't tested but...
mobileExportImageToAlbum is now supposed to work on Android in version 6.7.2 RC1 and you can check obviously with your phone - or with Livecode mobilePickPhoto "library" - I have tested this and this part does work on most LC versions I've used - but there may be exceptions with non-commercial/commercial flavors of LC.

I have never understood how LC's not one rolling snowball that just gets better - it 'seems to be' [I don't know] a few snowballs - some lose bits and pick up slush that doesn't work. Then 2 join up - with slush and good bits replacing each other.

I had hoped 7 was the miracle cure where RR saw the light. But things get fixed in 6.7 etc that may not be fixed in 7... If I worked there I would have left after a Livecode breakdown. :lol: [insane LOL]

My example of this working is: https://play.google.com/store/apps/deta ... m&hl=en_GB - took me a weekend using bits from the forum and a bit of tweaking.

P.S. I did this after getting a speeding fine by post. But I may have the last laugh --hopefully!!

davidmills
Posts: 16
Joined: Tue Jan 13, 2015 1:21 am

Re: Android mobile snapshot help

Post by davidmills » Thu Jan 15, 2015 9:06 am

Really grateful SparkOut.
Dave

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”