Open TIF files through lotus script

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

Subject: RE: Open TIF files through lotus script

Did you check the value of X after the Shell call?

Subject: RE: Open TIF files through lotus script

yes, it returns 33 in both cases. The only diff is that is it is not open anywhere else then it will open it in the Microsoft Office Document Imaging and if it is open else where then it won’t do anything but in the debug I do see 33 returned.

Any suggestions? Any other ways to open? or even if there is a way to find out that it’s open and then can msgbox the user to say it is open already and if they would like to open it in read mode only?

thanks for all your help…

sonal

Subject: RE: Open TIF files through lotus script

I suppose you could try opening the file with a NotesStream, or open it for append with the Open statement – one of those might get an error if there’s a sharing violation.

Or you could just not let anyone open it, but always create a copy in the user’s local temp directory.

Subject: RE: Open TIF files through lotus script

Hi,Do you have any sample code with either of the approach below?

thanks-