Capturing screen into image

hh hh at hyperhh.de
Sat Jul 1 17:46:11 EDT 2017


@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 "&quote& fName &quote&cr& \
         "tell application "&quote&"Preview"&quote&" to open posixFile"
end aScript




More information about the use-livecode mailing list