Welcome Guest.   Make a donation to an author on the site October 21, 2014, 02:58:33 PM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
Your Support Funds this Site: View the Supporter Yearbook.
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1] 2 Next   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: DONE: Gracefully close Firefox on PC exit  (Read 24226 times)
Curt
Supporting Member
**
Posts: 6,338

see users location on a map View Profile Give some DonationCredits to this forum member
« on: March 15, 2008, 07:11:52 AM »

I will almost "always" forget to close Firefox before I close my XP, so at the next boot it will ask if I want to restore session or not. I find this annoying, because I have Firefox placed in Start > Minimized   for the very reason that I do not want to see it before I need to use it.


IDEA: an app' that will use every XP shutdown / reboot to...
- immediately but gracefully auto-close any Firefox before it is terminated by force!

Please?  tellme

I use various programs to shut down XP.

Edited:
Windows will in general close most of the programs in the very same order in which they were started, and because my starting point of Firefox is delayed, so the closing of Firefox will also be delayed, giving enough time for some spy to react and gently close the fox - I would guess.
« Last Edit: March 15, 2008, 07:28:33 AM by Curt » Logged
nosh
Supporting Member
**
Posts: 1,388


View Profile Give some DonationCredits to this forum member
« Reply #1 on: March 15, 2008, 07:50:52 AM »

Nice idea. A simple Autohotkey script that closes FF (through its menu system), used in conjunction with something like Xecutor should suffice.
Logged
AndyM
Charter Member
***
Posts: 616


see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #2 on: March 15, 2008, 09:01:29 AM »

I see in the Tab Mix Plus configuration dialog box there are two yes/no options:  "Use Firefox's built-in Session Restore feature" and "Enable Session Manager" (Tab-Mix's version).

I wonder if unchecking both boxes would stop the unwanted message on restart (if disabling the whole feature was an acceptable trade-off).

For that matter, if Tab Mix Plus can disable the Session remembering, it probably could be disabled via a change in Firefox's about:config settings. Maybe there's even a setting to keep the feature and just disable the "do you want to restore?" dialog.
Logged
skrommel
Fastest code in the west
Developer
***
Posts: 882



View Profile WWW Give some DonationCredits to this forum member
« Reply #3 on: March 15, 2008, 01:30:49 PM »

 smiley Try CloseToQuit - Close programs before the system shuts down!

Usage: Add the process name, class or a part of the caption of the programs
you want to close to the apps= line. Separate them by commas.
Any spaces or tabs around the delimiting commas are significant,
meaning that they are part of the match string!

Syntax:  apps=[<process name>,<class>,<part of a caption>]

Example: apps=calc.exe,MozillaWindowClass,- Notepad

Skrommel


[copy or print]
;CloseToQuit.ahk
;  Close programs before the system shuts down
;  Usage: Add the process name, class or a part of the caption of the programs
;         you want to close to the apps= line. Separate them by commas.
;         Any spaces or tabs around the delimiting commas are significant,
;         meaning that they are part of the match string!
;  Syntax:  apps=[<process name>,<class>,<part of a caption>]
;  Example: apps=calc.exe,MozillaWindowClass,- Notepad
;Skrommel @ 2008


#NoEnv
#SingleInstance,Force
DetectHiddenWindows,On
SetWinDelay,0
SetBatchLines,-1


apps=calc.exe,MozillaWindowClass,- Notepad


DllCall("kernel32.dll\SetProcessShutdownParameters",UInt,0x4FF,UInt,0)
OnMessage(0x11,"WM_QUERYENDSESSION")
Return


WM_QUERYENDSESSION(wParam,lParam)
{
  Global apps

  Gui,+LastFound
  self:=WinExist()
  WinGet,ids,List,,,Program Manager
  Loop,%ids%
  {
    id:=ids%A_Index%
    If id=%self%
      Continue
    WinGet,process,ProcessName,ahk_id %id%
    WinGetClass,class,ahk_id %id%
    WinGetTitle,title,ahk_id %id%
    If process In %apps%
      WinClose,ahk_id %id%
    Else
    If class In %apps%
      WinClose,ahk_id %id%
    Else
    If title Contains %apps%
      WinClose,ahk_id %id%
  }
  ExitApp
}
Logged

Please stop by my site at  1 Hour Software by skrommel  for downloads and more info.
Curt
Supporting Member
**
Posts: 6,338

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #4 on: March 15, 2008, 02:09:56 PM »

Thanks, AndyM, but restoring sessions can sometimes be important to me, so I don't think I would want to un-check this option. I would rather go for the script nosh is talking about. Only, I have idea how to do something like that myself (and I will not purchase $15 Xecutor) - but I do have AutoHotkey installed.

- So I am still requesting some help on this idea, please.

Quote
Warning - while you were typing a new reply has been posted.

... studying skrommel's answer...

Syntax:  apps=[<process name>,<class>,<part of a caption>]
Example: apps=calc.exe,MozillaWindowClass,- Notepad

Hmm... I got confused because of the example's content. In my case I expect the program's name must be firefox.exe , but should I also type MozillaWindowClass? And what about the third info, 'part of a caption' - what is that in this connection with firefox? Forgive me for asking such childish questions, but I really mean this thing under Homer van Gogh about me being an IT-analphabetic...

Will someone please  make the example talk about Firefox only?  tellme

Other than me knowing nothing I am most grateful for skrommel offering a solution, and for responding so fast.  thumbs up
Logged
skrommel
Fastest code in the west
Developer
***
Posts: 882



View Profile WWW Give some DonationCredits to this forum member
« Reply #5 on: March 15, 2008, 05:24:03 PM »

 smiley You can use CloseToQuit to close a list of apps, with options to close by using the process name, the class name or a part of a window caption.

To close FireFox just use apps=firefox.exe or apps=MozillaWindowClass.

Skrommel
Logged

Please stop by my site at  1 Hour Software by skrommel  for downloads and more info.
Curt
Supporting Member
**
Posts: 6,338

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #6 on: March 15, 2008, 08:01:15 PM »

Many restarts later...:

Something is not all right, because I have not yet been able to make the script work.

Later on I also right-clicked the CloseToQuit.ahk > Compile Script, but when I db'clicked the new exe it said 'exe corrupted'. So something is wrong.

I better ask if this was the right formula: apps=firefox.exe
- no commas, brackets, or anything?

---
I have no idea what such a script should tell, but I am surprised that logonui.exe not is mentioned in the script, because I can see in my taskmanager that logonui is the one handling the XP shutdown. Please forgive me for even saying so.
Logged
Curt
Supporting Member
**
Posts: 6,338

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #7 on: March 29, 2008, 06:12:04 PM »

bumping...

... I have not yet been able to make the script work.


Maybe I did something else wrong?
- maybe I need the idiot's guide on how to create and to use CloseToQuit ?
 tellme
Logged
nosh
Supporting Member
**
Posts: 1,388


View Profile Give some DonationCredits to this forum member
« Reply #8 on: March 30, 2008, 03:24:39 AM »

OK, _total_ AHK novice here but something really simple seems to work for me, the only caveat is you'll have to use it with Xecutor which will intercept the shutdown and run the "script":

Quote
IfWinExist,  ahk_class MozillaUIWindowClass
{
    WinActivate 
    Send {Alt}FX
    return
}

This will activate Firefox if it is running and close it through the menu system. I'm using FF 2.x, not sure what the class name would be if you're using v. 3.x. Try running the script manually to see if it closes FF, then restart. You can assign it as a shutdown command to Xecutor if all goes well. 
 

Edit: Xecutor is postcard-ware for non-commercial use.

« Last Edit: March 30, 2008, 04:27:36 AM by nosh » Logged
Curt
Supporting Member
**
Posts: 6,338

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #9 on: March 30, 2008, 01:26:55 PM »

Thanks a lot, nosh!  thumbs up

Havent tried it yet, though, because I am on a big project, and just have taken up Avant...
but I need to ask if your typing was right - winexist - is it "-exist", not "-exit" or "-exits"?
« Last Edit: March 30, 2008, 01:28:52 PM by Curt » Logged
nosh
Supporting Member
**
Posts: 1,388


View Profile Give some DonationCredits to this forum member
« Reply #10 on: March 30, 2008, 01:31:44 PM »

Yep. IfWinExist = If the Firefox window exists.
The script doesn't have anything to do with exiting Windows, X-ecutor checks for that.
Logged
Curt
Supporting Member
**
Posts: 6,338

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #11 on: March 30, 2008, 05:27:59 PM »

My Firefox 2.0.013 didn't respond to IfWinExist.ahk being doubleclicked.

However, I think you should forget about this little project. I am having a hard time to explain to myself why I am installing and running a program with the sole job to close another program I could easily close myself in the first place.

But thanks a lot, nosh, for trying to help me out!  thumbs up


X-cutor has left the building!
Logged
Curt
Supporting Member
**
Posts: 6,338

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #12 on: March 30, 2008, 05:39:55 PM »

Re-reading the thread, I realize that I have not told all there might be to tell, but I don't know if it makes any difference that my Firefox always is being minimized to sys-tray (Notification Area), never to the taskbar, and that my sys-tray 'is' PS Tray Factory?

I was just wondering why these scripts couldn't find Firefox's window.
Logged
nosh
Supporting Member
**
Posts: 1,388


View Profile Give some DonationCredits to this forum member
« Reply #13 on: March 31, 2008, 01:30:05 AM »

No problem, Curt. This exact problem had been affecting me too but it was something I'd not really bothered doing anything about so far. I wouldn't know for sure about tray minimizing affecting things, I suspect it may have something to do with the window being hidden. I see skrommel's script has the code
DetectHiddenWindows,On
to check for hidden windows too, maybe that's required here... no need to break your head over it though, unless you really need it.
The script didn't work for me at first coz I had the 'File' menu hidden and the menu shortcut to close Firefox [Alt+F+X] wouldn't work till I unhid it.
« Last Edit: March 31, 2008, 01:41:16 AM by nosh » Logged
J-Mac
Supporting Member
**
Posts: 2,867


see users location on a map View Profile Read user's biography. Give some DonationCredits to this forum member
« Reply #14 on: March 22, 2009, 12:14:09 PM »

Sorry to activate an older thread but I figured this would be the best place to ask about CloseToQuit.

There are always a couple of programs that do not respond well to the OS call to quit when restarting the computer. One that has suddenly started to give me fits is Surfulater 3: for the past several days it opens with Windows but throws up a dialog stating that it did not close properly the last time and therefore must recover the last saved copy of the DB I use. Perhaps when I restarted those times it just caught Surfulater at a time when it wasn't ready to close for some reason. I have a few apps that are always sitting in the systray and I let them close with Windows.

It doesn't appear that many folks have commented about CloseToQuit here. Is it working OK? Causing any problems otherwise for anyone? Safe to use?

Thanks!

Jim
Logged

"I am getting so tired of slitting the throats of people who say that I am a violent psychopath."
Curt
Supporting Member
**
Posts: 6,338

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #15 on: March 23, 2009, 08:35:02 AM »

I have not had any of the aforementioned problems since I made the swift to Vista and Firefox 3, so I don't have any use for CloseToQuit. Back then, a year ago, I was never able to make it work with both PS Tray Factory and Firefox 2. However, your situation is a little different, so Edited: I dare to recommend you to at least try CloseToQuit. It will certainly not do your setup any harm.
« Last Edit: March 23, 2009, 05:41:02 PM by Curt » Logged
tomos
Charter Member
***
Posts: 8,605



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #16 on: March 23, 2009, 09:28:29 AM »

There are always a couple of programs that do not respond well to the OS call to quit when restarting the computer. One that has suddenly started to give me fits is Surfulater 3:

Jim - you could probably get that on 'cured' on the Surfulater forum (if you haven't already!)
Logged

Tom
J-Mac
Supporting Member
**
Posts: 2,867


see users location on a map View Profile Read user's biography. Give some DonationCredits to this forum member
« Reply #17 on: March 23, 2009, 03:38:00 PM »

Curt:  I tried it and my machine simply would not reboot at all. Had to force a reboot. I didn't bother trying it again after that.

Tomos: Yep - no reply yet from Neville though. Just posted it a day or so ago.

Thanks!

Jim
Logged

"I am getting so tired of slitting the throats of people who say that I am a violent psychopath."
J-Mac
Supporting Member
**
Posts: 2,867


see users location on a map View Profile Read user's biography. Give some DonationCredits to this forum member
« Reply #18 on: March 24, 2009, 02:01:22 AM »

Tom,

Just an update - Neville replied that he has had reports of this same problem and that upcoming changes in how Surfulater's data is stored - specifically to start using an SQL database - will eliminate the problem.

Jim
Logged

"I am getting so tired of slitting the throats of people who say that I am a violent psychopath."
DyNama
Supporting Member
**
Posts: 62


Are you a good witch or a bad witch?

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #19 on: December 16, 2010, 09:18:51 PM »

again restarting an old thread! but i'd like to ask a question: i have up to 8 windows of a picture viewer program open that i forget to close sometimes when i reboot. it remembers what picture it was on and the directory it was in if closed normally. they all have the program name in the window title: VuePrint - JPG File: [<name of file>]. if i just put Close | VuePrint once in Close2Quit, will it close each of them?
Logged
Curt
Supporting Member
**
Posts: 6,338

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #20 on: December 17, 2010, 07:38:17 AM »

Wellcome at DC, DyNama :-)

I don't think anyone is using Close2Quit, so you will just have to test it, if you dare (I see no reports of success)! Skrommel, the author, is not likely to read this thread. You may want to use apps=VuePrintWindowClass


smiley You can use CloseToQuit to close a list of apps, with options to close by using the process name, the class name or a part of a window caption.

To close FireFox just use apps=firefox.exe or apps=MozillaWindowClass.

Skrommel
Logged
DyNama
Supporting Member
**
Posts: 62


Are you a good witch or a bad witch?

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #21 on: December 18, 2010, 03:52:29 AM »

thanx, Curt! i guess i'll have to try it, because i've always wanted a program that does this. i could have gone ahead and tried it, but 4 reboots ago, my computer shut down and never came back on! it had to be reformatted before the computer booted up again  Sad that's why i asked first, these days i keep my reboots to a minimum.

1 other question, a process manager program i use (ykill) says the class is WindowsVuePrintClass. it also says firefox is MozillaUIWindowClass. i know nothing about Classes, so can i use whatever it says as the name of the Class?
Logged
Curt
Supporting Member
**
Posts: 6,338

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #22 on: December 18, 2010, 04:45:36 AM »

What a terrible experience you have had with your computer.  Sad
Personally I reboot several times a day, so I know things are in order.

I know nothing about Classes either...!!, but apps=WindowsVuePrintClass would most likely be the proper term, assuming YKill knows what it is talking about ;-)

So, I guess you are running Windows XP? YKill is very old! You may want to to try a task manager like Process Explorer from Microsoft's Windows Sysinternals: http://technet.microsoft..../bb896653%28en-us%29.aspx. Many consider it to be The Best freeware task manager.
Logged
DyNama
Supporting Member
**
Posts: 62


Are you a good witch or a bad witch?

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #23 on: December 18, 2010, 11:14:34 PM »

yes, winXP on a 6-1/2 year old Dell laptop. i only use YKill to identify which of the 8 clones i've made of VuePrint i might have open. all windows taskmanager says is vueprint.exe for each. Registered VuePrint hasn't been updated since 2002, a registered disk catalog i use says "copyright 2004", a registered calendar program i use says "copyright 2003", i even still use a DOS text editor that says "copyright 1987" (it sorts text files by column)! i guess i get used to software and keep using it until i want new features. i'm an unemployed AutoCAD draftsman (20 years!) and i did always use the latest version of that program.

but i'll look at Process Explorer. i love little utilities! while here at DC i downloaded not only Close2Quit, but also windows versions of CAPshift, WasteNot, TenTimer, ListNumberer, CutAway, and Files2Folder.
Logged
DyNama
Supporting Member
**
Posts: 62


Are you a good witch or a bad witch?

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #24 on: December 20, 2010, 12:46:54 PM »

by jove, Close2Quit worked! i think i just put "VuePrint" as part of the title of the windows in the windows version of C2Q, there were 4 open when i did a restart, and all 4 must have been closed "normally" because the .ini file of each did know where it left off. when i look at the settings of C2Q now, tho, it says "WindowsVuePrintClass".

is there any problem with having multiple copies of AutoHotKey running? i don't run AHK scripts. i put the windows version of C2Q and CAPshift in my startup.
Logged
Pages: [1] 2 Next   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.043s | Server load: 0.04 ]