Problem with importing snapshot

Jim Lambert jiml at netrin.com
Sun Aug 25 18:08:37 EDT 2013


Charles wrote:

> on mouseUp
> 
> export snapshot from group id 126899 of card "graph" to myImage as PNG
> 
> go stack "report"
> 
> import snapshot from group id 126899 of card "graph" of stack "report"
> 
> end mouseUp
> 
> This works but it "strips" all of the text that is on the border of the PNG but is still included in the group.  The group is a ChartMaker graph.  In any case, I did not expect this to occur.  Any thoughts or suggestions? 

Hi Charles,

> export snapshot from group id 126899 of card "graph" to myImage as PNG

Puts the snapshot into a variable but you don't seem to be using that variable anywhere.
You could then issue this command  
    put myImage into image "dummy"
assuming you have an image of that name.

The 
> go stack "report"
command confuses me. If card 'graph' is in stack 'report'  and this button is not in stack 'report' then export snapshot should have thrown an error.
If you're already in stack 'report' then the GO STACK is useless.

Let me assume this button is not in stack 'report' .
Try:
on mouseup
	import snapshot from group id 126899 of card "graph" of stack "report"
end mouseup

This should do what you need. It will put a picture of gro id 126899 into a new image on the current card (in whatever stack the button resides.)

You also might want to try this test.
Quit LiveCode
Open LiveCode
Create a new stack
create a button
Apply this script
on mouseUp
   import snapshot from group 1 of cd 1 of stack "/Users/jimlambert/Documents/My LiveCode/Plugins/ChartMaker Playground 1 - SlideShow.rev"
end mouseUp

Make sure to change the path to match the location on your machine of your chartmaker playground stacks.

When you click the button a picture of a chart should appear on your card as a new image with no text stripped.

If you find that snapshots of a group don't include text then perhaps that text is not really part of the group.
Maybe  group id 126899 of card "graph" is part of another group.
If so, use that group's id.

Jim Lambert


More information about the use-livecode mailing list