Page 1 of 1

Screenshot of all the objects in the app

Posted: Wed Feb 23, 2022 7:43 pm
by liveCode
How can I take a screenshot?
I want all objects to be included in this image

Re: Screenshot of all the objects in the app

Posted: Wed Feb 23, 2022 7:57 pm
by Klaus
Hi livecode,

check "import/export snapshot" in the dictionary.


Best

Klaus

Re: Screenshot of all the objects in the app

Posted: Wed Feb 23, 2022 8:42 pm
by liveCode
I tried but it only captures the background and not all the objects

Re: Screenshot of all the objects in the app

Posted: Wed Feb 23, 2022 8:59 pm
by Klaus
What exactly did you try?
Please post your script.

Re: Screenshot of all the objects in the app

Posted: Wed Feb 23, 2022 9:05 pm
by richmond62
Which operating system are you using?

With MacOS and Xubuntu (the 2 systems I use) they have system apps for this sort of thing.

Re: Screenshot of all the objects in the app

Posted: Wed Feb 23, 2022 10:52 pm
by dunbarx
Richmond.
With MacOS and Xubuntu (the 2 systems I use) they have system apps for this sort of thing.
I would think that the OP wants LC to do all the picture taking, and not (on Mac) cmd-shift-4.

Craig

Re: Screenshot of all the objects in the app

Posted: Wed Feb 23, 2022 11:31 pm
by dunbarx
Really, what Klaus said about the "export snapshot' command.

Code: Select all

export snapshot from rect the rect of stack "yourStack"  to file "/Users/whoeverYouAre/Desktop/yourFileHere" as JPEG
This will take a picture of the full card window as it is presented on screen.

Craig

Re: Screenshot of all the objects in the app

Posted: Thu Feb 24, 2022 8:38 am
by richmond62
viewtopic.php?t=34691

There is also my stack I made in 2001 . . .

I have just tried out that stack and, in my case on MacOS 12, it dumped the screenShot inside
the LiveCode app folder . . .

Stack deleted as per problem mentioned above: better one posted below. 8)

Re: Screenshot of all the objects in the app

Posted: Thu Feb 24, 2022 9:19 am
by richmond62
SShot 2022-02-24 at 10.17.41.png
SShot 2022-02-24 at 10.17.41.png (6.1 KiB) Viewed 5883 times
-
Stack deleted: better one posted below.

Re: Screenshot of all the objects in the app

Posted: Thu Feb 24, 2022 9:24 am
by richmond62
Of course, if you wanted a screensnap that wanted ONLY bits of LiveCode
[i.e. NOT the pornographic desktop picture . . . ] you could have the screen snapper
turn on the backdrop.
-
SShot 2022-02-24 at 11.15.45.png
SShot 2022-02-24 at 11.15.45.png (8.33 KiB) Viewed 5866 times

Re: Screenshot of all the objects in the app

Posted: Thu Feb 24, 2022 8:35 pm
by jacque
richmond62 wrote:
Thu Feb 24, 2022 9:24 am
Of course, if you wanted a screensnap that wanted ONLY bits of LiveCode
[i.e. NOT the pornographic desktop picture . . . ] you could have the screen snapper
turn on the backdrop.
That's the hard way. The easy way is:

Code: Select all

export snapshot from this cd to file "testshot.png" as PNG
Note that if you don't specify a complete file path, the image will be saved to the default folder which, on a Mac, is inside the application bundle and on Windows is inside the app folder. So it's better to ask for a path ("ask file") or provide a full path in the script.

Code: Select all

put specialFolderPath("documents") & "/testshot.png" into tPath
export snapshot from this cd to file tPath as PNG

Re: Screenshot of all the objects in the app

Posted: Sat Feb 26, 2022 6:24 pm
by liveCode
I created a button and gave it the following code:

Code: Select all

on mouseUp
    // answer folder "Where to export?"
    // lock screen
    go card "gameCard"
    export snapshot from rect the rect of stack "myFirstTamago" to file specialFolderPath ("documents") & "/ Tamago.png" as JPEG
    // unlock screen
    go card "setting"
    answer "The export worked successfully" & cr & "The image is in the documents"
end mouseUp
But it did not work for me
He did not put the image inside the document folder on the phone
How can I solve this problem?

Re: Screenshot of all the objects in the app

Posted: Sat Feb 26, 2022 7:54 pm
by SparkOut
Before checking any code and operation, first thing I see is the word "phone".
Are you expecting the screenshot to be saved in the publicly accessible external documents folder?
The folder specialFolderPath("documents") is sandboxed for each app, and only your LiveCode app will be able to find and access files in it.
You would need to investigate "external documents" (and enable writing to that location in the app's standalone settings if so.
Otherwise, well I have done no checking yet.

Re: Screenshot of all the objects in the app

Posted: Sat Feb 26, 2022 8:00 pm
by liveCode
So how do I save a screenshot inside the documents in my phone?

Re: Screenshot of all the objects in the app

Posted: Sat Feb 26, 2022 8:39 pm
by jacque
liveCode wrote:
Sat Feb 26, 2022 8:00 pm
So how do I save a screenshot inside the documents in my phone?
Unfortunately that isn't available yet. I'm not sure what "external documents" is supposed to be, because it only saves files to the app's private sandbox. I submitted a bug/feature request because my app also needs to access a public folder.
https://quality.livecode.com/show_bug.cgi?id=23526

However, I recently read that mobileComposeMail will show the standard Share dialog and it does work. Users can then choose the location to place the file. The command isn't only for email, it seems to work for anything.