JohnBailey Posted February 19, 2007 Share Posted February 19, 2007 My apologies for the bad titleI want the for statement to pick-up where it left off last time the function was called. Here's what I've got, but there MUST be a better way. The For statement is inside of a function.It would make much more sense to have For $i to "a hundred more". Any ideasIf $number = 1 Then For $i = 1 To 100 $variable = $array[$i]&' ' ControlSend($Win_Title, $Win_Text, $Control_ID, $variable) Next ElseIf $number = 2 Then For $i = 101 To 200 $variable = $array[$i]&' ' ControlSend($Win_Title, $Win_Text, $Control_ID, $variable) Next ElseIf $number = 3 Then For $i = 201 To 300 $variable = $array[$i]&' ' ControlSend($Win_Title, $Win_Text, $Control_ID, $variable) Next ElseIf $number = 4 Then For $i = 301 To 401 $variable = $array[$i]&' ' ControlSend($Win_Title, $Win_Text, $Control_ID, $variable) Next ElseIf $number = 5 Then For $i = 401 To 501 $variable = $array[$i]&' ' ControlSend($Win_Title, $Win_Text, $Control_ID, $variable) Next ElseIf $number = 6 Then close() EndIf A decision is a powerful thing Link to comment Share on other sites More sharing options...
JohnBailey Posted February 19, 2007 Author Share Posted February 19, 2007 This does it Local $array Local $ii = 1 Local $iii = 100 MsgBox(0,"Dialog",$ii &" to "&$iii) goForward() Func goForward() For $i = $ii To $iii ControlSend("Untitled - Notepad","","Edit1",$array[$i]&" ") $iii = $ii + 99 $ii = $i Next MsgBox(0,"Dialog",$ii &" to "&$iii) goForward() EndFunc A decision is a powerful thing Link to comment Share on other sites More sharing options...
Valuater Posted February 19, 2007 Share Posted February 19, 2007 (edited) maybe... Func DoIt($Num) Local $bNum = ($Num * 100) Local $aNum = ($bNum - 99) For $i = $aNum To $bNum $variable = $array[$i]&' ' ControlSend($Win_Title, $Win_Text, $Control_ID, $variable) Next EndFunc 8) Edited February 19, 2007 by Valuater Link to comment Share on other sites More sharing options...
JohnBailey Posted February 19, 2007 Author Share Posted February 19, 2007 Valuater, I like the logic of that much better. I did the following; what do you think? Local $i Local $ii = 1 Local $iii Local $iv Func goForward() If $iii < $ArrayMax Then Local $iii = ($ii * 100) Local $iv = ($iii - 99) $ii = $ii+1 For $i = $iv To $iii ControlSend("Untitled - Notepad","","Edit1",$array[$i]&@CR) If @error Then ExitLoop Next goForward() Else MsgBox(0,"Dialog","Done!") EndIf EndFuncoÝ÷ ÙhrÉ÷öÛaÌ(®H§wöÉèµìb¶)ඥ¢HË^iØzºè®Ê.µ©ÝrZ,zÆ®¶sd6öçG&öÅ6VæBgV÷CµVçFFÆVBÒæ÷FWBgV÷C²ÂgV÷C²gV÷C²ÂgV÷C´VFCgV÷C²Âb33c¶'&²b33c¶Òf×´5" bW'&÷"FVâWDÆö÷ A decision is a powerful thing 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