Archived Boards > Network Extenders

How to close an open file from WB script?

(1/2) > >>

Remind me which functions to use to do this.

I have a WB script that opens a log file periodically to append info.  Normally, it works fine, but it failed today (with error 32) because I had accessed the file from another machine (via Windows Networking).  The other machine had long since closed the file, of course, but Windows Networking keeps it open long after the other machine has closed out of the app.

I can fix the problem by going into compmgmt.msc and closing the open file.  But I would like to do that programmatically - when the open fails, I'd like to invoke whatever's necessary to close the file. I could, of course, do it by automating the compmgmt.msc GUI, but it'd be better to do it with the Network Extender.

Give 'wntFileClose' a try.


--- Quote from: td on October 31, 2014, 07:53:58 am ---Give 'wntFileClose' a try.

--- End quote ---

Yeah, that looks like it will do it.

BTW, can't help but nitpick this line from the "help" for that function.
Looks like badly translated "not quite English":

Note: this function will not work to do a wntFileClose on a local file that was opened by yourself on the local machine, even if it's done over a mapped drive with a UNC.

It does read a bit like the user manual to that made in Guangzhou whatever you just bought at MalWart. Although the I am pretty sure the author considers English a first language.   

Heh heh.

MalWart - gotta love it!


[0] Message Index

[#] Next page

Go to full version