Jump to content

Recommended Posts

Posted

My apologies for the bad title

I 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 ideas

If $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
Posted

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

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
×
×
  • Create New...