Run Program with Arguments
Buttons
Runs a program with some given arguments. These must be specified within the button.
Additionally, windows systems may need to double escape their backslashes.
C:\\Program Files\\...
I am not sure on that, but I think it is right.
Behavior
| Action | Behavior |
|---|---|
| Launch pre-programmed application with specified arguments |
รุ่น
รหัส
/*Code*/ function runProgram(progPath, arg) { var argArray = arg ? arg.split(/\s+/) : []; var nsILocalFile = Components.classes["@mozilla.org/file/local;1"] .getService(Components.interfaces.nsILocalFile); var nsIProcess = Components.classes["@mozilla.org/process/util;1"] .getService(Components.interfaces.nsIProcess); nsILocalFile.initWithPath(progPath); nsIProcess.init(nsILocalFile); nsIProcess.run(false, argArray, argArray.length); nsIProcess.close(); return nsILocalFile; } runProgram("/usr/bin/thunderbird","-safe-mode");
Init
// button attributes this.style.opacity = '.65'; this.setAttribute("onmouseover", "if (custombuttons) custombuttons.ButtonBrt(event);"); this.setAttribute("onmouseout", "if (custombuttons) custombuttons.ButtonDim(event);"); this.setAttribute('author','nicholas'); this.setAttribute('version','20090413.00'); this.setAttribute('homepage', 'http://custombuttons2.com/forum/buttons/buttons-database/run-program-arguments.html'); this.setAttribute('dependency','FF3.0*, FL2.0*, TB2.0*, CB2 2.0.5*'); this.setAttribute('status','Complete'); this.setAttribute('public',true);
คู่มือการใช้งาน
Left: Launch pre-programmed application with specified arguments
รายละเอียด
test3
Hi I could get this button to open up windows explorer but is there a way to set arguments eg the /e switch will open upon explorer in tree view from the run box:
c:\windows\explorer.exe /e
Thanks,
WB
Custom Buttons² v.3.0.0
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.20) Gecko/20081217 Firefox/2.0.0.20
Posted with the theme Pluralism
open Windows Explorer to C:\
/*Code*/ var file = Components.classes["@mozilla.org/file/local;1"]. createInstance(Components.interfaces.nsILocalFile); var process = Components.classes["@mozilla.org/process/util;1"]. createInstance(Components.interfaces.nsIProcess); var args = ["/e"]; file.initWithPath("C:\\WINDOWS\\explorer.exe"); process.init(file); process.run(false, args, args.length);
open Windows Explorer to C:\Program Files\Mozilla Firefox
/*Code*/ var file = Components.classes["@mozilla.org/file/local;1"]. createInstance(Components.interfaces.nsILocalFile); var process = Components.classes["@mozilla.org/process/util;1"]. createInstance(Components.interfaces.nsIProcess); var args = ["/e,","C:\\Program Files\\Mozilla Firefox"]; file.initWithPath("C:\\WINDOWS\\explorer.exe"); process.init(file); process.run(false, args, args.length);
Custom Buttons² v.3.0.0
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8
Posted with the theme Pluralism
Thanks, that was a big help. I got it working.
WB
Custom Buttons² was not found: find out why...
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.20) Gecko/20081217 Firefox/2.0.0.20
Posted with the theme Pluralism
I would like to execute an external script passing selected mails or usenet articles as text to my external script. Is that possible?
Custom Buttons² was not found: find out why...
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
Posted with the theme Pluralism






Hi! I want to launch programs from Thunderbird Portable which is on my USB key. For this I need to use relative paths. How can I do this with your button?
-thanks
Custom Buttons² v.2.0.9.10
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7 (.NET CLR 3.5.30729)