Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Loop Timer and File Checking
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01320672
Message ID:
01320682
Views:
11
>>Hi Gang!
>>
>>I want to check for a file's existence and then move on in the code.
>>
>>I want to wait about 10 seconds to see if the file shows up in a certain folder.... if so, great... process it and display it's data..
>>
>>If not, then show a messagebox and let the user know of the files non-existence.
>>
>>I was thinking along these lines....
>>
>>
>>DO WHILE (less than 10 seconds elapsed)
>>     IF FILE('THEFILE.TXT')
>>          PROCESS THE FILE
>>          EXIT
>>     ELSE
>>          MESSAGEBOX ABOUT FAILURE
>>          EXIT
>>     ENDIF
>>ENDDO
>>
>>
>>How would I time out the 10 seconds and take care of the passing midnight situation?
>>
>>Or am I totally whacked and there is some easier and more logical manner to this?
>>
>>Thanks!!
>
>
>ltStart  = DATETIME()
>lbFileExists = .f.
>DO WHILE DATETIME() - ltStart < 11
>   IF FILE(...)
>      PROCESS THE FILE
>      lbFileExists = .t.
>      EXIT
>   ENDIF
>ENDDO
>IF NOT lbFileExists
>   MESSAGEBOX ABOUT FAILURE
>ENDIF
>
>
Thanks!
This should work since DATETIME is always going up second by second and never resets after midnight....
Tommy Tillman A+ NetWork+ MCP
Previous
Reply
Map
View

Click here to load this message in the networking platform