Discussion:
Waiting Firefox terminate
(too old to reply)
Dudule
2016-04-23 08:44:50 UTC
Permalink
Hello,
I want to execute some VBS before starting Firefox and after it terminates.
I tried the following two examples:
1=======================
Dim WshShell, oExec
Set WshShell = CreateObject("WScript.Shell")
MsgBox "Hello Start FF"
Set oExec = WshShell.Execstrcmd="C:\Progra~2\Mozill~1\firefox.exe"

Do While oExec.Status = 0
WScript.Sleep 100
Loop
MsgBox "Hello End FF"
=========================
and
2========================
Dim WS, strcmd
MsgBox "Hello Start FF"
Set WS = Wscript.CreateObject("Wscript.Shell")
strcmd="C:\Progra~2\Mozill~1\firefox.exe"
WS.run strcmd,3,True
MsgBox "Hello End FF"
=========================

But none of the 2 examples works, the message "Hello End FF" is always
displayed before FF shut down...

How to ???
Thanks for any answer...
R.Wieser
2016-04-23 09:32:17 UTC
Permalink
Dudule,

Have you already looked at the "run" command ? It has a flag which causes it
to wait for the executed program to terminate.

https://msdn.microsoft.com/en-us/library/d5fk67ky(v=vs.84).aspx

Regards,
Rudy Wieser
Post by Dudule
Hello,
I want to execute some VBS before starting Firefox and after it terminates.
1=======================
Dim WshShell, oExec
Set WshShell = CreateObject("WScript.Shell")
MsgBox "Hello Start FF"
Set oExec = WshShell.Execstrcmd="C:\Progra~2\Mozill~1\firefox.exe"
Do While oExec.Status = 0
WScript.Sleep 100
Loop
MsgBox "Hello End FF"
=========================
and
2========================
Dim WS, strcmd
MsgBox "Hello Start FF"
Set WS = Wscript.CreateObject("Wscript.Shell")
strcmd="C:\Progra~2\Mozill~1\firefox.exe"
WS.run strcmd,3,True
MsgBox "Hello End FF"
=========================
But none of the 2 examples works, the message "Hello End FF" is always
displayed before FF shut down...
How to ???
Thanks for any answer...
R.Wieser
2016-04-23 10:29:37 UTC
Permalink
Dudule,
Post by R.Wieser
Have you already looked at the "run" command ? It has a flag
which causes it to wait for the executed program to terminate.
Whoops!, you already tried that ...

It looks like the FF executable is just a bootstrapper, executing something
else. That means that waiting like the "run" command does simply won't do
what you expect from it (as you already found out).

The problem is that you can't (at least not using VBScript) "reach thru" to
the bootstrapped program and wait for it.

In other words, what you want to do does not seem to be possible.

Regards,
Rudy Wieser
Dudule
2016-04-27 14:09:21 UTC
Permalink
"R.Wieser" a écrit dans le message de groupe de discussion :
571b4e5b$0$5836$***@news.xs4all.nl...

Dudule,
Post by R.Wieser
Have you already looked at the "run" command ? It has a flag
which causes it to wait for the executed program to terminate.
Whoops!, you already tried that ...

It looks like the FF executable is just a bootstrapper, executing something
else. That means that waiting like the "run" command does simply won't do
what you expect from it (as you already found out).

The problem is that you can't (at least not using VBScript) "reach thru" to
the bootstrapped program and wait for it.

In other words, what you want to do does not seem to be possible.

Regards,
Rudy Wieser

Hello,
Thanks for your answer
I found one solution using VBS:
Check if the Firefox process is running or not.....(via a function)
Regards
@+

Loading...