BlueC Posted March 1, 2012 Share Posted March 1, 2012 I am trying to create a code which will navigate to a URL containing a gallery of images and download the main image being shown.The website in question is puush.me and, using Google Search's first hit, an example would be http://puush.me/Branch/Gallery. The main image would be the large checkerboard picture.I'm unfamiliar with object operations, and have been unable to make any progress with the ImgGetCollection, BodyReadHTML, and BodyReadText functions. Any guidance would be greatly appreciated. Link to comment Share on other sites More sharing options...
wakillon Posted March 1, 2012 Share Posted March 1, 2012 I am trying to create a code which will navigate to a URL containing a gallery of images and download the main image being shown.The website in question is puush.me and, using Google Search's first hit, an example would be http://puush.me/Branch/Gallery. The main image would be the large checkerboard picture.I'm unfamiliar with object operations, and have been unable to make any progress with the ImgGetCollection, BodyReadHTML, and BodyReadText functions. Any guidance would be greatly appreciated.http://puush.me use javascript for calculate pic url based on index of clicked pic.Take a look to their JScripts : pi.imgloaded.js and gallery.jsPics are stored on http://puu.sh/ ( ex : http://puu.sh/doB9 ) AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
BlueC Posted March 1, 2012 Author Share Posted March 1, 2012 I'll have to ask for a bigger hint than that, I still have no idea where to even start once I have the webpage opened. Link to comment Share on other sites More sharing options...
wakillon Posted March 1, 2012 Share Posted March 1, 2012 On a classic Website it can be done like that :#include <IE.au3> $f_tryAttach=0 $f_visible=1 $f_wait=1 $oIE = _IECreate ( "http://www.autoitscript.com/", $f_tryAttach, $f_visible, $f_wait ) $oImgs = _IEImgGetCollection ( $oIE ) ConsoleWrite ( "+ There are " & @extended & " images on the page : " & @Crlf ) For $oImg In $oImgs $_Url = $oImg.src ConsoleWrite ( "- Img Info src= " & $oImg.src & @Crlf ) InetGet ( $_URL, @DesktopDir & '' & _GetFullNameByUrl ( $_URL ), 1, 0 ) Next _IEQuit ( $oIE ) Exit Func _GetFullNameByUrl ( $_FileUrl ) $_FileName = StringSplit ( $_FileUrl, '/' ) If Not @error Then Return $_FileName[$_FileName[0]] EndFunc ;==> _GetFullNameByUrl ( )but the use of javascript on http://puush.me prevents proper operation... AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
BlueC Posted March 1, 2012 Author Share Posted March 1, 2012 After a bit of messing around, I was able to find the main image URL with _IEBodyReadHTML. The script continued executing before the image data was loaded onto the webpage (even with proper settings), so a simple sleep command remedied it. Thanks for the responses. Link to comment Share on other sites More sharing options...
wakillon Posted March 1, 2012 Share Posted March 1, 2012 After a bit of messing around, I was able to find the main image URL with _IEBodyReadHTML.The script continued executing before the image data was loaded onto the webpage (even with proper settings), so a simple sleep command remedied it.Thanks for the responses.i have tried on ie7 with _IEBodyReadHTML and a big sleep but it return no pic url...Can you show your code ? AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
BlueC Posted March 1, 2012 Author Share Posted March 1, 2012 $puush = _IECreate("http://puush.me/branch/gallery",0,0,1,0) sleep(2000) $HTMLGrab = _IEBodyReadHTML($puush) _IEQuit($puush) $URLStart = StringInStr($HTMLGrab,"http://puu.sh") If ($URLStart=0) Then Exit 1 Else $HTMLGrab = StringTrimLeft($HTMLGrab, $URLStart-1) $ImageURL = StringTrimRight($HTMLGrab, (StringLen($HTMLGrab)-18)) EndIf The main image is the only one with puu.sh, while everything else still uses puush.me Link to comment Share on other sites More sharing options...
wakillon Posted March 1, 2012 Share Posted March 1, 2012 Thinking to no longer hide IE window, I have tried on 2 PC with IE7 and they can't display website because of errors on page. So i can't test it. Anyway glad you find a working solution. What's your IE version ? AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
BlueC Posted March 1, 2012 Author Share Posted March 1, 2012 IE9 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now