"export snapshot" syntax

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
xApple
Posts: 113
Joined: Wed Nov 29, 2006 10:21 pm
Location: Geneva

"export snapshot" syntax

Post by xApple » Sun Dec 24, 2006 3:29 pm

Hello everyone !
I was a little confused on how to use the "export snapshot" command...
In the documentation you can read this:
export snapshot [from rect[angle] rectangle] [of object] to {file filePath |container} [as format] [with mask maskFile]
The "from rect" form works quite well, but I was intrested in implementing the "of object" form... only my script never seams to compile.
I just want to take a screenshot of my main stack window, whatever size it is and where ever it is on the screen...

Code: Select all

export snapshot of window (the mainstack of this stack) to file pictPath as PNG
export snapshot of stack (the mainstack of this stack) to file pictPath as PNG
doesn't compile : (

marielle
Livecode Opensource Backer
Livecode Opensource Backer

Re: "export snapshot" syntax

Post by marielle » Tue Dec 26, 2006 12:18 pm

xApple wrote:

Code: Select all

export snapshot of window (the mainstack of this stack) to file pictPath as PNG
There is a gotcha. What follows window in this context is a window ID. Then the coordinates will be relative to that window.

Code: Select all

export snapshot from rect (the rect of this card) of window (the windowid of this stack) to file "myimage.png" as png
With stack, the syntax is as folllows. The coordinates are then relative to the screen rectangle. Any window that overlaps with the snapshot will be included in the snapshot.

Code: Select all

export snapshot from rect (the rect of this stack)  to file "myimage.png" as png

xApple
Posts: 113
Joined: Wed Nov 29, 2006 10:21 pm
Location: Geneva

Post by xApple » Sat Jan 13, 2007 10:53 pm

Hey thanks a bunch

alessandropisoni
Posts: 12
Joined: Fri Jul 07, 2006 2:14 pm
Location: Italia
Contact:

Problem with export snapshot

Post by alessandropisoni » Fri Apr 27, 2007 9:37 am

i use this syntax : export snapshot from rect (the rect of this card) of window (the windowid of this stack) to file "Grafico.jpg" as jpeg

but if the windows card is 500x600 pixel export only the background nobody object why?

if the windows card is 200x150 pixel export is ok ? why this!!

marielle
Livecode Opensource Backer
Livecode Opensource Backer

Re: Problem with export snapshot

Post by marielle » Fri Apr 27, 2007 11:45 am

I have a vague memory of issues with very big images but I couldn't track it down in the quality center

xApple
Posts: 113
Joined: Wed Nov 29, 2006 10:21 pm
Location: Geneva

Post by xApple » Fri Apr 27, 2007 6:02 pm

With the latest 2.8 I've had problems exporting snapshots when the rectangle was of a certain size and located on my second screen. It would cause an execution error : (

marielle
Livecode Opensource Backer
Livecode Opensource Backer

Re: Problem with export snapshot

Post by marielle » Sat Apr 28, 2007 9:44 pm

alessandropisoni wrote:(private email) my problem is first image only background!!!! second image is correct!

this is my code:
..........

Code: Select all

  go card"Grafico" of stack"Grafico"
  export snapshot from rect (the rect of this card) of window (the windowid of this stack) to file "Grafico.jpg" as jpeg
Hi Alessandro,

Allow me to reply here, as this may be of interest to others. The problem is possibly that the snapshot is being taken before the card content is fully loaded.

You may want to add wait 10 tick (or whatever works) before export snapshot. Something else to try is to use a dummy instruction that requires access to all controls on the cards, like put the number of controls of this card into myVar.

alessandropisoni
Posts: 12
Joined: Fri Jul 07, 2006 2:14 pm
Location: Italia
Contact:

Problem resolved in part

Post by alessandropisoni » Wed May 02, 2007 3:01 pm

Problem resolved in part. Inserting a answer box before export
snapshot the image it comes saved correctly!

The strange thing is that in debug the instruction it works also
without answer box. The problem only appears when the application is
compiled!!!

marielle
Livecode Opensource Backer
Livecode Opensource Backer

Re: Problem resolved in part

Post by marielle » Wed May 02, 2007 3:12 pm

alessandropisoni wrote:Problem resolved in part. Inserting a answer box before export snapshot the image it comes saved correctly!
Thanks for these additional information. Answer box... then this reminds me of a similar problem I got a while ago. With an answer box, I could get the screen refreshed in time for the snapshot. Without the answer box, the snapshot was taken before the screen got refreshed.

Using anything else, like wait for 10 ticks or whatever other on screen event didn't work. Only the answer box made the trick.

Because an answer box was not appropriate in the application, I completely reorganized my code to have the behavior I wanted. I couldn't understand however the source of the problem (not enough to enter a bug). Do you have a short demo stack associated with this you could make available?

alessandropisoni
Posts: 12
Joined: Fri Jul 07, 2006 2:14 pm
Location: Italia
Contact:

Like making present this anomaly

Post by alessandropisoni » Thu May 03, 2007 8:04 am

Also to a my friend who develops in Revolution it succeeds the same
thing and it must force the program with a answer box! How never
nobody has informed the producers of the software of this anomaly? It
would be comfortable to have a commando tipo"Refresh card"!!!

alessandropisoni
Posts: 12
Joined: Fri Jul 07, 2006 2:14 pm
Location: Italia
Contact:

new problem with exportsnapshot

Post by alessandropisoni » Wed May 09, 2007 6:06 pm

I have found an other problem with exportsnapshot under windows.
Putting answer box before the command export the image that saves it
has over the answer box. In practical it does not wait for that I
confirmations the box but execute of continuation the instruction
export. This only with windows with Mac the image comes exported
after that I have to confermed the key in the answer box.

It would have be see again exportsnapshot

bye

Klaus
Posts: 13878
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Post by Klaus » Wed May 09, 2007 9:03 pm

Qucik and maybe naive question:
Does a "lock screen" and "unlock screen" not what you want (Refresh card)?


Regards

Klaus

alex298
Posts: 101
Joined: Mon May 01, 2006 1:17 pm

Post by alex298 » Tue Apr 08, 2008 5:16 am

Hi,

The following works great if I wish to print out the whole card.

Code: Select all

export snapshot from rect (the rect of this card) of window (the windowid of this stack) to file "Grafico.jpg" as jpeg
What is the syntax if I wish to print part of the card? For example:
1. from left co-ordinate (x1, y1) of this card to the rest of this card
2. from left co-ordinate (x1, y1) of this card to the right co-ordinate (x2, y2) of this card

Thanks and best regards
Alex
Nice to meet all of you.

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”