Sign in to follow this  
Followers 0
catstwespos

Building a Function with a function inside

4 posts in this topic

#1 ·  Posted (edited)

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



the syntax error that its giving me now is:

C:\PROGRA~1\AutoIt3\Include\file.au3(25,1) : ERROR: syntax error

Func

^

Share this post


Link to post
Share on other sites

when i take out the #include <file.au3> i get an error of:

: ERROR: _FileReadToArray(): undefined function.

If Not _FileReadToArray($filepath, $aRecords)

Share this post


Link to post
Share on other sites

wait, it kind of worked...... now its just my own logic errors!

Thanks 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  
Followers 0