--Begin script
Set WSHShell = CreateObject("WScript.Shell")
result = WSHShell.Run("C:\Program
Files\Lotus\Notes\notes.exe",,True)
msgbox "Thanks for waiting"
--End script
The script does not wait until notes.exe is finished.
Instead: notes.exe is starting up. So far so good.
Notes.exe is asking to login. Now the script is running
futher and shows the messagebox. Meanwhile, Notes.exe is
still running.
If I try it with Notepad.exe it works fine.
Does anybody know how to fix my problem ???
Many thanks,
Rony
Ray at work
"Rony crijns" <anon...@discussions.microsoft.com> wrote in message
news:06d201c3da76$06c166c0$a501...@phx.gbl...
> In my VBScript I want to run an EXE. If the EXE is
> finished the script should run futher. Problem now is when
> I use the following code:
>
> Set WSHShell = CreateObject("WScript.Shell")
> result = WSHShell.Run("C:\Program
> Files\Lotus\Notes\notes.exe",,True)
> msgbox "Thanks for waiting"
>
> The script does not wait until notes.exe is finished.
> Instead: notes.exe is starting up. So far so good.
> Notes.exe is asking to login. Now the script is running
> futher and shows the messagebox. Meanwhile, Notes.exe is
> still running.
Hi
You Run statement is correct, having True as the third parameter. The problem
is with Notes.exe and how it behaves.
If you look in the Process list in Task Manager after Notes is started up, you
will not find Notes.exe, but Nlnotes.exe.
When you start Notes.exe, it does a couple of things, and then it starts
Nlnotes.exe and terminates.
What Is the Difference Between Notes.exe and Nlnotes.exe?
http://www-1.ibm.com/support/docview.wss?uid=swg21092749
<quote>
What is the difference in function between the two executable files, Notes.exe
and Nlnotes.exe? Both of these files are located in the Notes program
directory.
Notes.exe does the following three main things, then calls Nlnotes.exe:
- it displays the splash screen
- checks to see if Notes is already running (and aborts if so)
- loads Qnc.exe if you have it configured to do so.
So, if you load Nlnotes.exe or create a shortcut directly to Nlnotes.exe you
don't have to wait for the splash screen. You can run multiple versions of
Notes simultaneously, and avoid loading the debugger.
</quote>
So to fix your problem, you could bypass Notes.exe and start Nlnotes.exe
instead.
But I would not recommend to start two instances of Notes simultaneously, so
you should check if Nlnotes.exe is already running before launching
Nlnotes.exe, e.g. like this:
sComputer = "." ' use "." for local computer
Set oWmi = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& sComputer & "\root\cimv2")
Set colProcessList = oWmi.ExecQuery _
("Select Name from Win32_Process Where Name = 'nlnotes.exe'")
If colProcessList.Count = 0 Then
Set oShell = CreateObject("WScript.Shell")
oShell.Run """C:\Program Files\Lotus\Notes\nlnotes.exe""",,True
MsgBox "Thanks for waiting"
Else
MsgBox "Notes is already running!"
End If
--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter
>.
>