Jump to content
Sign in to follow this  
Tostones

Firefox and ProcessClose through Process ID

Recommended Posts

Tostones

Does anyone know how to close a Firefox window through a ProcessID? I'm having trouble using ProcessClose($pID). $pID is retrieved through running Firefox on the run command.

Edited by Tostones

Share this post


Link to post
Share on other sites
PsaltyDS

Does anyone know how to close a Firefox window through a ProcessID? I'm having trouble using ProcessClose($pID). $pID is retrieved through running Firefox on the run command.

Get the window handle instead and use WinClose().

The process ID for Firefox.exe only continues for the first instance run. The second, third, etc., time you run Firefox the new instance only exits long enough to tell the first instance to open another window. This takes milliseconds, and then the new process ends, leaving the first one with an additional window. The new PID doesn't exist very long, and if you kill the first one, it closes ALL the Firefox windows.

You can safely close individual Firefox windows without hurting others. The most reliable way is by the handle.

muttley


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
Tostones

Get the window handle instead and use WinClose().

The process ID for Firefox.exe only continues for the first instance run. The second, third, etc., time you run Firefox the new instance only exits long enough to tell the first instance to open another window. This takes milliseconds, and then the new process ends, leaving the first one with an additional window. The new PID doesn't exist very long, and if you kill the first one, it closes ALL the Firefox windows.

You can safely close individual Firefox windows without hurting others. The most reliable way is by the handle.

muttley

Thanks, I tried it via handle and it works.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.