Jump to content
Sign in to follow this  
catstwespos

Building a Function with a function inside

Recommended Posts

hey,

ok... so I have been having a problem writing a function that also calls on a function. it has been giving me weird errors like "no end function" for func file.au3 and "syntax error" for file.au3. (_FileReadToArray inside of file.au3 is the autoit funciton that my function calls). Is this a common problem for autoit or is it a problem in my logic? am i just dumb? i will add in my logic to look over, but i will take out any local variables.

Thanks guys

-tom

Func _PermissionsSet($Who, $What, $location)

Dim $aRecords
Local $permission =  $Who & ':' & $What
Local $filepath = ("variable")
Local $Xcacls = ' /c cscript variable ' & $location & ' /Q /E /G ' & $permission & ' /L ' & $filepath

;;delete file
FileDelete($filepath)

;;Change File Permissions to user:modify
RunWait(@COMSPEC & $Xcacls)
sleep(1000)

;;read log file
#include <file.au3>
If Not _FileReadToArray($filepath, $aRecords) Then
    MsgBox(4096, "Error", " Error reading log to Array     error:" & @error)
    Exit
EndIf
For $x = 1 To $aRecords[0]
    If StringInStr($aRecords[$x], "error") Then
        MsgBox(0, "Error", 'Record:' & $x & @CRLF & $aRecords[$x])
        ExitLoop
    ElseIf StringInStr($aRecords[$x], "Complete") Then
        MsgBox(0, "Complete", 'Record:' & $x & @CRLF & $aRecords[$x])
        ExitLoop
    EndIf
Next
EndFunc
Edited by Larry

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  

×
×
  • Create New...