Snapshot of a desktop browser

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Traxgeek
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Wed Jan 09, 2013 10:11 am

Snapshot of a desktop browser

Post by Traxgeek » Sun Jan 18, 2015 7:04 pm

Hi,
Wondering if someone can help me here please ?

I'm trying to take a snapshot of a browser window. On mobile I use the format :

Code: Select all

. . .
      mobileControlSet nBID, "rect", the rect of image "imgBrowser" of group "grpBrowser"
      mobileControlSet nBID, "url", sURL
. . .
and

Code: Select all

export snapshot from rect sTheRectOfTheBrowserImageControl to file (sFilePath & "/" & sFileName) as jpeg
which works perfectly for anything WITHIN my app - both mobile (and desktop in fact - as long as the browser control is within my app).

However, on Desktop platforms I use the

Code: Select all

 launch url sURL
code line to fire up the default browser...

Is there a way to grab a screenshot of the contents of this browser window ? I have no idea how to reference it....

Any thoughts, or maybe, there's a better way / I shouldn't be using an external browser at all... ? ? ? I do hope someone can give me a kick in the right direction please.

Thanks a mil - as always !

Regards,
Trax
I'm 'getting there'... just far too slowly !
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Snapshot of a desktop browser

Post by Klaus » Sun Jan 18, 2015 7:31 pm

Hi Trax,
Traxgeek wrote:Is there a way to grab a screenshot of the contents of this browser window ?
not from within Livecode, I'm afraid!

Maybe you you can create an AppleScript on the Mac, who knows!? :D
No idea about Win and VBScript or something...


Best

Klaus

Traxgeek
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Wed Jan 09, 2013 10:11 am

Re: Snapshot of a desktop browser

Post by Traxgeek » Mon Jan 19, 2015 8:46 am

Thanks Klaus.
Saved me banging my head against the wall for hours again ! Thanks a million.
Regards,
Trax
I'm 'getting there'... just far too slowly !
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Snapshot of a desktop browser

Post by Dixie » Mon Jan 19, 2015 12:11 pm

Hi...

You can grab a screenshot of the visible content of a 'browser' built within your stack by using export snapshot...

ramav
Posts: 20
Joined: Tue Jan 06, 2009 4:56 am

Re: Snapshot of a desktop browser

Post by ramav » Tue Aug 18, 2015 8:17 am

Hi Traxgeek:
I cannot even get the browser screen capture within my mobile app to work. Could you please provide some more details for your code snippets, specifically
mobileControlSet nBID, "rect", the rect of image "imgBrowser" of group "grpBrowser"
....
export snapshot from rect sTheRectOfTheBrowserImageControl to file (sFilePath & "/" & sFileName) as jpeg
.....

Does sTheRectOfTheBrowserImagecontgrol refer to the rect of image "imgBrowser" of group "grpBrowser"? Specifically, what does it expand to? Am I missing something? Thanks a bunch in advance...

MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: Snapshot of a desktop browser

Post by MaxV » Mon May 23, 2016 1:20 pm

This works:

Code: Select all

import snapshot from rectangle (the rect of widget "browser")
however use it correct window/widget coordinates
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

Post Reply