Hi,
I have an agent that opens a tif file using the Shell function. If this file is open on someone else’s machine then when another users tries to open it through the agent, nothing happens. If you manually type in the path in the windows explorer, they get “File is in use by another application, would you like to open it as Read Only Message”. I want one of the two things to happen. 1. Either user should be able to open it even if it is for read only or 2. get some kind of message if it is open already. How do i check if the file is open already?
Here’s the code where ImageFile is: \NYDATA01\IMAGES01\IMAGES\AUDITLETTERS\SIGNEDCOPIES\PSIHOLDINGSMEZZLLC-02072008.TIF
Sub ViewImage( ImageFile )
' Launches imagefile referenced in document, using MS-DOS _START_ command.
'exit if doc is not linked to imagefile
If imageFile = "" Then Goto file_not_found
' set START command depending on OS version
cmd = "start"
platform = Evaluate( "@platform([specific])" )
If platform(0) = "Windows/NT" Then cmd = "cmd /c " + cmd + " " + Chr$(34) + Chr$(34)
cmd = cmd + " "
' enclose path in parentheses, in case there are dir/file names with spaces in between (eg, "bad name.tif")
filePath = Chr$(34) + imageFile + Chr$(34)
Print "Opening " & filePath
x = Shell( cmd + filePath, 2 )
Print
Exit Sub
’ error messages
file_not_found:
Messagebox "There is no image associated with this record.", MB_OK, "Image Not Found"
Exit Sub
End Sub