Falls jemand Interesse an einer solchen Kontexterweiterung hat:
[Blockierte Grafik: http://www6.pic-upload.de/30.12.10/6ocrp9lxinws.png]
dann geht das mit einer profil eingebauten userChrome.js [1]. Angepasst wurde dafür Script launchIE [1]. Nachfolgende Scripts sind unter Win 7 und Office (2007) direkt anwendbar. Bei Abweichung muss entsprechend angepasst werden.
Starte mit IE
Code
/* :::::::: LaunchIE (cf. IE View) ::::::::::::::: */
var LaunchIE = {
mSchemes: ["file", "ftp", "http", "https"],
init: function()
{
this.mItem = document.createElement("menuitem");
this.mItem.setAttribute("label", "Starte mit IE");
this.mItem.setAttribute("accesskey", "m");
document.getElementById("contentAreaContextMenu").addEventListener("popupshowing", function() { LaunchIE.onPopupShowing(this); }, false);
},
onPopupShowing: function(aPopup)
{
aPopup.insertBefore(this.mItem, document.getElementById("context-sep-" + ((gContextMenu.onLink)?"open":"stop")));
this.mItem.setAttribute("oncommand", "LaunchIE.launch(" + ((gContextMenu.onLink)?"gContextMenu.linkURI":"gBrowser.currentURI") + ");");
this.mItem.hidden = !gContextMenu.onLink && (gContextMenu.isTextSelected || gContextMenu.onImage || gContextMenu.onTextInput);
this.mItem.setAttribute("disabled", this.mItem.hidden || !this.isSupported((gContextMenu.onLink)?gContextMenu.linkURI:gBrowser.currentURI));
},
launch: function(aURI, aApp)
{
if (!this.isSupported(aURI))
{
throw new Error("LaunchIE: unsupported URI scheme '" + aURI.scheme + "'!");
}
var iexplore = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
try
{
var regkey = Components.classes["@mozilla.org/windows-registry-key;1"].createInstance(Components.interfaces.nsIWindowsRegKey);
regkey.open(Components.interfaces.nsIWindowsRegKey.ROOT_KEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\" + (aApp || "IEXPLORE.EXE"), Components.interfaces.nsIWindowsRegKey.ACCESS_READ);
iexplore.initWithPath(regkey.readStringValue(""));
regkey.close();
}
catch (ex)
{
iexplore.initWithPath((Components.classes["@mozilla.org/process/environment;1"].getService(Components.interfaces.nsIEnvironment).get("PROGRAMFILES") || "C:\\Program Files") + "\\Internet Explorer\\iexplore.exe");
}
var process = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
process.init(iexplore);
process.run(false, [aURI.spec], 1);
},
isSupported: function(aURI)
{
return this.mSchemes.indexOf(aURI.scheme) > -1;
}
};
LaunchIE.init();
/* :::::::: END LaunchIE (cf. IE View) ::::::::::::::: */
Alles anzeigen
Starte mit Opera
Code
/* :::::::: LaunchOPERA (cf. IE View) ::::::::::::::: */
var LaunchOPERA = {
mSchemes: ["file", "ftp", "http", "https"],
init: function()
{
this.mItem = document.createElement("menuitem");
this.mItem.setAttribute("label", "Starte mit OPERA");
this.mItem.setAttribute("accesskey", "m");
document.getElementById("contentAreaContextMenu").addEventListener("popupshowing", function() { LaunchOPERA.onPopupShowing(this); }, false);
},
onPopupShowing: function(aPopup)
{
aPopup.insertBefore(this.mItem, document.getElementById("context-sep-" + ((gContextMenu.onLink)?"open":"stop")));
this.mItem.setAttribute("oncommand", "LaunchOPERA.launch(" + ((gContextMenu.onLink)?"gContextMenu.linkURI":"gBrowser.currentURI") + ");");
this.mItem.hidden = !gContextMenu.onLink && (gContextMenu.isTextSelected || gContextMenu.onImage || gContextMenu.onTextInput);
this.mItem.setAttribute("disabled", this.mItem.hidden || !this.isSupported((gContextMenu.onLink)?gContextMenu.linkURI:gBrowser.currentURI));
},
launch: function(aURI, aApp)
{
if (!this.isSupported(aURI))
{
throw new Error("LaunchOPERA: unsupported URI scheme '" + aURI.scheme + "'!");
}
var OPERA = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
try
{
var regkey = Components.classes["@mozilla.org/windows-registry-key;1"].createInstance(Components.interfaces.nsIWindowsRegKey);
regkey.open(Components.interfaces.nsIWindowsRegKey.ROOT_KEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\" + (aApp || "OPERA.EXE"), Components.interfaces.nsIWindowsRegKey.ACCESS_READ);
OPERA.initWithPath(regkey.readStringValue(""));
regkey.close();
}
catch (ex)
{
OPERA.initWithPath((Components.classes["@mozilla.org/process/environment;1"].getService(Components.interfaces.nsIEnvironment).get("PROGRAMFILES") || "C:\\Program Files") + "\\OPERA\\OPERA.exe");
}
var process = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
process.init(OPERA);
process.run(false, [aURI.spec], 1);
},
isSupported: function(aURI)
{
return this.mSchemes.indexOf(aURI.scheme) > -1;
}
};
LaunchOPERA.init();
/* :::::::: END LaunchOPERA (cf. IE View) ::::::::::::::: */
Alles anzeigen
Starte mit Safari
Code
/* :::::::: LaunchSAFARI (cf. IE View) ::::::::::::::: */
var LaunchSAFARI = {
mSchemes: ["file", "ftp", "http", "https"],
init: function()
{
this.mItem = document.createElement("menuitem");
this.mItem.setAttribute("label", "Starte mit SAFARI");
this.mItem.setAttribute("accesskey", "m");
document.getElementById("contentAreaContextMenu").addEventListener("popupshowing", function() { LaunchSAFARI.onPopupShowing(this); }, false);
},
onPopupShowing: function(aPopup)
{
aPopup.insertBefore(this.mItem, document.getElementById("context-sep-" + ((gContextMenu.onLink)?"open":"stop")));
this.mItem.setAttribute("oncommand", "LaunchSAFARI.launch(" + ((gContextMenu.onLink)?"gContextMenu.linkURI":"gBrowser.currentURI") + ");");
this.mItem.hidden = !gContextMenu.onLink && (gContextMenu.isTextSelected || gContextMenu.onImage || gContextMenu.onTextInput);
this.mItem.setAttribute("disabled", this.mItem.hidden || !this.isSupported((gContextMenu.onLink)?gContextMenu.linkURI:gBrowser.currentURI));
},
launch: function(aURI, aApp)
{
if (!this.isSupported(aURI))
{
throw new Error("LaunchSAFARI: unsupported URI scheme '" + aURI.scheme + "'!");
}
var SAFARI = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
try
{
var regkey = Components.classes["@mozilla.org/windows-registry-key;1"].createInstance(Components.interfaces.nsIWindowsRegKey);
regkey.open(Components.interfaces.nsIWindowsRegKey.ROOT_KEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\" + (aApp || "SAFARI.EXE"), Components.interfaces.nsIWindowsRegKey.ACCESS_READ);
SAFARI.initWithPath(regkey.readStringValue(""));
regkey.close();
}
catch (ex)
{
SAFARI.initWithPath((Components.classes["@mozilla.org/process/environment;1"].getService(Components.interfaces.nsIEnvironment).get("PROGRAMFILES") || "C:\\Program Files") + "\\SAFARI\\SAFARI.exe");
}
var process = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
process.init(SAFARI);
process.run(false, [aURI.spec], 1);
},
isSupported: function(aURI)
{
return this.mSchemes.indexOf(aURI.scheme) > -1;
}
};
LaunchSAFARI.init();
/* :::::::: END LaunchSAFARI (cf. IE View) ::::::::::::::: */
Alles anzeigen
Starte mit Winword
Code
/* :::::::: LaunchWINWORD (cf. IE View) ::::::::::::::: */
var LaunchWINWORD = {
mSchemes: ["file", "ftp", "http", "https"],
init: function()
{
this.mItem = document.createElement("menuitem");
this.mItem.setAttribute("label", "Starte mit WINWORD");
this.mItem.setAttribute("accesskey", "m");
document.getElementById("contentAreaContextMenu").addEventListener("popupshowing", function() { LaunchWINWORD.onPopupShowing(this); }, false);
},
onPopupShowing: function(aPopup)
{
aPopup.insertBefore(this.mItem, document.getElementById("context-sep-" + ((gContextMenu.onLink)?"open":"stop")));
this.mItem.setAttribute("oncommand", "LaunchWINWORD.launch(" + ((gContextMenu.onLink)?"gContextMenu.linkURI":"gBrowser.currentURI") + ");");
this.mItem.hidden = !gContextMenu.onLink && (gContextMenu.isTextSelected || gContextMenu.onImage || gContextMenu.onTextInput);
this.mItem.setAttribute("disabled", this.mItem.hidden || !this.isSupported((gContextMenu.onLink)?gContextMenu.linkURI:gBrowser.currentURI));
},
launch: function(aURI, aApp)
{
if (!this.isSupported(aURI))
{
throw new Error("LaunchWINWORD: unsupported URI scheme '" + aURI.scheme + "'!");
}
var WINWORD = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
try
{
var regkey = Components.classes["@mozilla.org/windows-registry-key;1"].createInstance(Components.interfaces.nsIWindowsRegKey);
regkey.open(Components.interfaces.nsIWindowsRegKey.ROOT_KEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\" + (aApp || "WINWORD.EXE"), Components.interfaces.nsIWindowsRegKey.ACCESS_READ);
WINWORD.initWithPath(regkey.readStringValue(""));
regkey.close();
}
catch (ex)
{
WINWORD.initWithPath((Components.classes["@mozilla.org/process/environment;1"].getService(Components.interfaces.nsIEnvironment).get("PROGRAMFILES") || "C:\\Program Files") + "\\Microsoft Office\\\Office12\\WINWORD.EXE");
}
var process = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
process.init(WINWORD);
process.run(false, [aURI.spec], 1);
},
isSupported: function(aURI)
{
return this.mSchemes.indexOf(aURI.scheme) > -1;
}
};
LaunchWINWORD.init();
/* :::::::: END LaunchWINWORD (analog IE View) ::::::::::::::: */
Alles anzeigen
Starte mit Excel
Code
/* :::::::: LaunchEXCEL (cf. IE View) ::::::::::::::: */
var LaunchEXCEL = {
mSchemes: ["file", "ftp", "http", "https"],
init: function()
{
this.mItem = document.createElement("menuitem");
this.mItem.setAttribute("label", "Starte mit EXCEL");
this.mItem.setAttribute("accesskey", "m");
document.getElementById("contentAreaContextMenu").addEventListener("popupshowing", function() { LaunchEXCEL.onPopupShowing(this); }, false);
},
onPopupShowing: function(aPopup)
{
aPopup.insertBefore(this.mItem, document.getElementById("context-sep-" + ((gContextMenu.onLink)?"open":"stop")));
this.mItem.setAttribute("oncommand", "LaunchEXCEL.launch(" + ((gContextMenu.onLink)?"gContextMenu.linkURI":"gBrowser.currentURI") + ");");
this.mItem.hidden = !gContextMenu.onLink && (gContextMenu.isTextSelected || gContextMenu.onImage || gContextMenu.onTextInput);
this.mItem.setAttribute("disabled", this.mItem.hidden || !this.isSupported((gContextMenu.onLink)?gContextMenu.linkURI:gBrowser.currentURI));
},
launch: function(aURI, aApp)
{
if (!this.isSupported(aURI))
{
throw new Error("LaunchEXCEL: unsupported URI scheme '" + aURI.scheme + "'!");
}
var EXCEL = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
try
{
var regkey = Components.classes["@mozilla.org/windows-registry-key;1"].createInstance(Components.interfaces.nsIWindowsRegKey);
regkey.open(Components.interfaces.nsIWindowsRegKey.ROOT_KEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\" + (aApp || "EXCEL.EXE"), Components.interfaces.nsIWindowsRegKey.ACCESS_READ);
EXCEL.initWithPath(regkey.readStringValue(""));
regkey.close();
}
catch (ex)
{
EXCEL.initWithPath((Components.classes["@mozilla.org/process/environment;1"].getService(Components.interfaces.nsIEnvironment).get("PROGRAMFILES") || "C:\\Program Files") + "\\Microsoft Office\\\Office12\\EXCEL.EXE");
}
var process = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
process.init(EXCEL);
process.run(false, [aURI.spec], 1);
},
isSupported: function(aURI)
{
return this.mSchemes.indexOf(aURI.scheme) > -1;
}
};
LaunchEXCEL.init();
/* :::::::: END LaunchEXCEL (analog IE View) ::::::::::::::: */
Alles anzeigen
Natürlich müssen obige Programme im OS sein!