运行和关闭后终止文件(Kill a file after running & closing)

在我的lotusscripy中我创建了一个外部文件,我在其中“打印”了一些行,我关闭它然后用Shell函数运行它:

Open "D:\testF.dsx" For Output As fileNum% Print #fileNum%, "line1" Print #fileNum%, "line2" Print #fileNum%, "line3" Close fileNum% result = Shell(|path "D:\testF.dsx"|, 1)

shell函数工作正常,它正在运行的文件。

在此之后我就放了

Kill fileNum% 'which should delete the file

另外,我试图添加

Sleep 2 'before the Kill statement but I get the same error: Path/file access error.

谢谢你的时间!

我的脚本的另一个替代方法是清除文件中的所有文本=>所以文件将为空。

In my lotusscripy I create an external file, I "print" some lines in it, I close it and then I run it with the Shell function:

Open "D:\testF.dsx" For Output As fileNum% Print #fileNum%, "line1" Print #fileNum%, "line2" Print #fileNum%, "line3" Close fileNum% result = Shell(|path "D:\testF.dsx"|, 1)

The shell function works fine, the file it's running.

After this I just put

Kill fileNum% 'which should delete the file

Also, I've tried to add

Sleep 2 'before the Kill statement but I get the same error: Path/file access error.

Thanks for your time!

Another alternative for my script will be to clear all text from the file => so the file will be empty.

最满意答案

Lotusscript kill语句需要文件名而不是文件num。 所以,请改为:

Kill "D:\testF.dsx"

The Lotusscript kill statement expects a filename and not a file num. So do this instead:

Kill "D:\testF.dsx"运行和关闭后终止文件(Kill a file after running & closing)

在我的lotusscripy中我创建了一个外部文件,我在其中“打印”了一些行,我关闭它然后用Shell函数运行它:

Open "D:\testF.dsx" For Output As fileNum% Print #fileNum%, "line1" Print #fileNum%, "line2" Print #fileNum%, "line3" Close fileNum% result = Shell(|path "D:\testF.dsx"|, 1)

shell函数工作正常,它正在运行的文件。

在此之后我就放了

Kill fileNum% 'which should delete the file

另外,我试图添加

Sleep 2 'before the Kill statement but I get the same error: Path/file access error.

谢谢你的时间!

我的脚本的另一个替代方法是清除文件中的所有文本=>所以文件将为空。

In my lotusscripy I create an external file, I "print" some lines in it, I close it and then I run it with the Shell function:

Open "D:\testF.dsx" For Output As fileNum% Print #fileNum%, "line1" Print #fileNum%, "line2" Print #fileNum%, "line3" Close fileNum% result = Shell(|path "D:\testF.dsx"|, 1)

The shell function works fine, the file it's running.

After this I just put

Kill fileNum% 'which should delete the file

Also, I've tried to add

Sleep 2 'before the Kill statement but I get the same error: Path/file access error.

Thanks for your time!

Another alternative for my script will be to clear all text from the file => so the file will be empty.

最满意答案

Lotusscript kill语句需要文件名而不是文件num。 所以,请改为:

Kill "D:\testF.dsx"

The Lotusscript kill statement expects a filename and not a file num. So do this instead:

Kill "D:\testF.dsx"