Page 1 of 1
Launch browser with current file
Posted: Fri Sep 03, 2010 7:19 pm
by bill
Exec("C:\Program Files\Mozilla Firefox 4.0 Beta 3\firefox.exe '%f'").
This doesn't work. How does one launch Firefox, or any browser, displaying the current file?
Thanks.
Posted: Fri Sep 03, 2010 7:41 pm
by infimum
There is a space between "Program" and "Files" and other places.
Posted: Fri Sep 03, 2010 8:06 pm
by bill
It is enclosed in quotes. If I name a file it works perfectly. For example,
Exec("C:\Program Files\Mozilla Firefox 4.0 Beta 3\firefox.exe c:\links.htm")
But if I use the variable %f enclosed in single quotes it doesn't work. Why not?
Posted: Fri Sep 03, 2010 8:11 pm
by bill
Sorry. Solved it. Quotes around the variable are not needed. This works:
Exec("C:\Program Files\Mozilla Firefox 4.0 Beta 3\firefox.exe %f")
Posted: Fri Sep 03, 2010 8:44 pm
by KDJ
bill
I think this should be done like this:
Exec(`C:\Program Files\Mozilla Firefox 4.0 Beta 3\firefox.exe "%f"`)
or
Exec('C:\Program Files\Mozilla Firefox 4.0 Beta 3\firefox.exe "%f"')
Posted: Fri Sep 03, 2010 9:03 pm
by bill
That is the way I had it initially, double quotes around the complete string and single quotes around the variable. But I find that quotes around the variable are not needed. In fact, using quotes around %f doesn't work.
Posted: Sat Sep 04, 2010 8:30 am
by cnnnc
Exec(`"C:\Program Files\Mozilla Firefox 4.0 Beta 3\firefox.exe" %f`)
Posted: Mon Jun 16, 2014 12:51 am
by r0n
Sorry for bumping this topic up, can the above firefox path also be used in the "AkelPad.Exec" command?
This the command I used in for the "Scripts" plugin.
I have code below (see "I") that works perfectly with notepad, but if I replace 'notepad.exe' with the full path of another application it does not work.
If I replace 'notepad.exe' with the full absolute path to notepad.exe it also doesn't work.
I looked in the 'Scripts' section in the Plugins help-file but I could not find an awnser there.
Code: Select all
var hSubClass;
if (hSubClass=AkelPad.WindowSubClass(1 /*WSC_MAINPROC*/, MainCallback, 0x436 /*AKDN_OPENDOCUMENT_FINISH*/))
{
//Message loop
AkelPad.WindowGetMessage();
AkelPad.WindowUnsubClass(1 /*WSC_MAINPROC*/);
}
function MainCallback(hWnd, uMsg, wParam, lParam)
{
if (uMsg == 0x436 /*AKDN_OPENDOCUMENT_FINISH*/)
{
var filePath = AkelPad.GetEditFile(0);
AkelPad.Exec("notepad.exe \"" + filePath + "\"");
}
}
Is there a way to use a full path with an argument, using the following 2 variables:
Code: Select all
var msg_txt="Hello!" // this is the argument
var msg_exe="d:\path\to\msg_exe" // this generates a popup
I want to put the above 2 variables in the following line:
Code: Select all
AkelPad.Exec("notepad.exe \"" + filePath + "\"");
Posted: Mon Jun 16, 2014 8:40 am
by KDJ
r0n
Code: Select all
var msg_txt='Hello!'; // this is the argument
var msg_exe='d:\\path\\to\\msg_exe'; // this generates a popup
AkelPad.Exec('"' + msg_exe + '" ' + msg_txt);
In JScript double backslashes are required:
http://www.w3schools.com/js/js_strings.asp
Posted: Mon Jun 16, 2014 8:56 am
by r0n
I totally forgot about that!
It works, thank you!!!