6105 Posted March 4, 2012 Posted March 4, 2012 (edited) Hi, i have a for and can't stop it, using ExitLoop i don't see any reaction.. For $oLink in $oLinks $check = _StringBetween($oLink.href, $x1, $y1) If not @error Then $string=_ArrayToString($check) If $a = $string Then ExitLoop ; ==> HERE NEED TO STOP ElseIf $a < 9 Then $result = StringLeft($string, 1) Else $result = StringLeft($string, 2) EndIf EndIf Next ; ==> HERE need to go, by ignoring all rest of $oLinks Thanks alot Edited March 5, 2012 by toader [center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Don't utter a single word[/font][/center][center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Just shut your pretty mouth[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you again[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you[/font][/center][center][font=courier new,courier,monospace]In hell[/font][/center]
Exit Posted March 5, 2012 Posted March 5, 2012 post the full working code. App: Au3toCmd UDF: _SingleScript()
Bert Posted March 5, 2012 Posted March 5, 2012 well, your code says $a = $string then exit loop. Does $a= $string? The Vollatran project My blog: http://www.vollysinterestingshit.com/
6105 Posted March 5, 2012 Author Posted March 5, 2012 (edited) i think here is some bug, problem is not in code, coz i test it on separated script everything works well i try now "If $x <> $y" also don't work.... ahh.. Func _Repeat() $a = $a+1 ConsoleWrite('$a = '&$a) _IELoadWait($oIE) $oLinks = _IELinkGetCollection($oIE) $iNumLinks = @extended ConsoleWrite(' 2. Links Found: ' & $iNumLinks) If $a <> $b Then For $oLink in $oLinks FileWrite($mFile, $oLink.href & @CRLF) $check = _StringBetween($oLink.href, $x1, $y1) $check = _StringBetween($oLink.href, $x2, $y2) If not @error Then $string=_ArrayToString($check) If $a < 9 Then $result = StringLeft($string, 1) Else $result = StringLeft($string, 2) EndIf If $result > $a Then ConsoleWrite (' I found it: '&$result& ' link: ' & $oLink.href & @CRLF) _Repeat() Elseif $result = $a Then MsgBox(0,'ERROR','$result = $a'&$result&'='&$a) EndIf EndIf Next Else ConsoleWrite('$a is equal with $b'&$a&'='&$b) EndIf EndFunc In console i see all is well: $a = 13 2. Links Found: 38 I found it: 14 link: ..b=14 $a = 14 2. Links Found: 43 I found it: 15 link: ..b=15 $a = 15 2. Links Found: 40 I found it: 16 link: ..b=16 $a = 16 2. Links Found: 25 $a is equal with $b16=16 --> COM Error Encountered in test2.au3 ----> $IEComErrorScriptline = 33 ----> $IEComErrorScriptline = 34 ----> $IEComErrorScriptline = 35 ... This IE errors is in "If $a <> $b Then" and in this tipe $a = $b Line 33,34,35: FileWrite($mFile, $oLink.href & @CRLF) $check = _StringBetween($oLink.href, $x1, $y1) $check = _StringBetween($oLink.href, $x2, $y2) Edited March 5, 2012 by toader [center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Don't utter a single word[/font][/center][center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Just shut your pretty mouth[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you again[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you[/font][/center][center][font=courier new,courier,monospace]In hell[/font][/center]
kylomas Posted March 5, 2012 Posted March 5, 2012 (edited) toader, Be carefull with _stringbetween. The doc says Success: A 0 based $array[0] contains the first found string. It can return multiple rows as demonstrated by the following code ;::: #include <ARRAY.AU3>#include <STRING.AU3>$a = 'abcdefabcdabcdefghijdxyzc' $result = _StringBetween($a,'c','f') _arraydisplay($result) ConsoleWrite(_arraytostring($result) & @LF) If multiple rows are returned they are delimited by a "|". kylomas Edit: correction - if multiple rows are found you use arraytostring which inserts a delimiter of "|" between elements Edited March 5, 2012 by kylomas 6105 1 Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
6105 Posted March 5, 2012 Author Posted March 5, 2012 (edited) toader, Be carefull with _stringbetween. The doc says It can return multiple rows... kylomas Thank you, i'll fix my code, but here is another problem coz $a is real equal with $b $aString=155 $aPages = Round($aString,-0.1) ; $aPages = 16 $b = $aPages ; is 16 $a = $a+1 ; is 1..2.3..4. up to 16 Edited March 5, 2012 by toader [center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Don't utter a single word[/font][/center][center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Just shut your pretty mouth[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you again[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you[/font][/center][center][font=courier new,courier,monospace]In hell[/font][/center]
BrewManNH Posted March 5, 2012 Posted March 5, 2012 You keep changing the problem you're seeing, either you can't get out of a For loop or you can't get your function to work. Because right now, the first problem has nothing whatever to do with the second problem. Not to mention, you haven't yet posted a workable script that anyone would be able to test to see what you are doing wrong to get that error message. Post a WORKING script, and not just a function that no one can run, if you would like any help. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
kylomas Posted March 5, 2012 Posted March 5, 2012 Yes, and whatever produces this console message was not posted $a is equal with $aPages16=16kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
6105 Posted March 5, 2012 Author Posted March 5, 2012 Yes, and whatever produces this console message was not postedkylomasThat is posted.. and i don't understand why after posting and showing that $a<>$b that continue looping.. [center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Don't utter a single word[/font][/center][center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Just shut your pretty mouth[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you again[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you[/font][/center][center][font=courier new,courier,monospace]In hell[/font][/center]
kylomas Posted March 5, 2012 Posted March 5, 2012 toader, Where? The code in # 4 will not produce that message...regardless, if you want help you need to post a reproducer. kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
kylomas Posted March 5, 2012 Posted March 5, 2012 Toader, I see that you edited the post to match the output. We'll be glad to help but cannit hit a moving target. Post a reproducer. kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
JohnOne Posted March 5, 2012 Posted March 5, 2012 That is posted.. and i don't understand why after posting and showing that $a<>$b that continue looping.. Why shouldn't it continue looping?You don't even have a reference to ExitLoop in that code.Are you taking the piss? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
6105 Posted March 5, 2012 Author Posted March 5, 2012 (edited) You don't even have a reference to ExitLoop in that code. Where? The code in # 4 will not produce that message...regardless, if you want help you need to post a reproducer. Post a WORKING script, and not just a function that no one can run, if you would like any help. Sorry that i not post the reproducer... that is not legit with Term of Use, sorry i can't.. But also have good news.. i have find the problem, problem is in my pseudo looping)) If $result > $a Then ConsoleWrite (' I found it: '&$result& ' link: ' & $oLink.href & @CRLF) _Repeat() In 1 for, is started the same for function one more time.. and more and more.. when i close last.. another continue working... Thank all a lot! Edited March 5, 2012 by toader [center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Don't utter a single word[/font][/center][center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Just shut your pretty mouth[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you again[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you[/font][/center][center][font=courier new,courier,monospace]In hell[/font][/center]
kylomas Posted March 5, 2012 Posted March 5, 2012 6105, How, and why, did you change names after 13 post on this topic? I see your reference to terms violations but why change names? kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
6105 Posted March 5, 2012 Author Posted March 5, 2012 kylomas, i have change my name coz i don't like when somebody call me by name Thank you.. you have help me to find my stupid error )) [center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Don't utter a single word[/font][/center][center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Just shut your pretty mouth[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you again[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you[/font][/center][center][font=courier new,courier,monospace]In hell[/font][/center]
Moderators Melba23 Posted March 5, 2012 Moderators Posted March 5, 2012 6105,Sorry that i not post the reproducer... that is not legit with Term of UseI am sure those who replied to you will note that and not be so helpful when you post in future. And more importantly I have also noted that you seek help for non-legitimate code. This is the second time you have come to my attention in the past few days - please make sure there is not a third. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Recommended Posts