What's wrong with this code?

Hi there,

i am trying to launch a program in a sub-directory using Shell function as follows:

Sub Click(Source As Button)

Dim result As Integer	

ExeDir="\\C:\Program Files\IBM\Sametime Connect\"

result=Shell(ExeDir + "sametime.exe", 1)

End Sub

It comes back with ‘Illegal Function Call’ error … It does not matter if i use double or single slash before C (though it takes 5 seconds longer to come back with the error when using double slah before C) or use forward or backward slashes.

Any suggestions on how to get this working?

Thanks for all your help!

Ayaz

Subject: What’s wrong with this code?

Kill both \ before C: and you should be OK.

Subject: RE: What’s wrong with this code?

Thanks for your response Doug …

I tried that but still get the same error …

Ayaz

Subject: RE: What’s wrong with this code?

Can’t help you. I just did a quick test to launch notepad and it worked fine.

Here is my exact code:

Dim ProgPath as String

Dim ProgExe as String

Dim Result as variant

ProgPath = "c:\windows\system32"

ProgExe = “notepad.exe”

result = shell(ProgPath + ProgExe,1)

I even tried it with a program in the ‘Program Files’ directory to verify that the space in the dir name wasn’t a problem and that worked fine too.

Are you sure your path exe names are correct?

Doug

Subject: RE: What’s wrong with this code?

I don’t know either …

Your code for Notepad works for me too …

I copied Sametime.exe to ‘C:\Program Files’ and launched it from there directly - but got some java errors. So i guess it can launch from its own directory only - maybe when i call it from Lotus Script it is not able to make use of other files while Windows is able to … who knows!

Thanks again!

Subject: RE: What’s wrong with this code?

I don’t run Sametime so I’m assuming it’s just like any other exe.

If you open a terminal window, cd to the root, and type in C:\WhateverIsThePath\Sametime.exe, does it run? If it does, then you should be able to use the shell command to launch it.

If not, then how does one normally start Sametime for real? If it only launches as part of the Notes client, different problem and no clue how to launch it separately.

Doug

Subject: RE: What’s wrong with this code?

This code worked for me to launch Sametime from a view button:

Sub Click(Source As Button)

On Error Goto errhand

Dim ProgPath As String

Dim ProgExe As String

Dim Result As Variant





ProgPath = "C:\Program Files\Lotus\Sametime Client\"

ProgExe = "Connect.exe"

result = Shell(ProgPath + ProgExe,1)

Exit Sub

errhand:

Msgbox "error at line " & Erl & ": " & Error

Exit Sub

End Sub

We are still on Sametime 6.5.1; if you’re using the standalone 7 client based on Eclipse it may not work the same way.