Jump to content
Sign in to follow this  
ironmankho

How i can use loop on this type ?

Recommended Posts

ironmankho

Posted Image

<div class="photoItem">

<p class="photoNr"><a href="zdjecie,siedziba-blizzarda,3211,1.html">1</a></p>

<img src="stuff/blizzard/blizzard_01.jpg">

<p><small></small></p>

</div>

hi i am extracting image link from using below code

#Include <string.au3> #include <INet.au3> $Source = _INetGetSource("http://widelec.org/index.php?site=blog&action=detail&text=&blog_id=3211&page2=0&section=1&pages=100") $Between = _StringBetween($Source, '<img src="stuff/', '<p><small></small></p>') $file = FileOpen("C:\cd1.txt",1) FileWriteLine($file, $Between[0]) MsgBox(0, "Result", $Between[0])

#Include <string.au3>
#include <INet.au3>
;$Source = _"c:\cd.txt"
$Source = _INetGetSource("http://widelec.org/index.php?site=blog&action=detail&text=&blog_id=3211&page2=0&section=1&pages=100")
$Between = _StringBetween($Source, '<img src="stuff/', '<p><small></small></p>')
$file = FileOpen("C:\cd1.txt",1)
FileWriteLine($file, $Between[0])
MsgBox(0, "Result", $Between[0])

Now i am get fine result like

blizzard/blizzard_01.jpg">

and now my question is what type of loop i will use to get all images link like this [i know that there are 100 in number ]

Edited by ironmankho

Share this post


Link to post
Share on other sites
dantay9

StringRegExp would be best, but if you haven't used it before, it can be difficult to learn. I recommend Expresso for newcomers. It helped me get started. Make sure you change the last parameter in StringRegExp so it returns an array of all the matches, not a 1 or a 0.

You may have to register for Expresso, but it doesn't cost anything.

Edited by dantay9

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites
ThickOfIt

find all text between divs. extract img url. repeat.

do until EOF

EOF prolly needs to be changed to proper term

Share this post


Link to post
Share on other sites
ivan

Get a base URL (i.e, http://widelec.org/stuff )and concatenate the path to each file. Then download using InetGet.

You can also use wget.exe (google it, it's amazing).

sorry, the loop. Easy, get a collection of images to an array and download or do what you want.

; your page
$baseURL = 'http://widelec.org'
$url='http://widelec.org/index.php?site=blog&action=detail&text=&blog_id=3211&page2.. BLA BLA'
$oIE=_IECreate("about:blank")
_IENavigate(oIE ,)
$oImgs=_IEImgGetCollection ( $oIE, $url )
Dim $aImgs[1]
If StringInStr($oImg.src, 'stuff/blizzard/') Then
    ReDim $aImgs[UBound($aImgs)+1]
    $aImgs[UBound($aImgs)-1] = $baseURL&'\'&$oImg.src
EndIf
$aImgs[0]=UBound($aImgs)-1
Edited by ivan

Share this post


Link to post
Share on other sites
ironmankho

dantay9 , yes it is true StringRegExp is difficult to learn .... but thanks for your link

ThickOfIt

ind all text between divs. extract img url. repeat.

do until EOF

EOF prolly needs to be changed to proper term

Thanks for your advise ....i am newbie and try understand this ..but it will more help full me if you more explain ..please

ivan

your suggestion and code is awesome .... but using IEImgGetCollectionhave problem ..it download all images of web page than reply .instead i using INetget it only download source code of page and then exaime ..that is why i use this

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×