Sign in to follow this  
Followers 0
gcue

If & For statements aren't open

5 posts in this topic

i dont see that any if or For statements are open yet im getting missing endif errors

Func Location_Check_Security()
$asset = IniReadSection($ini, GuiCtrlRead($combo) & "_ASSETS")
If @error Then 
    MsgBox(0, "Check Security", "Please choose one location at a time.")
Else

If Not FileExists($toolsdir & "\Checkers") Then
    DirCreate($toolsdir & "\Checkers")
EndIf

$file = FileOpen($toolsdir & "\Checkers\Security_Settings.csv", 1)

If $file = -1 Then
    MsgBox(0, "Check Security", 'CSV log file is in use.'&@CRLF & _ 
                          'Please close it before continuing.')
    Return
EndIf

FileClose($file)

$file = $toolsdir & "\Checkers\Security_Settings.csv"

If FileExists($file) Then
    FileDelete ($file)
EndIf

FileWrite($file, "PC, Account, NTUSER.DAT Created, NTUSER.DAT Modified")

For $i = 1 To $asset[0][0]
    $errorcount=0
    $status="1"
    $user="???"
    $cdate="???"
    $mdate="???"

Local $aText[3] = ["Security", @TAB & "Status", @TAB & @TAB & "Pinging " & $asset]
Local $aParts[3] = [200, 175, -1]
$dSTATUS = _GUICtrlStatusBar_Create($dGUI, $aParts, $aText)

Ping($asset[$i][1])
    If @error Then
        $status="OFFLINE"
        $user="???"
        $cdate="???"
        $mdate="???"
        $errorcount=+1
    EndIf

Local $aText[3] = ["Check Novell", @TAB & "Status", @TAB & @TAB & "Checking for Admin Rights on " & $asset[$i][1]]
Local $aParts[3] = [200, 175, -1]
$dSTATUS = _GUICtrlStatusBar_Create($dGUI, $aParts, $aText)

If $errorcount=0 Then
    RegRead ( "\\" & $asset[$i][1] & "\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion", "ProgramFilesDir" )
        If @error Then
            $status="NO_ADMIN_RIGHTS"
            $user="???"
            $cdate="???"
            $mdate="???"
            $errorcount=+1
        EndIf
EndIf

Local $aText[3] = ["Check Novell", @TAB & "Status", @TAB & @TAB & "Enabling " & $asset[$i][1]]
Local $aParts[3] = [200, 175, -1]
$dSTATUS = _GUICtrlStatusBar_Create($dGUI, $aParts, $aText)

If $status = "1" Then

    For $i= 1 to 20
        $key = RegEnumKey( "\\" & $asset[$i][1] & "\HKEY_LOCAL_MACHINE\SOFTWARE\Altiris\eXpress\Inventory\SIDCache", $i)
        $user = RegRead( "\\" & $asset[$i][1] & "\HKEY_LOCAL_MACHINE\SOFTWARE\Altiris\eXpress\Inventory\SIDCache\" & $key, "Name")
            If @error <> 0 then ExitLoop
            If $user <> "SYSTEM" AND $user <> "LOCAL SERVICE" AND $user <> "NETWORK SERVICE" AND $user <> "Administrator" AND $user <> "Administrators" Then
                $cdate = FileGetTime("\\" & $asset[$i][1] & "\c$\documents and settings\" & $user & "\ntuser.dat", 1)
                $mdate = FileGetTime("\\" & $asset[$i][1] & "\c$\documents and settings\" & $user & "\ntuser.dat", 0)

If @error Then
    ContinueLoop
EndIf

Local $aText[3] = ["Security", @TAB & "Status", @TAB & @TAB & "Writing results to file"]
Local $aParts[3] = [200, 175, -1]
$dSTATUS = _GUICtrlStatusBar_Create($dGUI, $aParts, $aText)

    FileWrite($file,  '' &@CRLF & _
                      $asset[$i][1] & "," & $user & "," & $cdate[1] & "/" & $cdate[2] & "/" & $cdate[0] & " " & "(" & $cdate[3] & ":" & $cdate[4] & ")" & "," & $mdate[1] & "/" & $mdate[2] & "/" & $mdate[0] & " " & "(" & $mdate[3] & ":" & $mdate[4] & ")")
Next
EndIf
    Next
            EndIf

Local $aText[3] = ["Security", @TAB & "Status", @TAB & @TAB & "Opening results file"]
Local $aParts[3] = [200, 175, -1]
$dSTATUS = _GUICtrlStatusBar_Create($dGUI, $aParts, $aText)

ShellExecute($file)

        Local $aText[3] = ["Dashboard", @TAB & "Status", @TAB & @TAB & "Idle"]
        Local $aParts[3] = [200, 175, -1]
        $dSTATUS = _GUICtrlStatusBar_Create($dGUI, $aParts, $aText)
        
EndIf
EndFunc

Share this post


Link to post
Share on other sites



As the tidy report says:

c:\users\andreas\desktop\test.au3(89) : ### Tidy Error -> "next" is closing previous "if"
c:\users\andreas\desktop\test.au3(91) : ### Tidy Error -> "endif" is closing previous "for"
c:\users\andreas\desktop\test.au3(93) : ### Tidy Error -> "next" is closing previous "if"
c:\users\andreas\desktop\test.au3(95) : ### Tidy Error -> "endif" is closing previous "for"
!> there were  4 error(s) encountered. look in your source for:### Tidy Error:

You have wrongly nested your if's and for's.

Check this example to see what I mean:

$bool=True
If $bool Then
    For $i=0 To 100
        
    EndIf
Next

:)


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

got it!

where do i get the tidy prog?

Share this post


Link to post
Share on other sites

got it!

where do i get the tidy prog?

Dowload SciTe4AutoIt and then you can just press ctrl+t in SciTe to get your code nicely formated and also great error checking (for the kind of errors you encountered).

:)


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

omg thats so beautiful!!!!

Share this post


Link to post
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
Sign in to follow this  
Followers 0