You are here

A suggested feature for the launchers...

13 posts / 0 new
Last post
Riax
Riax's picture
Offline
Last seen: 7 years 6 months ago
Joined: 2007-09-06 14:41
A suggested feature for the launchers...

I'd like a switch to be added that will properly close the app. Specifically, I'd like to see this added to the Thunderbird Portable launcher, but I think it would be a good feature for all launchers.

I'm using SmithTech's Portable Startup Utility (hereafter referred to as PSU) to handle autorun on my flash drive, with PAM and TBP set to launch automatically. I have the MinimizeToTray extension installed in TBP; it launches minimized and sits in the tray when I'm not reading or typing an e-mail. In addition to commands you wish to execute at launch, PSU has the option of running a separate list of commands when PAM is closed as a "cleanup" routine. Now, I really don't think I'd forget to close PAM since I'm using my "PortableApps platform is active" background with the wallpaper switcher, but I sometimes forget to close TBP before attempting to safely remove my drive (which, of course, fails until I do close TBP). This would be one less step I have to take when leaving a PC if the TBP launcher had a switch like "/close" or even just "/x" that would properly close TB. That way, I could just add (for example) "TBP-path\ThunderbirdPortable.exe /x" to PSU's cleanup routine.

I do know of a command-line utility that will end a process, which, if used to kill thunderbird.exe, would cause ThunderbirdPortable.exe to close as well, but that isn't what I'm looking for. Firstly, I don't like killing a process unless it's unresponsive. And second, if TB still happens to be minimized, that little Windows bug that doesn't get rid of the tray icon for a killed process until you move your cursor over it will kick in. (I'm surprised Microsoft still hasn't fixed that in Vista SP1.)

Additionally, though it isn't necessary, using the close switch could trigger a confirmation dialog instead of immediately closing the app. I know there are probably people out there who wouldn't like it if a single command line could be used to close an app without some kind of confirmation from the user.

Oh, and if the TBP launcher (or others) already has a close switch of some sort, I'm sorry for reposting the suggestion. However, I did a fair bit of searching and couldn't find any evidence that such a feature existed, nor that it had been requested before.

mjcarman
Offline
Last seen: 11 years 10 months ago
Joined: 2006-07-27 17:05
Killing can be okay

Using a "kill" utility isn't necessarily a bad thing. You can send SIG_TERM to ask an application to exit normally. (That is, as if you had pressed the close button.) What you send to a unresponsive application is SIG_KILL. (This is like choosing "End Task" in Task Manager.) I have an eject script on my drive that calls taskkill for the applications that start automatically when I insert my drive.

3D1T0R
3D1T0R's picture
Offline
Last seen: 1 year 4 months ago
Developer
Joined: 2006-12-29 23:48
2 Probs
  1. You can't send the sig_term or sig_kill to ThunderbirdbirdPortable.exe or your tbird will still be open and the launcher wont will leave junk on host machine.
  2. How do you send sig_term to an application?

~3D1T0R

Bruce Pascoe
Offline
Last seen: 10 years 11 months ago
Joined: 2006-01-15 16:14
...

Don't know about #2, but for #1, you don't kill the launcher--you kill the app itself. Then the launcher will still be running and can clean up after itself.

Riax
Riax's picture
Offline
Last seen: 7 years 6 months ago
Joined: 2007-09-06 14:41
You guys are missing the point.

I know there are command-line utilities that would able to close and/or kill the process; I have a few. What I want is to be able to cut out the middle-man and directly tell TBP to close itself.

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

3D1T0R
3D1T0R's picture
Offline
Last seen: 1 year 4 months ago
Developer
Joined: 2006-12-29 23:48
Unfortunately

I have looked for and been unable to find a way to do this with TBP.
but you would need the switch to be in the APP not the launcher and then sending the switch to the launcher would forward it to APP effectively closing the APP.
I Can't find a way to do this with TB.

~3D1T0R

SmithTech
SmithTech's picture
Offline
Last seen: 8 months 1 week ago
Developer
Joined: 2006-11-24 18:06
Most apps don't support this

Unfortunately you will find that most apps don't support an "exit" or "close" argument as they are primarily desktop apps made to work portably and there is no need for such an argument on a desktop app.
Windows closes application when it shuts down by calling WM_Close, your best bet is to find a command line utility that will use the WM_Close to close the app in question and add it to the run on exit option in the Portable Startup Utility.
I found one Here by googling "close program utility" haven't tried it, but the documentation indicates it should work for what you want.

"Because they stand on a wall and say, 'Nothing is going to hurt you tonight. Not on my watch.'" (A Few Good Men)
Coincidence is God's way of remaining anonymous.(Albert Einstein)

3D1T0R
3D1T0R's picture
Offline
Last seen: 1 year 4 months ago
Developer
Joined: 2006-12-29 23:48
Thanx

Just tried it. It looked like it would work (and it kind of does,) but its weird, it closed the window then it waited 1 minute then closed the program, THAT confused me.
            [EDIT] have you tried using "Portable Start Menu" at http://www.aignes.com/psmenu.htm it has a cool eject feature that if it cant close a program it will tell you about it.

~3D1T0R

Riax
Riax's picture
Offline
Last seen: 7 years 6 months ago
Joined: 2007-09-06 14:41
Actually, that's one of the

Actually, that's one of the utilities I already have. It sort of works, but if Thunderbird is minimized when I execute "process -q thunderbird.exe", its tray icon remains until I hover the mouse cursor over it, leading me to the conclusion that the utility doesn't actually send WM_Close, but rather just terminates the process, which is what the utility claims to do if you use the "-k" switch. Pardon

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

wraithdu
Offline
Last seen: 9 years 6 months ago
Developer
Joined: 2007-06-27 20:22
Check out my ProcFunc header

Check out my ProcFunc header (in this forum). I've got a CloseProcess function that does just what is suggested, sends WM_CLOSE to all process owned windows.

Let me know if it works for you (worked very well on RoboForm2Go for me).

You might want to wait a little later today, I've got a pretty major rewrite going on that I'll release soon. But the function is going to stay the same if you want to test it out ahead of time.

3D1T0R
3D1T0R's picture
Offline
Last seen: 1 year 4 months ago
Developer
Joined: 2006-12-29 23:48
¿problem?

if it sends WM_CLOSE to all process owned windows than will it work when the windows have all been hidden and the APP has been sent to tray?
       (maybe we could go back to the "SIG_TERM " idea?)
 

~3D1T0R

wraithdu
Offline
Last seen: 9 years 6 months ago
Developer
Joined: 2007-06-27 20:22
You'll have to try, but it

You'll have to try, but it worked for me with RoboForm2Go (no visible windows, only tray icon).

Riax
Riax's picture
Offline
Last seen: 7 years 6 months ago
Joined: 2007-09-06 14:41
Came up with a solution.

If I just remember not to close Thunderbird before PAM, a very short batch file I wrote seems to work and doesn't leave a tray icon, since it restores TB from the tray before telling it to close. I've given it a few cosmetic tweaks for my purposes, but here's the guts of it.

REM    Set CWD to root of drive
cd \
REM    Restore TB from tray
PortableApps\ThunderbirdPortable\ThunderbirdPortable.exe
REM    Wait 2 seconds before telling TB to quit
ping /n 1 /w 2000 192.168.0.0>nul
REM    Give TB 4 seconds to quit, and terminate if still running.
process.exe /q thunderbird.exe 4>nul

I've been using this for a few days, in which time it's probably been executed umpteen-dozen times as I move about campus. I haven't lost any data in TB or run into any other problems. (Knock on wood.)

EDIT: The process utility I'm using (process.exe in the batch file example) is the one SmithTech mentioned above.

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

Log in or register to post comments