For years, the following code I wrote has worked to launch Firefox from a script and then perform a set of actions after the user closes it.
/* Launch Firefox and then wait for the user to close it */
var Shell = WScript.CreateObject("Wscript.Shell");
Shell.Run("\"[Firefox Installation Folder]\\firefox.exe\" -profile \"[Firefox Profile Folder]\"", 1, true);
/* After Firefox closes, perform actions... */
The value of "true" at the end of the Shell.Run command previously worked to wait until Firefox had closed. From the docs:
WaitOnReturn
Optional. A boolean value indicating whether the script should wait for the program to finish executing before continuing to the next statement in your script. If set to true, script execution halts until the program finishes, and Run returns any error code returned by the program. If set to false (the default), the Run method returns immediately after starting the program, automatically returning 0 (not to be interpreted as an error code).
For some reason, starting in Firefox 68.0, this no longer works. Firefox runs just fine, but the above script fragment continues to progress as if the user has closed Firefox (even though they have not).
What is causing this, and how can it be fixed?
I need to run several commands after Firefox has been closed by the user, but not while it is running. How can this be done?