See
Re: How to tell when printing to file is finished? Thread #
847854.
If your scanning program closes when it's done, you can use WSH run method to launch it and wait for it completition.
>I have a scanning program, after scanning the file i change that scanned file's(tiff file) attribute to read only.
>
>but the problem is before the scanning job is finished, my program is trying to check wether the file exists or not at the location to change it file attribute to read only.
>
>Can you please tell me how i can make my program wait until the sccaning of the document is finished and that file(tiff) exists at the location, then go and change its file attribute to read only.
>
>###################################
>
>cFileName = "C:\ScanTool\twaincom.exe"
>
>cDir = "C:\ScanTool\"
>
>cParams= "C:\ScanTool\test.tiff -n -o -paperformatusletter -feederon -monochrome -r 200 -multipagetiff"
>
>ShellExecute(0,"Open",cFileName,cParams,cDir,1)
>clear dlls
>
>&&Before it created the tif file my program is checking the following:
>&&How can i make my program wait until the scanning is done and file(test.tif) exists at the &&location, then do the check and change the attribute to READ ONLY
>
>IF FILE("C:\ScanTool\test.tif") THEN
> oFSO = CREATEOBJECT("Scripting.FileSystemObject")
> oFile = oFSO.GetFile("C:\ScanTool\test.tif")
> * Set the read-only bit.
> oFile.Attributes = BITOR(oFile.Attributes, 1)
>ENDIF
>
>###############################################
>
>Please let me know how i can do the above criteria.
>Thank you very much.
--sb--