So in Firefox, how would one do something that's extremely simple in Opera like
Button6, "InFx"="Execute program, "firefox", "%u", "InFx", "Firefox""
In other words, I want to execute a program on my computer (like another browser, youtube-dl, etc.) with the URL of the page I'm looking at as an argument.......
Do you have the Custom Buttons Addon, & if you do I have an 'Open-In Browser' button that does just that.
You can use it in conjunction with another button & have all your 'Open-In-Browser' buttons in a drop down menu (a stacker button which is a drop down menu of other non-menu type buttons)
/*Code*/
var appName = "Browser Name goes Here";
var regRoot = Components.interfaces.nsIWindowsRegKey.ROOT_KEY_LOCAL_MACHINE;
var regKey = "";
var regValue = "";
var appExe = "";
var branch = "Browsers Name goes Here";
var url = gBrowser.currentURI;
this.LaunchApp(appName, regRoot, regKey, regValue, appExe, branch, url);
/*Initialization Code*/
function isSupported(aURI) {
var mSchemes = ["file", "ftp", "http", "https"];
return mSchemes.indexOf(aURI.scheme) > -1;
}
this.LaunchApp = function(aName, aReg, aKey, aValue, aExe, aBranch, aURI) {
if(!isSupported(aURI)) {
alert("Unsupported URI scheme '" + aURI.scheme + "'!");
return;
}
var prefString = "custombuttons.lauchApp." + aBranch;
var path2exe;
try {
path2exe = gPrefService.getCharPref(prefString);
} catch(ex) {
try {
var winReg = Components.classes["@mozilla.org/windows-registry-key;1"]
.createInstance(Components.interfaces.nsIWindowsRegKey);
winReg.open(aReg, aKey, Components.interfaces.nsIWindowsRegKey.ACCESS_READ);
path2exe = winReg.readStringValue(aValue) + aExe;
winReg.close();
} catch(ex) {
const nsIFilePicker = Components.interfaces.nsIFilePicker;
var fp = Components.classes['@mozilla.org/filepicker;1']
.createInstance(nsIFilePicker);
fp.init(window, "Set " + aName + "Directory", nsIFilePicker.modeOpen);
fp.appendFilters(nsIFilePicker.filterApps);
if(fp.show() == nsIFilePicker.returnOK) path2exe = fp.file.path;
else return;
}
}
gPrefService.setCharPref(prefString, path2exe);
var app = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
app.initWithPath(path2exe);
var process = Components.classes["@mozilla.org/process/util;1"]
.createInstance(Components.interfaces.nsIProcess);
process.init(app);
process.run(false, [aURI.spec], 1);
}
this.style.opacity = '.65';
this.setAttribute("onmouseover", "custombuttons.ButtonBrt(event);" );
this.setAttribute("onmouseout", "custombuttons.ButtonDim(event);" );
this.setAttribute("author",'LouCypher'); // Stores Author.
this.setAttribute("version",'20060814.00'); // Stores Version.
this.setAttribute('homepage', 'http://custombuttons2.com/forum/buttons/buttons-database/browser-launch-button-group.html');
this.setAttribute("dependency",'FF 2.0.*,CB 2.0.*'); // Stores Dependency.
this.setAttribute("status",'Complete'); // Stores Devstatus.
this.setAttribute("public",true); // Stores Public.
Here's the code for the 'Open-In Browser Button', or as the author called it 'The Browser Launch Button'
This button, when clicked the first time, will ask you for the location of your desired browsers executable location. When you complete that it will thereafter open your valid URL from your FireFox address-bar in the browser of your choice. You need an open url in Firefox when you click this button otherwise you'll get an error message.
I have quite a few buttons that still work in the new FireFox (some with modification), so if you need something simple just PM me or post here, & when I can I'll get back to ya when I read it.
JFYI - I'm not a programmer, I just trial & error cut & pastes when I need something simple.