close firefox Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
DutchPete

close firefox  Topic is solved

01 Feb 2015, 12:21

I need Firefox to close at a certain time. I have a non-AHK script that is activated at that time, but it is a taskkill script. The effect of taskkill is that when I launch FF afterwards, all my pinned tabs are gone. Is there a "gentler" AHK script to close FF without losing the pinned tabs?
Guest

Re: close firefox

02 Feb 2015, 07:04

Guest wrote:Try with http://ahkscript.org/docs/commands/WinClose.htm - you can use the Task Scheduler run your script http://ahkscript.org/wiki/index.php?tit ... Scheduling
Thank you. This is the command:
WinClose [, WinTitle, WinText, SecondsToWait, ExcludeTitle, ExcludeText]

WinTitle I replace by the word Firefox
Wintext I replace by ? or leave it off? or add something?
SecondsToWait I leave as is, nothing added. Correct?
ExckudeTitle I leave as is, nothing added. Correct?
ExcludeText I leave as is, nothing added. Correct?

Please advise, as I am totally new to AHK.
Guest

Re: close firefox

02 Feb 2015, 09:06

Please read the http://ahkscript.org/docs/Tutorial.htm which also explains how to read the documentation - for WinTitle you can use a variety of options but I would go for WinClose, ahk_exe firefox.exe - more info on the WinTitle parameter here http://ahkscript.org/docs/misc/WinTitle.htm
Guest

Re: close firefox

02 Feb 2015, 09:43

I find the documentation overwhelming, and the explanation on WinTitle totally unhelpful. The same for WinText. I am still not clear about what it means.
Anyway, based on what you answered, my full script now looks like this:

WinClose [, ahk_exe pale moon.exe]. I amended your advice a bit, adding the square brackets as per directions on the WinClose page.

But it still does not work. Something is probably missing or incorrect, but I am at a loss.
Guest

Re: close firefox

02 Feb 2015, 10:19

Sorry, but do take the time to read it - you can learn about the [] in the docs here http://ahkscript.org/docs/Tutorial.htm#s81 so you can ommit these, you CAN use WinText but you DO NOT have to. It is just a additional parameter you can use to make to make it more explicit. And most likely it is palemoon.exe without a space between pale and moon.

You can find the exact name if you use the Window Spy, right click on the AHK tray icon, Window Spy, hover your mouse over the 'firefox' (palemoon) window.
Guest

Re: close firefox

02 Feb 2015, 12:41

I give up on this, can't get it to work. Besides, I just read that it is a forceful way of closing the window, which will probably also close my pinned tabs. An alternative script (according to the Tutorial) is

PostMessage, 0x112, 0xF060,,, WinTitle, WinText ; 0x112 = WM_SYSCOMMAND, 0xF060 = SC_CLOSE

That looks more complicated, and since WinTitle and WinText are not between square brackets, they are compulsory I suppose.
I'll try to work on that one.
DutchPete
Posts: 98
Joined: 03 Feb 2015, 03:59

Close a program gently

03 Feb 2015, 05:04

I need Firefox to close at a certain time, which I use Task Scheduler for. I have a batch script (i.e. non-AHK) that is activated at that time, but it is a taskkill script. The effect of taskkill is that when I launch FF afterwards, all my pinned tabs are gone. Is there a "gentler" AHK script to close FF without losing the pinned tabs? From the WinClose page in the tutorial I understand that this might do it:

PostMessage, 0x112, 0xF060,,, WinTitle, WinText ; 0x112 = WM_SYSCOMMAND, 0xF060 = SC_CLOSE

Does someone have a script ready that I could customise for my use case?
Guest

Re: close firefox

03 Feb 2015, 16:56

Just for the sake of it I've downloaded palemoon and I can confirm both of these work. Yes I tested it with multiple tabs and they do restore after starting it up again:

WinClose, ahk_exe palemoon.exe and PostMessage, 0x112, 0xF060,,, ahk_exe palemoon.exe

BUT you have to tell Palemoon to do so - Tools, options, general, when palemoon starts: show my windows and tabs from last time AND you have to untick the box "warn me when I close program with tabs" so either of the above two commands will close the program without waiting for confirmation.

If you can't get it to work - sorry, but I've tested it and it works so there must something else going on and I can't help you further - Good luck!
DutchPete
Posts: 98
Joined: 03 Feb 2015, 03:59

Re: close firefox

04 Feb 2015, 11:53

Many thanks for your extensive help. Yes, they both work !!
DutchPete
Posts: 98
Joined: 03 Feb 2015, 03:59

Re: close firefox

22 Feb 2015, 09:07

DutchPete wrote:Many thanks for your extensive help. Yes, they both work !!
Update: they both work indeed when I activate them manually. But when I set Task Scheduler to activate them nothing happens. Can these AHK scripts be activated by the Task Scheduler?

Return to “Ask For Help”

Who is online

Users browsing this forum: badda, coffeered, Epialis, IGRACH, nathan323, rifqii_, Rohwedder and 58 guests