Solved Make Task Scheduler run a program after another closes?

I have done the above bat file to change the active power scheme because with some programs the pc would go into standby.

Essentially you can put any number of programs one under the other by copying the 3 lines in tasklist. If *any* of the programs is running it goes to : progon and with powercfg -setactive you select an "always on" power scheme. When none of the programs are running, it goes to : progoff and runs another powercfg -setactive which resets the balanced power scheme with standby timers etc.

You put it into a task and run it every 10 minutes with system privileges so nothing shows to the user, no cmd popups etc...

Now to the question in hand. I'm tired of FF going bust at some point and losing my tabs where there is unfinished work, things to read etc. I want to run a batch file that everytime FF closes to back up sessionstore.js in FF profiles.

The batch is ready, however I need to know when FF closes and after maybe 5 seconds run the batch file *only once* - that's why the above method doesn't work....

Anyways aparently there;s a FF plugin that does this; it's called session manager. I just installed it; am not sure whether it works or not...
 

My Computer

Computer Manufacturer/Model Number
EVGA 780i (132-CK-NF78-A2)
OS
Win7 x64
CPU
E6750 [email protected] OC
Motherboard
EVGA 780i (132-CK-NF78-A2)
Memory
6GB Crucial Balistix 800
Graphics Card(s)
2 X GTX460 SLI OC@849,2000
Sound Card
Audigy 2 (Creative is evil)
Monitor(s) Displays
65" Sony TV
Screen Resolution
1920X1080
Hard Drives
3X150 raptors @ Raid0
PSU
Corsair 850
Cmdow?

Now to the question in hand. I'm tired of FF going bust at some point and losing my tabs where there is unfinished work, things to read etc. I want to run a batch file that everytime FF closes to back up sessionstore.js in FF profiles.

The batch is ready, however I need to know when FF closes and after maybe 5 seconds run the batch file *only once* - that's why the above method doesn't work....

Anyways aparently there;s a FF plugin that does this; it's called session manager. I just installed it; am not sure whether it works or not...

When that FF problem occurs on my PC, FF doesn't close.
I can tell this, because the confirmation box in my script doesn't appear (it's waiting for FF to shutdown).
Killing FF, destroys my session (>95% of the time).
In my case, there would be no shutdown event.

I'm not sure when FF updates the session data (I assume it is during the shutdown).

Have you considered modifying your batch file, so that it backs up the sessionstore.js file at regular intervals?
I just checked my sessionstore.js file and it seems to update when a tab is opened or refreshed.

You'd have to edit the file to add some closing statements.
Copy the file before you start FF and then start FF and compare the 2 files to see what I mean.

Have you considered modifying your batch file, so that it backs up the sessionstore.js and sessionstore.bak files and then closes FF?
That is to say, use a batch file to close FF.

I found this info (it's from 2007 though)
Cmdow.exe a really excellent command line tool for manipulating windows can do a normal close window command that could be used to cause firefox or any program to shutdown normally.
This would be a preferred method of shuting down firefox from the command line over the brute force kill method. Cmdow is a free program and can be downloaded from various sites. Its home site is in the UK I believe. Just google cmdow and you should be able to find it.
Here are some links:

CMDOW Commandline Window Utility for NT4/2000/XP/2003

cmdow.exe - What is cmdow.exe?
 
Last edited:

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
n/a
OS
W7 Ultimate SP1, LM19.2 MATE, W10 Home 1703, W10 Pro 1703 VM, #All 64 bit
CPU
AMD Phenom II x6 1100T, 3.3 GHz
Motherboard
ASUS M4A88T-M/USB3 (AM3)
Memory
12GB DDR3 1333 G-Skill (4GB x 2), G-Skill (2GB x 2)
Graphics Card(s)
NVIDIA GeForce GTX 660
Sound Card
Realtek?
Monitor(s) Displays
Samsung S23B350
Screen Resolution
1920x1080
Hard Drives
WD Green 2TB (SATA), WD Green 3TB (SATA), WD Blue 4TB (SATA), WD Blue 6TB (SATA)
PSU
Cooler Master
Case
Antec GX300 Tower
Cooling
3x Antec TRICOOL 120mm Fans
Mouse
Wired Optical
Internet Speed
DSL
Antivirus
Avast
Browser
Pale Moon (64 bit)
Other Info
2018-12-27 Upgraded HDDs
2015-12-10 Upgraded case, graphics card, storage
2015-08-15 Upgraded motherboard & RAM
2015-07-15 Upgraded LM17.1 to LM17.2
Back
Top