1
votes

I have a problem: I want to run a file from lotusscript code:

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

And I get the following error: Illegal function call.

If I want to execute it from formula it works:

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

Thanks a lot!

3

3 Answers

1
votes

It is not possible to "Execute" a Textfile. usually there is no "run" function defined for dsx- files.

You could do it like:

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

Or find out, which program is linked to dsx (via registry) and execute the corresponding exe with filename as Parameter. If the filename contains spaces, then it has to be enclosed:

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

And reading your last question this approach for sure is NOT the right for your request. You have to use "open" in order to process files... Like Per Hendrik told you in his response.

3
votes

I had the same problem with the shell function in lotus script with PDF files. And my workaround is to use the windows scripting host to launch the file. I am pretty sure this will solve your problem too.

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

I had similar problems passing parameters to Outlook. On some windows machines, this @Formula worked perfectly:

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

On Windows Terminal Servers, it caused Outlook to be unable to parse the "/recycle" The Shell-command from LotusScript wasn't even able to locate the Outlook.exe, as it was not in the PATH.

Ralf's code helped me in this respect. The "WScript.Shell" seems able to interact with Windows registry settings. Anyway, here is the code that works for activating an open Outlook window.

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