Capturing screen into image

Matt Maier blueback09 at gmail.com
Sat Jul 1 12:44:55 EDT 2017


This is the script I use to capture screenshots from particular areas

*on* snapCaptureButtMouseUp pLine

*-- clicked in node details to capture a screenshot from the previously
committed captureArea rect*

*-- set the loc of stack "captureArea" to -1000,-1000*

*-- close stack "captureArea"*

*-- should already be closed*

*-- export snapshot from rect sCaptureAreaGeometry["captureAreaRect"] to
image "figureHolder" stack "nodeDetails"*

*put* the effective filename of this stack into tPath

*set* the itemDelimiter to slash

*put* "temp/screenshot.gif" into item -1 of tPath

*export* snapshot from rect sCaptureAreaGeometry["captureAreaRect"] to file
tPath as GIF

*set* the filename of image "figureHolder" stack "nodeDetails" to tPath

*-- size the image*

*put* the rect of field "editData" stack "NodeDetails" into tQuery["maxRect"
]

*put* the long id of image "figureHolder" stack "NodeDetails" into tQuery[
"longID"]

*put* fitImageToConstraint(tQuery) into tGimme

*set* the width of image "figureHolder" stack "NodeDetails" to tGimme[
"width"]

*set* the height of image "figureHolder" stack "NodeDetails" to tGimme[
"height"]

*set* the loc of image "figureHolder" stack "NodeDetails" to tGimme["center"
]

*-- the clear button can be show now*

*set* the visible of button "clearImgButt" stack "NodeDetails" to true

*set* the visible of button "expandImgButt" stack "NodeDetails" to true

*put* the cNodeDetails of stack "NodeDetails" into tDeets

*put* empty into tDeets[pLine]["new"]

*put* true into tDeets["newFigure"]

*-- put "screenshot" into tDeets[pLine]["new"]["copyFrom"]*

*put* tPath into tDeets[pLine]["new"]["copyFrom"]

*put* uuid("random") into tUUID

*put* tUUID & ".gif" into tDeets[pLine]["new"]["newName"]

*set* the cNodeDetails of stack "NodeDetails" to tDeets

*end* snapCaptureButtMouseUp

On Sat, Jul 1, 2017 at 12:14 AM, Terence Heaford via use-livecode <
use-livecode at lists.runrev.com> wrote:

> Thanks for your help.
>
> I have changed the script to below and it does not work.
>
> set the lockLoc of image "myImage" to false
> export snapshot from rectangle (the rect of widget "Browser") to
> pictVariable as PNG
> put pictVariable into image "myImage"
> set the width of image "myImage" to the formattedWidth of image "myImage"
> set the height of image "myImage" to the formattedHeight of image "myImage"
> print card from topleft of image "myImage" to bottomRight of image
> “myImage"
>
> The image “myImage" on the screen seems to be the same as widget “Browser”
> but the print card line of the script shows the grey bar at the top.
>
>
> Any other ideas please.
>
> Thanks
>
> Terry
>
>
>
>
> > On 30 Jun 2017, at 22:48, Mark Schonewille via use-livecode <
> use-livecode at lists.runrev.com> wrote:
> >
> > Set the lockLoc of the image to false. Set the text of the image to the
> PNG data (you're doing this correctly), but don't set the rect of the image
> first. If necessary, set the width of the image to the formattedWidth of
> the image and set the height of the image to the formattedHeight of the
> image.
> >
> > Kind regards,
> >
> > Mark Schonewille
> > http://economy-x-talk.com
> > https://www.facebook.com/marksch
> >
> > Buy the most extensive book on the
> > LiveCode language:
> > http://livecodebeginner.economy-x-talk.com
> >
> > Op 30-Jun-17 om 20:38 schreef Terence Heaford via use-livecode:
> >> This script does not work.
> >>
> >> export snapshot from rectangle (the rect of widget "Browser") to
> pictVariable as PNG
> >>
> >> set the rect of image "myImage" to the rect of widget "Browser"
> >>
> >> put pictVariable into image "myImage"
> >>
> >> print card from topleft of image "myImage" to bottomRight of image
> “myImage"
> >>
> >>
> >> After placing the captured image into “myImage” there is a grey bar at
> the top and the full width of the image is not visible.
> >>
> >> Am I doing something wrong?
> >>
> >>
> >> Thanks
> >>
> >> Terry
> >> _______________________________________________
> >> use-livecode mailing list
> >> use-livecode at lists.runrev.com
> >> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> >> http://lists.runrev.com/mailman/listinfo/use-livecode
> >>
> >
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list