This vb code will check to see if the file is open. 
 
Function IsFileLocked(ByVal Filename As String) As Boolean
'dont stop if the error occurs
On Error Resume Next
 
Filename = "C:\Testfile.txt"
'if the file is locked, next operation fails
Open Filename For Binary Access Read Write Lock Read Write As #1
 
'close the file when it could be opened
Close #1
 
'opening the file failed, so it was locked
If Err.Number <> 0 Then
IsFileLocked = True
MsgBox "File Open"
Err.Clear
Else
IsFileLocked = False
MsgBox "File Closed"
End If
End Function
 
'Then test if the file is locked until it is free with
 
'While IsFileLocked(filename)
'use a sleep function here to wait a while, like a second or so
'Wend


________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 03, 2008 3:07 PM
To: [email protected]
Subject: [talkbws] Issue getting file too soon.......


To All,
I have a customer concerned that a file might not be finished building
when the BWS goes to pick it up.  
 
Here's the scenario:
A Handheld device is entering stock items/quantities and creates a file.
(Don't know the exact
scenario/timing of how file gets to the folder)
 
The BWS script is going to be running and checking for this file to
exist.
 
The file will then be uploaded into the Meditech MM Floors Inventory.
 
So the question is, can BWS tell if a file is done building?  
Donna Ledgerwood
Senior Integration Analyst
Micro Star  
Home Office: 315-536-0834
Cell:  315-729-3804
Fax: 315-536-7338
EMAIL: [EMAIL PROTECTED] 
--- 
To post a message to this list, send mail to: [email protected] 

You are currently subscribed as: [EMAIL PROTECTED] 

Unsubscribe in the customer center on our website:
http://www.bostonworkstation.com/customer_center/virtual_user_group_talk
.aspx 



---
To post a message to this list, send mail to: [email protected]

You are currently subscribed as: [EMAIL PROTECTED]

Unsubscribe in the customer center on our website: 
http://www.bostonworkstation.com/customer_center/virtual_user_group_talk.aspx

Reply via email to