Jump to content

Recommended Posts

Posted

Can any one tell me whats happening here?

I have written this func to check if an emloyee has submitted a time sheet.

it creates an array from a file containing a list of empoyees.

and then searches thru a folder to check if they have submitted.

If they have...then it removes their name from the array so that i am left

with only the people who have not submitted a time sheet.

BUT, the line.......

Msgbox(0,"test" , $sPath & $employee[$x] & ".txt")

......is doing funny things!

the ".txt" is knocked onto the next line and it doesnt work!!!!?

thanks in advance

Func............................

Global Cont $sPath = "\\PC1234\timesheets\"

Func CheckSubmitted()

Dim $employee,$x

If Not _FileReadToArray("Employees.txt",$employee) Then

MsgBox(4096,"Error", " Error reading Employee List File to Array error:" & @error)

Exit

EndIf

;_ArrayDisplay($employee, "Updated Array" )

For $x = 1 to $employee[0]

;Msgbox(0,"test" , $sPath & $employee[$x] & ".txt")

$search = FileFindFirstFile($sPath & $employee[$x] & ".txt")

If $search <> -1 Then

_ArrayDelete( $employee,$x)

EndIf

FileClose($search)

Next

_ArrayDisplay($employee, "Updated Array" )

EndFunc

Posted (edited)

This problem was fixed in the beta back july of last year

The line before commented MsgBox should fix your problem

Global Cont $sPath = "\\PC1234\timesheets\"

Func CheckSubmitted()
    
    Dim $employee, $x
    
    If Not _FileReadToArray("Employees.txt", $employee) Then
        MsgBox(4096, "Error", " Error reading Employee List File to Array error:" & @error)
        Exit
    EndIf
;_ArrayDisplay($employee, "Updated Array" )
    For $x = 1 To $employee[0]
        
        $employee[$x] = StringStripCR($employee[$x])
    ;Msgbox(0,"test" , $sPath & $employee[$x] & ".txt")
        $search = FileFindFirstFile($sPath & $employee[$x] & ".txt")
        If $search <> - 1 Then
            _ArrayDelete($employee, $x)
            
        EndIf
        FileClose($search)
    Next
    _ArrayDisplay($employee, "Updated Array")
    
EndFunc  ;==>CheckSubmitted
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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
  • Recently Browsing   0 members

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