Restarting in nightlies

User support for problems with custom buttons

Restarting in nightlies

Postby trapper john » Mon Oct 02, 2017 2:25 pm

None of the restart buttons work in the nightlies anymore. If someone has new code that does please post.

For now I've created a .vbs file to send keys and do it through Firefox command:

Option Explicit
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys ("+{F2}")
WScript.Sleep (2500)
WshShell.SendKeys ("restart")
WshShell.SendKeys "{ENTER}"
Set WshShell = Nothing

It could probably be improved upon it does work.

The button code is as follows:

Code: Select all
var file = Components.classes["@mozilla.org/file/local;1"].
  createInstance(Components.interfaces.nsIFile);
file.initWithPath("C:\\restart.vbs");
file.launch();
trapper john
 
Posts: 108
Joined: Wed Mar 14, 2012 6:58 pm

Re: Restarting in nightlies

Postby morat » Tue Oct 03, 2017 12:29 am

Is there an error in the browser console?

Code: Select all
/*Code*/
var os = Components.classes["@mozilla.org/observer-service;1"].
  getService(Components.interfaces.nsIObserverService);
var cancelQuit = Components.classes["@mozilla.org/supports-PRBool;1"].
  createInstance(Components.interfaces.nsISupportsPRBool);
os.notifyObservers(cancelQuit, "quit-application-requested", "restart");
if (cancelQuit.data) {
  Services.prompt.alert(window, "Custom Buttons", "Abort Restart Process");
} else {
  var appStartup = Components.classes["@mozilla.org/toolkit/app-startup;1"].
    getService(Components.interfaces.nsIAppStartup);
  appStartup.quit(appStartup.eAttemptQuit | appStartup.eRestart);
}
morat
 
Posts: 945
Joined: Wed Dec 28, 2011 2:38 pm

Re: Restarting in nightlies

Postby trapper john » Tue Oct 03, 2017 1:59 am

Nothing in the log but your code works good, much better than sending keys. I even used it to change the command in the Classic Theme Restorer restart command that's in the File menu by way of Menu Wizard, that was also broke.
trapper john
 
Posts: 108
Joined: Wed Mar 14, 2012 6:58 pm


Return to Buttons