For those who don't want to take the time to write any code, here is a very simple and effective close all and auto eject.
You will need the great little app "Command line process utility" available from here (scroll to near bottom of page for .zip dl):
http://www.beyondlogic.org/consulting/processutil/processutil.htm
Put it in its own folder in your PortableApps folder. Now open a text editor (Notepad) and type in the processes you want to close, in the following format: [note: "-k"=kill / "-q"=close]
"E:\PortableApps\CMDLprocess_utility\Process.exe" -k winamp.exe
"E:\PortableApps\CMDLprocess_utility\Process.exe" -q KeePass.exe
"E:\PortableApps\CMDLprocess_utility\Process.exe" -k KeePass.exe
"E:\PortableApps\CMDLprocess_utility\Process.exe" -k Launchy.exe
"E:\PortableApps\CMDLprocess_utility\Process.exe" -k Convey.exe
"E:\PortableApps\CMDLprocess_utility\Process.exe" -k cm2.exe
"E:\PortableApps\CMDLprocess_utility\Process.exe" -q SyncBack.exe
"E:\PortableApps\CMDLprocess_utility\Process.exe" -k FIREFOX.exe
Once you have all the .exe's listed you normally are running and want to close in the above format, save the file with a .bat extension and save it in the same folder as the Process.exe. I called mine "kill_all.bat". You can add exe's to it anytime by opening and editing it in Notepad.
Then set PStart (or whatever) to run your .bat (ie: "kill_all.bat") on close. Presto, closes all the programs you want on exit.
I also set the eject shortcut "%windir%\system32\RunDll32.exe shell32.dll,Control_RunDLL hotplug.dll" to autorun on exit. So the eject dialog is ready to go once the .bat is done.
Two notes; One, make sure your drive is not being written to when you run the .bat. Two, if you try "-q" close a process that doesn't respond, Process.exe will take 60 seconds before it kills the process which is annoying.
Therefore, I see no reason not to kill all the processes as long the drive is not being written to. I've done this for months and haven't lost 1 byte of data.
I use PStart and run ejectscript on exit, but rainlendar and mIRC don't close with this... I'll try this one...
Thanks!
If a packet hits a pocket on a socket on a port,
and the bus is interrupted as a very last resort,
and the address of the memory makes your floppy disk abort,
then the socket packet pocket has an error to report
Therefore, I see no reason not to kill all the processes as long the drive is not being written to. I've done this for months and haven't lost 1 byte of data.
Wrong! You won't lose any data already written to disk, but most applications save data at close. If you kill them, they won't save that data, and that data will be lost. Let the programs close like they're supposed to. You also didn't take into account handles from programs not on the drive on files that are. And the little light on the drive will not be on just because of an open handle.
Vintage!
explorer.exe is the most notorious one for keeping a handle open on the files.
"If you're not part of the solution, you're part of the precipitate."
Also, I'd like to add that Process Explorer is an excellent tool for finding and closing open handles.
Vintage!
True, some caution should be used... I only use this method on programs that don't save with a prompt at close. Or programs where you've saved settings.
Firefox- just make sure you're not writing to the drive with a bookmark.
PIM- helps if they auto-backup constantly like ChaosManager or KeePass
Basically, go through your list of close/kill programs and know how they will react to this process.
My windows eject goes through 95% of the time and the whole process takes about 4 seconds. The 5% of the time is usually some MS related BS.
CloseAll from http://www.ntwind.com/software/utilities/close-all.html seems to be pretty well-behaved. It doesn't force things, just behaves as if you had clicked on the X. Seems to leave things running in the notification tray though.
For programs that don't respond, you can use Process Explorer.
MC
Seems to leave things running in the notification tray though.
Things in the tray don't have windows.
Vintage!
is there a program that will close programs on the system tray (mainly Miranda IM)
with out forcing it to quit?
Please search before posting. ~Thanks
Yeah. The program in the OP (-q switch) should work fine.
Vintage!
wat is it?
Please search before posting. ~Thanks
OP either means Original Post or Original Poster (In this case, the former).
"If you're not part of the solution, you're part of the precipitate."
My McAfee detected this as a threat and removed it. This program might not be what it says it is.
Is there a program for this (the best scripting I know is JavaScript)
Insert original signature here with Greasemonkey Script.
is there a way for this to be incorporated in a future release of the PortableApp menu?
i.e. when you hit the X to close the menu program in bottom right corner, it could trigger the closing of all portable programs listed on its menu. if you install a new portable app, when you hit the refresh program list, could it check to see what new programs are on there & auto-add to the command? or in options, give it a kill / close option (or manual edit)
might slow down the process a little when exiting, but still work & makes sure you won't accidentally eject in the middle of something
This may or may not be feasible, but I think it would be a better idea to simply add support for a switch such as "/close" or "/quit" to each launcher. Then, if you use PStart or something similar, you could make PA platform each launcher close its corresponding application correctly.
Also, if something like that is possible, it would also be relatively easy to make the PA menu simply run each PA.com-formatted launcher with the appropriate switch when you exit the menu. To make it a bit more efficient, the menu could use an array or even an ASCII file to keep track of which PA.com launchers were executed from the menu during the active session. That way, the menu would only attempt to close programs that were active at some point, rather than everything in the menu.
It might also be possible to make the menu keep track of which PA.com-formatted applications are actually running, which could make it even more efficient. I'm no expert programmer, but I think that might be a bit easier if the menu knew exactly what the process name of the actual application (not the launcher) was. If that would be too hard for the menu to somehow detect, another key could be added to the AppInfo file for each PA application which would contain the process name.
Just some things to think about.
Her song leaves the other side in flight for their lives now;
They are not long for the world.
No one leaves; line up for inevitable wipeout.
All you've done - now it's what you deserve.
Machinae Supremacy ~ Laser Speed Force
I'm glad I found this... I suffered a unrecoverable RAID failure AND a USB death on the same night. Talk about bad luck!
So I get to spend the next couple days rebuilding my drive. Oh well... this will force me to slim down the drive, getting rid of those Apps I never use.