URL to JPG
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
URL to JPG
Hi,
How can I get the snapshots of an URL list which is in Text Field?
ARAS
How can I get the snapshots of an URL list which is in Text Field?
ARAS
Re: URL to JPG
Hi ARAS,
Give us example of the text field ?
In the absence of such, I would do something like :
-1- get the number of lines in the field (number of lines),
-2- cycle through each one (repeat loop),
-3- put each line into a temporary variable (put line x of myField into)
-4- update the image pointer with image pointed to by the temporary variable (set the filename of image "..." to...)
and do it all again until each line has been handled
Would that make sense or have I misunderstood ?
HTH
EDIT : this Tutorial maybe of help ? : http://lessons.runrev.com/s/3527/m/4603 ... ing-images
Regards
Give us example of the text field ?
In the absence of such, I would do something like :
-1- get the number of lines in the field (number of lines),
-2- cycle through each one (repeat loop),
-3- put each line into a temporary variable (put line x of myField into)
-4- update the image pointer with image pointed to by the temporary variable (set the filename of image "..." to...)
and do it all again until each line has been handled
Would that make sense or have I misunderstood ?
HTH
EDIT : this Tutorial maybe of help ? : http://lessons.runrev.com/s/3527/m/4603 ... ing-images
Regards
I'm 'getting there'... just far too slowly !
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1
Re: URL to JPG
Hi Traxgeek,
Let's say the code below is the content of my text field called "URLs".
When I click a button called "URLtoJPG", I want to get the snapshots of websites.
I prefer it to be on the background while taking snapshots but can also be like - a browser opens the URL and takes the snapshot of it and repeats it for the next URL
I didn't get the number 4, but I think I want to do sth similar.
Thanks,
ARAS
Let's say the code below is the content of my text field called "URLs".
Code: Select all
www.google.com
www.livecode.com
www.runrev.com
I prefer it to be on the background while taking snapshots but can also be like - a browser opens the URL and takes the snapshot of it and repeats it for the next URL
I didn't get the number 4, but I think I want to do sth similar.
Thanks,
ARAS
Re: URL to JPG
Hi ARAS,
Open the URL in a browser object one after another and use "revBrowserSnapshot" to create a JPG from the sites.
Read up "revBrowserSnapshot" and everything you need to create a browser object in the dictionary.
Best
Klaus
That's the way to go!ARAS wrote: When I click a button called "URLtoJPG", I want to get the snapshots of websites.
I prefer it to be on the background while taking snapshots but can also be like -
a browser opens the URL and takes the snapshot of it and repeats it for the next URL...
Open the URL in a browser object one after another and use "revBrowserSnapshot" to create a JPG from the sites.
Read up "revBrowserSnapshot" and everything you need to create a browser object in the dictionary.
Best
Klaus
Re: URL to JPG
Hi Klaus,
Where can I see my browser id? I am using OS X.
Thanks,
ARAS
Code: Select all
local tSnapshot
revBrowserSnapshot sBrowserId, "tSnapshot"
set the imageData of image "Browser Thumbnail" to tSnapshot
Thanks,
ARAS
Re: URL to JPG
Hi ARAS,
you need to open a new browser object first!
Check "revbrowseropen" in the dictionary and this tutorial:
http://lessons.runrev.com/s/lessons/m/4 ... pdf-in-rev
Could not find any other REVBROWSER example on the Livecode site
Best
Klaus
you need to open a new browser object first!
Check "revbrowseropen" in the dictionary and this tutorial:
http://lessons.runrev.com/s/lessons/m/4 ... pdf-in-rev
Could not find any other REVBROWSER example on the Livecode site

Best
Klaus
Re: URL to JPG
Hi Klaus,
I was able to browse a website in an Image Area with this code.
One thing I have noticed was that tBrowserId always changes when ever I click the button. Why? Is that because I always create a new one whenever I click the button? By the way, do you know how to reset an image area?
I was trying to capture that image area, but I am failed. I used the code below, but it always created a black png not the browser snapshot. Do you know what's wrong with the code?
Also can you explain what this line does?
In the dictionary, it says "• rect - Returns the rect of the browser relative to the parent window. The default rect is 0,0,0,0."
Is it adjusting the webpage size according to the image area size?
ARAS
I was able to browse a website in an Image Area with this code.
One thing I have noticed was that tBrowserId always changes when ever I click the button. Why? Is that because I always create a new one whenever I click the button? By the way, do you know how to reset an image area?
Code: Select all
on mouseUp
get revBrowserOpen(the windowId of this stack, "http://www.google.com")
if it is an integer then
put it into tBrowserId
revBrowserSet tBrowserId, "rect", the rect of image "Image"
else
answer "There was an error: " && it --if the browser doesn't start, show the error.
end if
--answer tBrowserId
end mouseUp
Code: Select all
on mouseUp
get revBrowserOpen(the windowId of this stack, "http://www.google.com")
if it is an integer then
put it into gBrowserID
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
Code: Select all
revBrowserSet tBrowserId, "rect", the rect of image "Image"
Is it adjusting the webpage size according to the image area size?
ARAS
Re: URL to JPG
Hi ARAS,
Been away for a bit. Just looking at your progress.
I'll go take a look now. In the meantime :
'put empty into image "MyImage" '
should give you a cleared / empty image..
Back in a bit...
Been away for a bit. Just looking at your progress.
I'll go take a look now. In the meantime :
'put empty into image "MyImage" '
should give you a cleared / empty image..
Back in a bit...
I'm 'getting there'... just far too slowly !
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1
Re: URL to JPG
Wow thanks Traxgeek,Traxgeek wrote:Hi ARAS,
Been away for a bit. Just looking at your progress.
I'll go take a look now. In the meantime :
'put empty into image "MyImage" '
should give you a cleared / empty image..
Back in a bit...
I thought I tried that. I must have missed something.
It worked I can clear the image now. Thank you.
ARAS
Re: URL to JPG
OK, I'm back... I knew I'd struggled with this for quite some time
but eventually got results
As I recall a lot of the example stuff was sheer tosh ! Which resulted in much frustration - But...
In no small measure due to the Forum here (especially Bernd - a thousand thankyous Bernd ! ) and various other Google searches, I managed to succeed - so keep on going - it's worth the pain in the end ! Anyway, during my searches and coding I saved a load of examples; the most useful for you at the moment (I think) being Bernd's 'SnapFromBrowser' project.
Here's the link I saved (seems to still be available): http://ftp.runrev.com/forums/viewtopic. ... 86&p=28183 (half way down the page).
Don't forget to thank Bernd for his troubles !
I have other example stacks and my own stack (which would be a little too large / convoluted to extract, hence Bernd's) if you need more help....
HTH
Regards.


As I recall a lot of the example stuff was sheer tosh ! Which resulted in much frustration - But...
In no small measure due to the Forum here (especially Bernd - a thousand thankyous Bernd ! ) and various other Google searches, I managed to succeed - so keep on going - it's worth the pain in the end ! Anyway, during my searches and coding I saved a load of examples; the most useful for you at the moment (I think) being Bernd's 'SnapFromBrowser' project.
Here's the link I saved (seems to still be available): http://ftp.runrev.com/forums/viewtopic. ... 86&p=28183 (half way down the page).
Don't forget to thank Bernd for his troubles !
I have other example stacks and my own stack (which would be a little too large / convoluted to extract, hence Bernd's) if you need more help....
HTH
Regards.
I'm 'getting there'... just far too slowly !
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1
Re: URL to JPG
Thank you Traxgeek for helping me,
I will take a look at it in a minute.
By the way,
This code stopped working. I think that's why I wasn't able to clear when I tried before.
In the Image Area, I have revBrowser running a webpage. Is that why?
I have seen closeRevBrowser in the dictionary. Is it doing the same thing. Is it clearing the image field?
I tried the code below but couldn't see any difference.
ARAS
I will take a look at it in a minute.
By the way,
Code: Select all
put empty into image "Image"
In the Image Area, I have revBrowser running a webpage. Is that why?
I have seen closeRevBrowser in the dictionary. Is it doing the same thing. Is it clearing the image field?
I tried the code below but couldn't see any difference.
Code: Select all
get revBrowserOpen (the windowId of this stack)
put it into tBrowserId
revBrowserClose tBrowserId
Re: URL to JPG
I have download the stack of Bernd. It is awesome. Thanks to Bernd for its awesome stack 
I will try to learn from there.
The only thing missing is to save the snapshot into a file, and actually I want to snapshot everything on the webpage-not just the things shown in the image area. You know webpages doesn't fit into Image Area all the time.
Thanks,
ARAS

I will try to learn from there.

Thanks,
ARAS
Re: URL to JPG
Hi ARAS,
You could 'export as file' or simply save the image...
I have never tried to grab more of a wesite page than the area I can see in one stack card/ image. I hid the browser control during the grab process so made it pretty large.
I'm away from my desk at the moment but could continue this tomorrow if you like.
You could 'export as file' or simply save the image...
I have never tried to grab more of a wesite page than the area I can see in one stack card/ image. I hid the browser control during the grab process so made it pretty large.
I'm away from my desk at the moment but could continue this tomorrow if you like.
Last edited by Traxgeek on Mon Nov 11, 2013 9:41 am, edited 1 time in total.
I'm 'getting there'... just far too slowly !
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1
Re: URL to JPG
Hi Traxgeek,
I was able to export it as a file by adding the code below into takesnapshot button. Just incase sb is interested, I put it down.
I am not in hurry Traxgeek. I would love to learn from you. Anytime you want 
Thanks,
ARAS
I was able to export it as a file by adding the code below into takesnapshot button. Just incase sb is interested, I put it down.
Code: Select all
set the text of img "thumbnail" to tImgData
wait 10 milliseconds with messages
set the resizeQuality of img "thumbnail" to "best"
put specialfolderpath("desktop") & \
"/rev snapshot.png" into tImgData
set the filetype to "????PNGf"
export img 1 to file tImgData as PNG

Thanks,
ARAS