Jump to content

Loop Error.....


Recommended Posts

CODE

#NoTrayIcon

For $loop = 0 To

; MacAdress

Dim $CMDoutput, $STD_output, $Descrip = ""

$PID = Run(@ComSpec & " /c ipconfig /all", "", @SW_HIDE, 2)

While Not @error

$CMDoutput &= StdoutRead($PID)

WEnd

$CMDoutputArray = StringSplit($CMDoutput, @CRLF, 1)

For $i = 1 To $CMDoutputArray[0]

FileWriteLine("C:\script\teste.txt", $CMDoutputArray[$i] & @LF)

If StringInStr($CMDoutputArray[$i], $Descrip, 1) Then

$sConnectionName = StringTrimLeft($CMDoutputArray[$i - 3], 17)

$sConnectionName = StringTrimRight($sConnectionName, 2)

MsgBox(0, "", $sConnectionName)

ExitLoop

EndIf

Next

;Process

$list = ProcessList()

for $i = 1 to $list[0][0]

FileWriteLine("C:\script\teste.txt",$list[$i][0])

next

; Points

$scpoints = @MDAY & "/" & @MON & "/" & @YEAR & "--" & @HOUR & ":" & @MIN & ":" & @SEC

FileWriteLine("C:\script\teste.txt", @LF & $scpoints)

; Encryptation

#include <String.au3>

#include <File.au3>

$scsh = FileRead("c:\script\teste.txt")

$cy = _StringEncrypt ( 1, $scsh, "tst",1)

FileWriteLine("C:\script\teste1.txt",$cy)

;other

#include <File.au3>

$filetxt = _FileCountLines('C:\script\teste.txt')

$file1txt = _FileCountLines('C:\script\teste1.txt' )

MsgBox(0,"Count", $filetxt & "--" & $file1txt)

; File Create

Func _MSec()

Local $stSystemTime = DllStructCreate('ushort;ushort;ushort;ushort;ushort;ushort;ushort;ushort')

DllCall('kernel32.dll', 'none', 'GetSystemTime', 'ptr', DllStructGetPtr($stSystemTime))

$sMilliSeconds = StringFormat('%03d', DllStructGetData($stSystemTime, 8))

$stSystemTime = 0

Return $sMilliSeconds

EndFunc ;==>_MSec

$timer = @MDAY + @MON + @YEAR & @HOUR & @MIN & @SEC & _MSec()

FileMove("C:\script\teste1.txt", "c:\script\" & $timer & ".sh")

; Send to server

;CODE

;FileDelete("C:\script\*.sh")

FileDelete("C:\script\*.txt")

Next

MsgBox(0,"","1")

ERROR REPORT

------------------

C:\script\teste.au3(4,17) : ERROR: syntax error

For $loop = 0 To

~~~~~~~~~~~~~~~~^

C:\Programas\AutoIt3\Include\String.au3(17,1) : ERROR: missing Next.

Func

^

C:\script\teste.au3(4,15) : REF: missing Next.

For $loop = 0 To

~~~~~~~~~~~~~~^

C:\script\teste.au3(87,1) : ERROR: syntax error

Next

^

C:\script\teste.au3 - 3 error(s), 0 warning(s)

---------------------------

Maybe Simple but i dont find where is my mistake.... Can someone help me???

Link to comment
Share on other sites

#include <String.au3>
    #include <File.au3>
    
For $loop = 0 To 2;?
    
    ; MacAdress

        Dim $CMDoutput, $STD_output, $Descrip = ""

        $PID = Run(@ComSpec & " /c ipconfig /all", "", @SW_HIDE, 2)

        While Not @error
            $CMDoutput &= StdoutRead($PID)
        WEnd

        $CMDoutputArray = StringSplit($CMDoutput, @CRLF, 1)

                For $i = 1 To $CMDoutputArray[0]
                            FileWriteLine("C:\script\teste.txt", $CMDoutputArray[$i] & @LF)
                
                    If StringInStr($CMDoutputArray[$i], $Descrip, 1) Then
                        $sConnectionName = StringTrimLeft($CMDoutputArray[$i - 3], 17)
                        $sConnectionName = StringTrimRight($sConnectionName, 2)
                        MsgBox(0, "", $sConnectionName)
                        ExitLoop
                    EndIf
                Next
    ;Process

            $list = ProcessList()
            
            for $i = 1 to $list[0][0]
                FileWriteLine("C:\script\teste.txt",$list[$i][0])
            
            next
; Points
    
    $scpoints = @MDAY & "/" & @MON & "/" & @YEAR & "--" & @HOUR & ":" & @MIN & ":" & @SEC 
    FileWriteLine("C:\script\teste.txt", @LF & $scpoints)
; Encryptation 



    $scsh = FileRead("c:\script\teste.txt")
    $cy = _StringEncrypt ( 1, $scsh, "tst",1)
    FileWriteLine("C:\script\teste1.txt",$cy)

;other

    $filetxt = _FileCountLines('C:\script\teste.txt')
    $file1txt = _FileCountLines('C:\script\teste1.txt' )
    MsgBox(0,"Count", $filetxt & "--" & $file1txt)  
; File Create
Next



    $timer = @MDAY + @MON + @YEAR & @HOUR & @MIN & @SEC & _MSec() 
    FileMove("C:\script\teste1.txt", "c:\script\" & $timer & ".sh")
; Send to server
;CODE
;FileDelete("C:\script\*.sh")
    FileDelete("C:\script\*.txt")



    MsgBox(0,"","1")
    
    
    Func _MSec()
        Local $stSystemTime = DllStructCreate('ushort;ushort;ushort;ushort;ushort;ushort;ushort;ushort')
        DllCall('kernel32.dll', 'none', 'GetSystemTime', 'ptr', DllStructGetPtr($stSystemTime))
        $sMilliSeconds = StringFormat('%03d', DllStructGetData($stSystemTime, 8))
        $stSystemTime = 0
        Return $sMilliSeconds
    EndFunc  ;==>_MSec

For $loop = 0 to had nothing to count upt to.

You should put the includes at the top of the script not in the middle of the main loop

You should put the Func/Funcs at the begining or end of the main script notin the middle of a for loop

Link to comment
Share on other sites

#include <String.au3>
#include <File.au3>
#NoTrayIcon

Func _MSec()
    Local $stSystemTime = DllStructCreate('ushort;ushort;ushort;ushort;ushort;ushort;ushort;ushort')
    DllCall('kernel32.dll', 'none', 'GetSystemTime', 'ptr', DllStructGetPtr($stSystemTime))
    $sMilliSeconds = StringFormat('%03d', DllStructGetData($stSystemTime, 8))
    $stSystemTime = 0
    Return $sMilliSeconds
EndFunc;==>_MSec

$example = 5

For $loop = 0 To $example
    
; MacAdress
    
    Dim $CMDoutput, $STD_output, $Descrip = ""
    
    $PID = Run(@ComSpec & " /c ipconfig /all", "", @SW_HIDE, 2)
    
    While Not @error
            $CMDoutput &= StdoutRead($PID)
        WEnd
                
        $CMDoutputArray = StringSplit($CMDoutput, @CRLF, 1)
        
        For $i = 1 To $CMDoutputArray[0]
            FileWriteLine("C:\script\teste.txt", $CMDoutputArray[$i] & @LF)
            
            If StringInStr($CMDoutputArray[$i], $Descrip, 1) Then
                $sConnectionName = StringTrimLeft($CMDoutputArray[$i - 3], 17)
                $sConnectionName = StringTrimRight($sConnectionName, 2)
                MsgBox(0, "", $sConnectionName)
                ExitLoop
            EndIf
        Next
        
    ;Process
        
        $list = ProcessList()
        For $i = 1 to $list[0][0]
            FileWriteLine("C:\script\teste.txt",$list[$i][0])
        Next
        
        
    ; Points
        
        $scpoints = @MDAY & "/" & @MON & "/" & @YEAR & "--" & @HOUR & ":" & @MIN & ":" & @SEC
        FileWriteLine("C:\script\teste.txt", @LF & $scpoints)
        
        
    ; Encryptation
        
        
        $scsh = FileRead("c:\script\teste.txt")
        $cy = _StringEncrypt ( 1, $scsh, "tst",1)
        FileWriteLine("C:\script\teste1.txt",$cy)
        
    ;other
        
        $filetxt = _FileCountLines('C:\script\teste.txt')
        $file1txt = _FileCountLines('C:\script\teste1.txt' )
        MsgBox(0,"Count", $filetxt & "--" & $file1txt)
        
    ; File Create
        
        $timer = @MDAY + @MON + @YEAR & @HOUR & @MIN & @SEC & _MSec()
        FileMove("C:\script\teste1.txt", "c:\script\" & $timer & ".sh")
        
        
    ; Send to server
    ;CODE
        
        
    ;FileDelete("C:\script\*.sh")
        FileDelete("C:\script\*.txt")
        
    
Next



MsgBox(0,"","1")

here had no errors try this

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...