swa Posted April 24, 2009 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
PsaltyDS Posted April 24, 2009 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
swa Posted April 24, 2009 Author Posted April 24, 2009 my problem is the $oie1 and $oie2 how make it in loops ??
Valuater Posted April 24, 2009 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)
swa Posted April 25, 2009 Author 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 ?
DavidKarner Posted April 25, 2009 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.
swa Posted April 25, 2009 Author 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.
oMBRa Posted April 25, 2009 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]
Valuater Posted April 25, 2009 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
swa Posted April 25, 2009 Author Posted April 25, 2009 Valuater the problem is that are 10 websites forgotten to say soory i make only 2 to make it understand
Valuater Posted April 25, 2009 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)
swa Posted April 25, 2009 Author 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
Valuater Posted April 25, 2009 Posted April 25, 2009 Remember this is done without testing... I think it's $IE = Eval("oIE" & $x) Sorry! 8)
swa Posted April 26, 2009 Author 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
swa Posted April 26, 2009 Author Posted April 26, 2009 but why it is so slowly ? can I make it faster and when yes how ?
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