Re: Capturing screen into image

2017-07-02 Thread Terence Heaford via use-livecode
That’s cracked it.

Thanks very much to everyone who has contributed.

Not thought about this much but is having the print margins default to 72 the 
best option for most situations?
This is one for better minds than I.

Anyway, thanks again to all.


Terry


> On 2 Jul 2017, at 02:51, Paul Hibbert via use-livecode 
>  wrote:
> 
> Terry,
> 
> If your concern is that the area of the card doesn’t print exactly as you see 
> it on screen, it looks to me like the printMargins are set at the default 72 
> all round.
> 
> Try setting the printMargins to 0
> set the printMargins to "0,0,0,0"
> 
> 
> Paul
> 
> 
> 
> Paul
> p...@livecode.org
> 
> Mac OS Sierra 10.12.1
> 
> 


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Capturing screen into image

2017-07-01 Thread Paul Hibbert via use-livecode
Terry,

If your concern is that the area of the card doesn’t print exactly as you see 
it on screen, it looks to me like the printMargins are set at the default 72 
all round.

Try setting the printMargins to 0
set the printMargins to "0,0,0,0"


Paul



Paul
p...@livecode.org

Mac OS Sierra 10.12.1



> On Jul 1, 2017, at 1:55 PM, Terence Heaford via use-livecode 
>  wrote:
> 
> Hi,
> 
> Thanks for your suggestion but I am afraid it’s not working here:
> 
> I have prepared a short movie on dropbox so you can see what happens when I 
> print it and then open as PDF in MacOS Preview.
> 
> Not sure at all what is going wrong. Could it be something to do with the 
> scaling in the amCharts example?
> 
> Dropbox Link:  https://www.dropbox.com/s/1ijbw12v0176kgm/test.mov?dl=0
> 
> Thanks
> 
> Terry
> 
> 
>> On 1 Jul 2017, at 18:26, hh via use-livecode  
>> wrote:
>> 
>> This works here.
>> 
>> on mouseUp
>> local ii="myImage", bb="Browser"
>> if there is no img ii then create img ii
>> put globalLoc(the topLeft of widget bb) into TL
>> put globalLoc(the botRight of widget bb) into BR
>> export snapshot from rect (TL,BR) to img ii as PNG
>> hide widget bb -- avoid artefacts from browser update
>> print card from (the topLeft of img ii) to (the botRight of img ii)
>> show widget bb
>> end mouseUp
>> 
>> 
>> ___
>> use-livecode mailing list
>> use-livecode@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@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Capturing screen into image

2017-07-01 Thread hh via use-livecode
@Terry.

Because we make a snapshot this is independent of the browser's content.
So at least for isolating the problem you will find below a variant that
'snapshots' directly to a file in your stack's folder.
Then the file is opened with preview via applescript. Here I get exactly
what I want.

Of course, Preview shows gray around the image if the window is larger than
the image. Here the fact that Preview has by default not a transparent but
a gray background may be misleading.

Perhaps you could check with a different app (I use GraphicConverter)
whether this is already the case with earlier attempts or if the gray
disappears when actually printing?

Hermann

on mouseUp
  local ii="myImage.png", bb="Browser"
  put the effective filename of this stack into fn
  set the itemdel to slash
  put ii into last item of fn
  set the itemdel to comma
  put globalLoc(the topLeft of widget bb) into TL
  put globalLoc(the botRight of widget bb) into BR
  export snapshot from rect (TL,BR) to file fn as PNG
  do aScript(fn) as applescript
end mouseUp

function aScript fName
  return "set posixFile to POSIX file "& fName & \
 "tell application "&"Preview"&" to open posixFile"
end aScript

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Capturing screen into image

2017-07-01 Thread Terence Heaford via use-livecode
Hi,

Thanks for your suggestion but I am afraid it’s not working here:

I have prepared a short movie on dropbox so you can see what happens when I 
print it and then open as PDF in MacOS Preview.

Not sure at all what is going wrong. Could it be something to do with the 
scaling in the amCharts example?

Dropbox Link:  https://www.dropbox.com/s/1ijbw12v0176kgm/test.mov?dl=0

Thanks

Terry


> On 1 Jul 2017, at 18:26, hh via use-livecode  
> wrote:
> 
> This works here.
> 
> on mouseUp
>  local ii="myImage", bb="Browser"
>  if there is no img ii then create img ii
>  put globalLoc(the topLeft of widget bb) into TL
>  put globalLoc(the botRight of widget bb) into BR
>  export snapshot from rect (TL,BR) to img ii as PNG
>  hide widget bb -- avoid artefacts from browser update
>  print card from (the topLeft of img ii) to (the botRight of img ii)
>  show widget bb
> end mouseUp
> 
> 
> ___
> use-livecode mailing list
> use-livecode@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Capturing screen into image

2017-07-01 Thread hh via use-livecode
This works here.

on mouseUp
  local ii="myImage", bb="Browser"
  if there is no img ii then create img ii
  put globalLoc(the topLeft of widget bb) into TL
  put globalLoc(the botRight of widget bb) into BR
  export snapshot from rect (TL,BR) to img ii as PNG
  hide widget bb -- avoid artefacts from browser update
  print card from (the topLeft of img ii) to (the botRight of img ii)
  show widget bb
end mouseUp


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Capturing screen into image

2017-07-01 Thread Matt Maier via use-livecode
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@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@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@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@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@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Capturing screen into image

2017-07-01 Thread Terence Heaford via use-livecode
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 
>  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@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@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Capturing screen into image

2017-06-30 Thread Mark Schonewille via use-livecode
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@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Capturing screen into image

2017-06-30 Thread 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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode