revBrowserSnapshot anybody have examples of its use?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

revBrowserSnapshot anybody have examples of its use?

Post by Simon » Thu Oct 11, 2007 5:25 am

Hi,
Just seeing if anybody has code with revBrowserSnapshot working in it.
I can't seem to get it to work.

Thanks,
Simon

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Thu Oct 11, 2007 9:18 am

Hi Simon,

Assuming that the ID of the browser is 2 and that an image "Your Image" exists, the following should work.

put empty into theSnapshotVariable

Code: Select all

revBrowserSnapshot 2, "theSnapshotVariable"
set the imageData of image "Your Image" to theSnapshotVariable
Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Post by Simon » Thu Oct 11, 2007 5:31 pm

Hi Mark,
Well you've repeated what is in the documentation, which I have tried.
Any other suggestions?

Simon

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Thu Oct 11, 2007 6:22 pm

Simon,

It works fine here. I have just tested it. Post your own script, please.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Post by Simon » Thu Oct 11, 2007 7:24 pm

Hi Mark,
By taking the code out of the card script I got it to work, thanks.
Now how about saving the image to a file?
Sure, binfile:myPic. xxx Is it in a standard format that can be saved?

Thanks,
Simon

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Thu Oct 11, 2007 7:31 pm

Hi Simon,

Here is an example.

Code: Select all

global gBrowserID

on mouseUp
  if gBrowserID is an integer then
    put empty into myImgData
    revBrowserSnapShot gBrowserID,"myImgData"
    set the imagedata of img 1 to myImgData
    set the width of img 1 to the formattedWidth of img 1
    set the height of img 1 to the formattedheight of img 1
    put specialfolderpath("desktop") & \
    "/rev snapshot.png" into myFile
    set the filetype to "????PNGf"
    export img 1 to file myFile as PNG
  end if
end mouseUp
This script makes a snapshot and saved the image to a file on the desktop. The file is called "rev snapshot.png". You will have to adjust the script for your own needs.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Post by Simon » Tue Oct 23, 2007 6:21 am

Hi Mark,
Thanks for the information, I've been able to get everything running.
Of course there is another thing... Is it true that the largest height of the snapshot is 1024 px? I can't seem to get a larger picture.

Thanks,
Simon

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Post by Simon » Sat Oct 27, 2007 3:53 am

Hi Mark,
Ok, with further experimentation I found out that the maximum height and width of the revBrowserSnapshot is based on screen resolution (I should have figured that out earlier from the 1024).

Have any ideas on how to feed it false information?
I guess you understand what I'm trying to do... get the full web page not just what I can see at one time.

Thanks again,
Simon

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Sat Oct 27, 2007 10:36 am

Hi Simon,

I know what you are trying to do. Sorry, I don't know how to do that. We can only wait until someone updates the external, which could take a few years.

If you are on Windows, you might try this:

http://iecapt.sourceforge.net/

I can't find a good alternative for Mac OS X, but you might be able to use AppleScript to create snapshots with Safari.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Post by Simon » Sat Oct 27, 2007 7:05 pm

Hi Mark thanks!
I think I found one for Safari:

http://www.derailer.org/paparazzi/

There are some extra command line codes to digest, but essentially I think it's the same.

Thank again,
Simon

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Sat Oct 27, 2007 10:42 pm

Hi Simon,

That's a nice link. I also see some source code laying around. Maybe that will inspire someone to update the revBrowser external...

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Andycal
Posts: 144
Joined: Mon Apr 10, 2006 3:04 pm

Post by Andycal » Sun Feb 24, 2008 10:01 am

This is *really* late to the party, but I use SnagIt to do my screen capture and it gets whole web pages by taking a snapshot, then scrolling the screen down and taking another and joining them together.

Gawd knows how you'd do this in Rev, but I'm guessing it's more of a IE control/maths problem rather than jiggering around with external libraries and stuff.

Post Reply