General :  K-Meleon Web Browser Forum
General discussion about K-Meleon 
Restart button ?
Posted by: Arrow
Date: November 13, 2008 06:54PM

Seeing as we have to restart K-M so often for config changes to take effect is it possible to link a "restart" button to some code?

Options: ReplyQuote
Re: Restart button ?
Posted by: desga2
Date: November 13, 2008 08:18PM

Yes you can created a button in toolbar to restart K-Meleon (Exit and Start) with a macro.

K-Meleon in Spanish

Options: ReplyQuote
Re: Restart button ?
Posted by: disrupted
Date: November 13, 2008 10:03PM

check this thread:
http://kmeleonbrowser.org/forum/read.php?1,84529

the autoit script has been updated though to this:

;
; AutoIt Version: 3.0
; Language: English
; Platform: Win9x/NT
; Author: yannis kargas
;
; Script Function:
; restart k-meleon
;
#NoTrayIcon

; close km(non-force)
WinClose("[CLASS:KMeleon Browser Window]", "")
WinClose("[CLASS:KMeleon Browser Window]", "")
WinClose("[CLASS:KMeleon Browser Window]", "")
WinClose("[CLASS:KMeleon Browser Window]", "")
WinClose("[CLASS:KMeleon Browser Window]", "")
WinClose("[CLASS:KMeleon Browser Window]", "")
sleep(30)
;fuck you now you must close(force)
ProcessClose("k-meleon.exe",1)


; wait a bit..
sleep(400)

; Run km
Run("G:\applications-x\KMplus\k-meleon.exe")

; Finished!


remeber, you will need to change the path in the macro to your autoit3.exe/and kmrestart.au3and the path in the script to where your kmeleon is installed. if you have problems running the script or macro.. tell me where you have kmeleon installed and i'll compile a custom binary for you

Options: ReplyQuote
Re: Restart button ?
Posted by: disrupted
Date: November 13, 2008 11:05PM

never mind.. just download this:

extract to kmeleon's folder (restart.kmm in macros folder - restartkm.exe in tools folder)

restart kmeleon, click on file menu>new entry>Restart K-meleon


Options: ReplyQuote
Re: Restart button ?
Posted by: Arrow
Date: November 13, 2008 11:54PM

Thanks very much, that's very kind of you.

I did a forum search for "restart" and that thread of yours didn't show up [I've noticed that on quite a few searches recently - I search for old stuff I know is there and it doesn't show in search results using any search option]

However


I get an Autolt Error


Line -1

error: Incorrect number of paramters in function call


When it is working is there a way I can access the function from a toolbar button, because to make it worthwhile in terms of saving clicks when restarting - it needs to be a one click operation?

Options: ReplyQuote
Re: Restart button ?
Posted by: disrupted
Date: November 14, 2008 12:34AM

er.. maybe i uploaded the wrong binary.. i compressed the whole thing again
download it from the same link:


hope it works this time

edit: please tell me if it works or not
edit2: yes i believe you can add a shortcut button to it but i don't know how exactly.. that's desga's specialty


Options: ReplyQuote
Re: Restart button ?
Posted by: desga2
Date: November 14, 2008 04:58AM

@ disrupted: All are in this Documentation.

@ All people:

Download Restart K-Meleon.

-IMPORTANT NOTE:
I don't remember icon original author used (I searched it in google images) and is possible that this have copyright.
This icon must be used only as an example.

Thanks to icon original author for provide us his icon for this example.

K-Meleon in Spanish



Edited 1 time(s). Last edit at 11/14/2008 05:00AM by desga2.

Options: ReplyQuote
Re: Restart button ?
Posted by: Arrow
Date: November 14, 2008 05:32PM

Terrific - That makes experimenting much easier.smiling smiley

Thank you both, disrupted and desga2

Options: ReplyQuote
Re: Restart button ?
Posted by: nico
Date: November 14, 2008 05:52PM

good work thank yousmiling smiley

Options: ReplyQuote
Re: Restart button ?
Posted by: caktus
Date: November 16, 2008 10:55PM

@ disrupted

Thanks for posting that link to that little gem. A real big help.smiling smiley

Charlie

~~If it ain't broke, why screw it up?~~


Options: ReplyQuote
Re: Restart button ?
Posted by: disrupted(unlogged)
Date: November 17, 2008 05:37PM

you're most welcome charlie.
and cheers desga! you're the best smiling smiley .. i didn't realise you've uploaded it with the button and here i am trying to make a decent icon for it.. unsuccessfully, mine was dumb red triangle.


Options: ReplyQuote
Re: Restart button ?
Posted by: desga2
Date: November 17, 2008 08:13PM

OK, i founded again the web site source of my icon:
http://www.tucoo.com/icon/70aqua/index2.htm

In the last line of icons, icon named "45confused smileyyncronize.ico".
I don't know if the icons in this great chinese site (with a lot of beatiful icons) are freedom or have copyright.
Can someone help us to know it?

EDITED:
Quote
www.tucoo.com
Copyright Statement

TUCOO.COM
All contents of this site are from the source site and online forums, copyright belongs to the original author, TUCOO.COM reproduced the picture for everyone to enjoy and share, not for commercial purposes.

K-Meleon in Spanish



Edited 4 time(s). Last edit at 11/18/2008 04:10AM by desga2.

Options: ReplyQuote
Re: Restart button ?
Posted by: caktus
Date: December 09, 2008 07:32AM

Never mind. Reinstalling KM on top of itself has fixed the problem. I just wish I could figure out what it was that I did wrong in the place. :s

@ disrupted

I lost my system to a band of marauding cyber gypsies and had to start everything over from scratch as I did not have recent enough backup. I now have 1.5.1 reinstalled and customized the way I want it however "Restart K-Meleon" is malfunctioning (or perhaps I should just admit I appearantly screwed it up and could use some help.) The button (which I really did not want) has the same problem.

When I click on File > Restart K-Meleon, the browser closes and I get an error that "K-Meleon wasn't closed properly. Do you want to resume your last session? Yes/No." Regardless weather I click Yes or No nothing happens, and I must click on the KM icon to reopen it. Before I reinstalled KM clicking on Restart K-Meleon used to work properly with out closing. Could someone please help me fix this?

I downloaded the .zip from http://two.xthost.info/kmeleon/programas/restartkm.zip. I placed the restart.kmm in the macro folder, the restart.bmp and restart_large.bmp in the Skins > Default folder and the restartkm.exe it Tools folder which I created in KM1.5.1en-US root folder because it did not exist. I also downloaded the 7z and installed it in the same manner, but still the problem persists.

Thanks you.


Options: ReplyQuote
Re: Restart button ?
Posted by: disrupted
Date: December 09, 2008 01:34PM

hmm.. think found an old resurrected bug with rc2 while testing this,anyway

you have 2 problems.
first, it seems that something is preventing kmeleon from existing normally
this part of the restart script isn't closing your kmeleon
WinClose("[CLASS:KMeleon Browser Window]", "")
this is a normal close(non-force)
then when this fails to function.. this part terminates(kills) kmeleon:
ProcessClose("k-meleon.exe",1)
but i only added the kill command for when there are too many kmeleon windows(which is a rare case) with 7 or more kmeleon windows.
that means that 6 of the normal calls to end kmeleon failed to close it and the kill command had to jump in.

this could be caused by a plugin that prevents kmeleon from closing properly.
to test this:
try opening kmeleon with one tab(bblank page) and close it from the close button and check in the taskmanager if km is still running.

if a plugin is loaded with kmeleon, regardless of a website is calling it or not.. it may prevent normal close.
if a badsite installed this plugin, it might have caused this problem.. installing on top might not fix it because, the malware plugin will still be there.. also th plugin may not be in kmeleon's plugins folder.. it could be loaded from the registry(like java plugins or quicktime 7+ plugins).. and the plugin may also be in firefox plugins folder because kmeleon automatically reads some plugins from firefox.

first open help> about plugins.. and check for any fishy plugin, something that you do not know of that you didn't install.
also check if you've upgraded a plugin recently or installed new plugin.. this too might be a cause.

if nothing out of the ordinary in plugins.. try a clean install(backup your profile folder first.. this way you won't need to customise again) and start with a fresh new default profile. see if you have the same problem.. if not then it could have been a corrupted kmeleon component or remnant file causing the problem.

problem 2 is sessions plugin.. it's not able to either restore previous session or continue normally.. this can also be caused by bad plugin, an after affect of problem 1.

i hope you find the cause which is probably due to a malware or corrupted file sad smiley

Options: ReplyQuote
Re: Restart button ?
Posted by: caktus
Date: December 09, 2008 05:26PM

quote=disrupted]
hmm..........
[/quote]

After all of the above that you mentioned, the problem as you suspected seems related to having multiple tabs/windows open. With a new fresh install now, the problem still persists when multiple tabs/windows are open except when I click "Yes" on the error message the previous window and tabs (session) is reloaded. And when I click "No" on the error message no new window opens (I think a new window is supposed to open.) Also, When I click on Restart K-Meleon with multiple tabs open,the warning "There are # of tams open. Do you want to close them all?" flashed six times. This still seems a little quirky:s but at least I know what to expect.

When I get time I will remove everything related to KM and start a fresh download and install of 1.5.1 and start all over again from scratch as it does seem that something may be corrupt in the download and or installation files.

Charlie

~~If it ain't broke, why screw it up?~~


Options: ReplyQuote
Re: Restart button ?
Posted by: disrupted
Date: December 09, 2008 06:17PM

whoops.. that's my bad!
restart script was written assuming no confirm prompt with multiple tabs open. i completely forgot that option cause i never use it.. ofcourse when the script attempts to close(non-force) kmeleon with confirm prompt enabled.. it fails; because kmeleon expects a user input, which the script doesn't do (click yes) and eventually it force-kills kmeleon.. triggeriing the session prompt on the restart; which apparently gets messed up in the process when user doesn't click yes or no before exiting.

for now, the script will only work properly; if confirm prompt is disabled.. and that's probably why you got it working fine before.
just go to preferences>browsing>tabbed browsing>confirm closing mulitple tabs(uncheck).

i'll be rewriting this script to function properly when this option is selected(i.e. making it click yes), and extending delay time before force-killing it.

Options: ReplyQuote
Re: Restart button ?
Posted by: desga2
Date: December 09, 2008 08:17PM

grinning smiley
The first time I saw your AutoIt3 code for this tool I said "Force kill K-Meleon windows? This can't be good for K-Meleon."
grinning smiley

K-Meleon in Spanish



Edited 2 time(s). Last edit at 12/09/2008 08:18PM by desga2.

Options: ReplyQuote
Re: Restart button ?
Posted by: disrupted
Date: December 09, 2008 08:24PM

true.. but i gave it 6 attempts to try to close normally first for 6 windows before start shooting kmeleon grinning smiley.. the prompt before closing multiple tabs went right over my head and it's now causing this problem with charlie. sad smiley

tomorrow, i'll rewrite the script to click yes on confirm prompts.. but will probably keep old restart aswell, because the new script will probably take a longer time(a second or 2) to wait for the prompt and then click it.. so it will be best only to use it when confirm is enabled.

Options: ReplyQuote
Re: Restart button ?
Posted by: desga2
Date: December 09, 2008 09:06PM

@ disrupted:

You can change your only 6 windows for a "while" loop:

While Exist K-Meleon window{
Close K-Meleon window
}

This improve it to infinite? K-Meleon windows smiling smiley

Also you can check if k-meleon.exe process is running and close it from process.

I look in AutoIt v3.2.12.1 help and syntax command used are different to you use:

WinExists ( "title" [, "text"] )
WinClose ( "title" [, "text"] )
WinKill ( "title" [, "text"] )

Process_Exists ( "process" ) # Without "_"
ProcessClose ( "process" )

@ caktus:
You can hide restart button from toolbar if you comment this line in restart.kmm macro:

#$OnSetup=$OnSetup."_restart_BuildToolbar;";

K-Meleon in Spanish



Edited 4 time(s). Last edit at 12/09/2008 09:22PM by desga2.

Options: ReplyQuote
Re: Restart button ?
Posted by: disrupted
Date: December 09, 2008 10:43PM

thank you desga.. i'll probably use your loop. i was going to opt for an easy way to work when both confirm is selected or not, by sending simple ctrl+alt+F4 but.......
apparently this command causes kmeleon to crash now!

i'm going to post it in bugs forum and then go to bed.. 3 bugs in one day is bit too much

Options: ReplyQuote
Re: Restart button ?
Posted by: caktus
Date: December 10, 2008 06:32AM

Quote
desga2
#pluginmsg(toolbars,"AddButton","KMrestart,Restart,macros("."_restart_command"."),"."Close".",".$_restart_Tooltip.",24,24,"."restart_large.bmp[0],restart_large.bmp[1],restart_large.bmp[2]"):0;
$_SkinLarge ?

Thank you. I had already gotten rid of the Restart button bmp by commenting out a line some where, for the life of me I cannot remember where. This left an invisible Restart button which I had gotten rid if by commenting out a line of code some where else, I think it was
#pluginmsg(toolbars,"AddButton","KMrestart,Restart,macros("."_restart_command"."),"."Close".",".$_restart_Tooltip.",24,24,"."restart_large.bmp[0],restart_large.bmp[1],restart_large.bmp[2]"):0;
$_SkinLarge ? in the Restart.kmm. But I am going to save
#$OnSetup=$OnSetup."_restart_BuildToolbar;";
for future reference as I am sure I will need it.

Charlie

~~If it ain't broke, why screw it up?~~


Options: ReplyQuote
Re: Restart button ?
Posted by: disrupted
Date: December 10, 2008 12:34PM

UPDATE: i used the loop.. thank you desga for your endless support and help!

nomore force-kill kmeleon, eliminating the sessions prompt at restart, if confirm close with multiple tabs is selected.. script will automatically click yes and resume.

2 versions are available, 1 with toolbar button and the other without

script src:
; AutoIt Version: 3.0
; Language: English
; Platform: Win9x/NT
; Author: yannis kargas
;
; Script Function: restarts k-meleon
;
#include <GuiConstants.au3>
#NoTrayIcon

; close km(non-force)

While
Process Exists(k-meleon.exe)
WinClose("[CLASS:KMeleon Browser Window]", "");
sleep(400);
If WinActive("K-Meleon") Then
Send("{Enter}")
EndIf

Wend
; wait a bit..
sleep(400)

; Run km
Run($CmdLine[1])

; we're outta here!


N.B Process Exists must be one word.. but forum doesn't like it


Options: ReplyQuote


K-Meleon forum is powered by Phorum.