Jump to content

Issue with a for loop in an if statement


Recommended Posts

I've got the following code, and it exits out w/o error before the test_ ( 'if' ) line however the statement inside the for loop works.

$nuke = IniReadSection ( $tempini , 'nuke' )
If @error Then
    test_('test')
    Dim $nuke[1][1]
    $nuke[0][0] = 'omg'
EndIf
test_ ( $nuke[0][0] & ' Nuke' )
If $nuke[0][0]<>'omg' Then
    For $n = 1 To $nuke[0][0]+1
        test_ (DirRemove ( $addondir & $nuke[$n][1] , 1 ))
    Next
    test_ ('if')
EndIf

i tried it w/o that if @error statement and some other things for the if nuke statement and had the same issue.

the test_ function is just a simple little debugging function which outputs a msgbox.

any idea why it exits out?

Edited by Swimming_Bird
Link to comment
Share on other sites

I've got the following code, and it exits out w/o error before the test_ ( 'if' ) line however the statement inside the for loop works.

$nuke = IniReadSection ( $tempini , 'nuke' )
If @error Then
    test_('test')
    Dim $nuke[1][1]
    $nuke[0][0] = 'omg'
EndIf
test_ ( $nuke[0][0] & ' Nuke' )
If $nuke[0][0]<>'omg' Then
    For $n = 1 To $nuke[0][0]+1
        test_ (DirRemove ( $addondir & $nuke[$n][1] , 1 ))
    Next
    test_ ('if')
EndIf

i tried it w/o that if @error statement and some other things for the if nuke statement and had the same issue.

the test_ function is just a simple little debugging function which outputs a msgbox.

any idea why it exits out?

1) This line could be the problem

For $n = 1 To $nuke[0][0]+1 <--------------- +1 should not be here, the number of entries is $nuke[0][0]

2) make sure you have got '\' at the end of $addondir or the beginning of $nuke[$n][1].

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...