Page 2 of 2

Re: How to take a screenshot and send it by email?

Posted: Wed Apr 06, 2022 8:01 pm
by liveCode
How can I make sure that the screenshot does not show black on top?

Re: How to take a screenshot and send it by email?

Posted: Wed Apr 06, 2022 8:16 pm
by Klaus
If you use "showAll" for the fullscreenmode, try this:

Code: Select all

...
export snapshot from rect(the rect of this card) to image "AuxImg" as PNG
...

Re: How to take a screenshot and send it by email?

Posted: Fri Apr 08, 2022 10:54 am
by liveCode
It's even worse

Re: How to take a screenshot and send it by email?

Posted: Fri Apr 08, 2022 7:58 pm
by jacque
You may need to use a calculated rectangle parameter for the screenshot:

Code: Select all

export snapshot from rect "0,0,200,200" to file "Nav.jpg" as JPEG
You'll need to figure out the topleft and bottomright coordinates. Sometimes it's easier to use the corners of existing controls but it doesn't look like your card has any at the corners. You could probably calculate it by adding or subtracting pixels from controls that are near the corners. Or put a couple of invisible controls there to use as marker points (but that's an inelegant workaround.)

Re: How to take a screenshot and send it by email?

Posted: Wed Apr 13, 2022 4:52 am
by terryho
Hi,

Try to group the field and the the output area in a group, Then export snapshot on this group.

I think it will exactly show the area you want.

Regards

Terry Ho

Re: How to take a screenshot and send it by email?

Posted: Fri Apr 15, 2022 10:36 pm
by bobcole
It seems there are two parts to this thread, 1) the correct snapshot rectangle and 2) how to attach an image to an email by script.
1) The globalLoc function will help you translate a local point to a screen coordinates. See the Dictionary.
Below is a button script that takes a snapshot of a card and puts a jpeg image on your desktop.
2) I couldn't get the revMail function (or even AppleScript) to attach the image so I can't help with that part.
Bob C

Code: Select all

on mouseUp pButtonNumber
   put the rectangle of this card into tCardRectOrig
   put toScreenCoordinates(tCardRectOrig) into tCardRect
   
   put specialFolderPath("desktop") into tFolderPath
   put tFolderPath & "/SnapShotTest.JPEG" into tFilePath
   
   export snapshot from rectangle tCardRect to file tFilePath as JPEG
   launch document tFilePath
   beep
end mouseUp

function toScreenCoordinates pCardRect
   put pCardRect & return into message box
   --put "Unadjusted: " & pCardRect & return into message box
   
   put globalLoc("0,0") into tGlobalLoc  --see Dictionary
   --put "Global Loc: " & tGlobalLoc & return after message box
   
   put item 1 of tGlobalLoc into tHorizontalShift
   put item 2 of tGlobalLoc into tVerticalShift
   
   add tHorizontalShift to item 1 of pCardRect 
   add tVerticalShift to item 2 of pCardRect
   add tHorizontalShift to item 3 of pCardRect 
   add tVerticalShift to item 4 of pCardRect
   --put "Adjusted: " & pCardRect & return after message box
   
   return pCardRect
end toScreenCoordinates