swa Posted April 24, 2009 Share Posted April 24, 2009 hi soory my englisch is not so good ... but i hope you can understand me okay i have this code $oFrame = _IEFrameGetObjByName ($oIE1, "up") $sHTML = _IEDocReadHTML ($oFrame) $result = StringLeft($shtml, 18) If $result = "<HTML><HEAD><Meta" Then sleep(2*1000) else $link=FileReadLine ("bannerlinks.txt", $i ) _IENavigate ($oIE1, $link) $i = $i + 1 EndIF Sleep(2 * 1000) $oFrame = _IEFrameGetObjByName ($oIE2, "up") $sHTML = _IEDocReadHTML ($oFrame) $result = StringLeft($shtml, 18) If $result = "<HTML><HEAD><Meta" Then sleep(2*1000) else $link=FileReadLine ("bannerlinks.txt", $i ) _IENavigate ($oIE2, $link) $i = $i + 1 EndIF Sleep(2 * 1000) is there a way to have this only one time ? i hope somebody understand me ... swa Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 24, 2009 Share Posted April 24, 2009 hi soory my englisch is not so good ... but i hope you can understand me okay i have this code $oFrame = _IEFrameGetObjByName ($oIE1, "up") $sHTML = _IEDocReadHTML ($oFrame) $result = StringLeft($shtml, 18) If $result = "<HTML><HEAD><Meta" Then sleep(2*1000) else $link=FileReadLine ("bannerlinks.txt", $i ) _IENavigate ($oIE1, $link) $i = $i + 1 EndIF Sleep(2 * 1000) $oFrame = _IEFrameGetObjByName ($oIE2, "up") $sHTML = _IEDocReadHTML ($oFrame) $result = StringLeft($shtml, 18) If $result = "<HTML><HEAD><Meta" Then sleep(2*1000) else $link=FileReadLine ("bannerlinks.txt", $i ) _IENavigate ($oIE2, $link) $i = $i + 1 EndIF Sleep(2 * 1000) is there a way to have this only one time ? i hope somebody understand me ... swa Use For/Next, Do/Until, or While/WEnd to put it in a loop. Read up on those in the help file and try it. If you get stuck, post what you've got for more help. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
swa Posted April 24, 2009 Author Share Posted April 24, 2009 my problem is the $oie1 and $oie2 how make it in loops ?? Link to comment Share on other sites More sharing options...
Valuater Posted April 24, 2009 Share Posted April 24, 2009 Maybe.. While 1 $oFrame = _IEFrameGetObjByName($oIE1, "up") $sHTML = _IEDocReadHTML($oFrame) $result = StringLeft($sHTML, 18) If $result = "<HTML><HEAD><Meta" Then Sleep(2 * 1000) Else $link = FileReadLine("bannerlinks.txt", $i) _IENavigate($oIE1, $link) $i = $i + 1 EndIf Sleep(2 * 1000) $oFrame = _IEFrameGetObjByName($oIE2, "up") $sHTML = _IEDocReadHTML($oFrame) $result = StringLeft($sHTML, 18) If $result = "<HTML><HEAD><Meta" Then Sleep(2 * 1000) Else $link = FileReadLine("bannerlinks.txt", $i) _IENavigate($oIE2, $link) $i = $i + 1 EndIf Sleep(2 * 1000) WEnd 8) Link to comment Share on other sites More sharing options...
swa Posted April 25, 2009 Author Share Posted April 25, 2009 year but can I make it so that i say the loop run two times and on the first run its $oIE1 and the 2th time $oIE2 ? Link to comment Share on other sites More sharing options...
DavidKarner Posted April 25, 2009 Share Posted April 25, 2009 I think you could do something like... Dim $Array[2] = {$oIE1,$oIE2} For $Index = 0 To Ubound( $Array) -1 $oFrame = _IEFrameGetObjByName ($Array[$Index], "up") $sHTML = _IEDocReadHTML ($oFrame) $result = StringLeft($shtml, 18) If $result = "<HTML><HEAD><Meta" Then sleep(2*1000) else $link=FileReadLine ("bannerlinks.txt", $i ) _IENavigate ($oIE1, $link) $i = $i + 1 EndIF Sleep(2 * 1000) Next Not sure if my array initialization is correct, but this should do what you want. Link to comment Share on other sites More sharing options...
swa Posted April 25, 2009 Author Share Posted April 25, 2009 okay but a error $i=1 Do Dim $Array[10] = {$oIE1,$oIE2,$oIE3,$oIE4,$oIE5,$oIE6,$oIE7,$oIE8,$oIE9,$oIE10} For $Index = 0 To Ubound( $Array) -1 $oFrame = _IEFrameGetObjByName ($Array[$Index], "up") $sHTML = _IEDocReadHTML ($oFrame) $result = StringLeft($shtml, 18) If $result = "<HTML><HEAD><Meta" Then sleep(2*1000) else $link=FileReadLine ("bannerlinks.txt", $i ) _IENavigate ($Array[$Index], $link) $i = $i + 1 EndIF Sleep(2 * 1000) Next Until $i = 101 the error is in Line Dim $Array[10] = {$oIE1,$oIE2,$oIE3,$oIE4,$oIE5,$oIE6,$oIE7,$oIE8,$oIE9,$oIE10} Dim $Array[10] = ^ Error Error: Unable to parse line. Link to comment Share on other sites More sharing options...
oMBRa Posted April 25, 2009 Share Posted April 25, 2009 replace {$oIE1,$oIE2,$oIE3,$oIE4,$oIE5,$oIE6,$oIE7,$oIE8,$oIE9,$oIE10} with [$oIE1,$oIE2,$oIE3,$oIE4,$oIE5,$oIE6,$oIE7,$oIE8,$oIE9,$oIE10] Link to comment Share on other sites More sharing options...
Valuater Posted April 25, 2009 Share Posted April 25, 2009 (edited) Maybe... Global $i = 1 For $x = 1 To 2 ; or 1000 If IsInt($x / 2) Then $IE = $oIE2 Else $IE = $oIE1 EndIf $oFrame = _IEFrameGetObjByName($IE, "up") $sHTML = _IEDocReadHTML($oFrame) $result = StringLeft($sHTML, 18) If $result = "<HTML><HEAD><Meta" Then Sleep(2 * 1000) Else $link = FileReadLine("bannerlinks.txt", $i) If @error = -1 Then ExitLoop ; when the file is done, this will get you out of the loop _IENavigate($IE, $link) $i = $i + 1 EndIf Sleep(2 * 1000) Next .... NOT TESTED 8) EDIT... Fixed small error Edited April 25, 2009 by Valuater Link to comment Share on other sites More sharing options...
swa Posted April 25, 2009 Author Share Posted April 25, 2009 Valuater the problem is that are 10 websites forgotten to say soory i make only 2 to make it understand Link to comment Share on other sites More sharing options...
Valuater Posted April 25, 2009 Share Posted April 25, 2009 Global $i = 1 While 1 For $x = 1 To 10 $IE = Eval($oIE & $x) $oFrame = _IEFrameGetObjByName($IE, "up") $sHTML = _IEDocReadHTML($oFrame) $result = StringLeft($sHTML, 18) If $result = "<HTML><HEAD><Meta" Then Sleep(2 * 1000) Else $link = FileReadLine("bannerlinks.txt", $i) If @error = -1 Then Exit ;Loop ; when the file is done, this will get you out of the loop _IENavigate($IE, $link) $i = $i + 1 EndIf Sleep(2 * 1000) Next WEnd 8) Link to comment Share on other sites More sharing options...
swa Posted April 25, 2009 Author Share Posted April 25, 2009 soory Valuater iam a noob $IE = Eval($oIE & $x) $Ie = Eval (^Error Error: Variable used without being declared soory a 2th time swa Link to comment Share on other sites More sharing options...
Valuater Posted April 25, 2009 Share Posted April 25, 2009 Remember this is done without testing... I think it's $IE = Eval("oIE" & $x) Sorry! 8) Link to comment Share on other sites More sharing options...
swa Posted April 26, 2009 Author Share Posted April 26, 2009 i have to say soory... you want to help me and that it isn´t tested its okay its my job :-D Link to comment Share on other sites More sharing options...
swa Posted April 26, 2009 Author Share Posted April 26, 2009 but why it is so slowly ? can I make it faster and when yes how ? 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