Lotus Notes - lotusscript:shell函数:非法函数调用

时间:2013-09-03 09:06:18

标签: shell lotus-notes

我有一个问题:我想从lotusscript代码运行一个文件:

    Dim result As Integer
    result = Shell("D:\testF.dsx", 1)

我收到以下错误:非法函数调用。

如果我想从公式执行它,它可以工作:

@Command([Execute];“D:\\ testF.dsx”)

非常感谢!

3 个答案:

答案 0 :(得分:3)

我的Lotus脚本中的shell函数与PDF文件有同样的问题。我的解决方法是使用Windows脚本主机来启动该文件。我很确定这也可以解决你的问题。

Set objShell = CreateObject("WScript.Shell")
returnValue = objShell.Run("d:\testF.dsx", 3, false)enter code here

答案 1 :(得分:1)

无法“执行”文本文件。通常没有为dsx文件定义“运行”功能。

你可以这样做:

Dim result as Integer
result = Shell("notepad.exe D:\testF.dsx", 1)

或者找出哪个程序链接到dsx(通过注册表)并执行相应的exe文件名作为参数。如果文件名包含空格,则必须将其括起来:

Dim result as Integer
result = Shell({notepad.exe "D:\testF.dsx"}, 1)

并确保阅读last question这种方法不适合您的要求。您必须使用“打开”才能处理文件......就像Per Hendrik在回复中告诉您的那样。

答案 2 :(得分:0)

我将参数传递给Outlook时遇到了类似的问题。 在某些Windows机器上,这个@Formula工作得很好:

@Command([Execute]; "Outlook.exe"; "/recycle")

在Windows终端服务器上,它导致Outlook无法解析“/ recycle” LotusScript的Shell命令甚至无法找到Outlook.exe,因为它不在PATH中。

拉尔夫的代码在这方面帮助了我。 “WScript.Shell”似乎能够与Windows注册表设置进行交互。无论如何,这是用于激活打开的Outlook窗口的代码。

Dim objShell, returnValue
Set objShell = CreateObject("WScript.Shell")
returnValue = objShell.Run("outlook.exe /recycle", 3, False)