AkelPad Forum Index AkelPad
Support forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Launch browser with current file

 
Post new topic   Reply to topic    AkelPad Forum Index -> Discussion (English)
View previous topic :: View next topic  
Author Message
bill



Joined: 03 Sep 2010
Posts: 7

PostPosted: Fri Sep 03, 2010 7:19 pm    Post subject: Launch browser with current file Reply with quote

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.
Back to top
View user's profile Send private message
infimum



Joined: 02 Mar 2008
Posts: 26

PostPosted: Fri Sep 03, 2010 7:41 pm    Post subject: Reply with quote

There is a space between "Program" and "Files" and other places.
Back to top
View user's profile Send private message
bill



Joined: 03 Sep 2010
Posts: 7

PostPosted: Fri Sep 03, 2010 8:06 pm    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
bill



Joined: 03 Sep 2010
Posts: 7

PostPosted: Fri Sep 03, 2010 8:11 pm    Post subject: Reply with quote

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")
Back to top
View user's profile Send private message
KDJ



Joined: 06 Mar 2010
Posts: 1393
Location: Poland

PostPosted: Fri Sep 03, 2010 8:44 pm    Post subject: Reply with quote

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"')
Back to top
View user's profile Send private message
bill



Joined: 03 Sep 2010
Posts: 7

PostPosted: Fri Sep 03, 2010 9:03 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
cnnnc



Joined: 12 Jan 2008
Posts: 116
Location: Shantou, China

PostPosted: Sat Sep 04, 2010 8:30 am    Post subject: Reply with quote

Exec(`"C:\Program Files\Mozilla Firefox 4.0 Beta 3\firefox.exe" %f`)
Back to top
View user's profile Send private message Send e-mail
r0n



Joined: 14 Jun 2014
Posts: 18

PostPosted: Mon Jun 16, 2014 12:51 am    Post subject: Reply with quote

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:

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:

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:

AkelPad.Exec("notepad.exe \"" + filePath + "\"");
Back to top
View user's profile Send private message
KDJ



Joined: 06 Mar 2010
Posts: 1393
Location: Poland

PostPosted: Mon Jun 16, 2014 8:40 am    Post subject: Reply with quote

r0n
Code:
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
Back to top
View user's profile Send private message
r0n



Joined: 14 Jun 2014
Posts: 18

PostPosted: Mon Jun 16, 2014 8:56 am    Post subject: Reply with quote

I totally forgot about that!
It works, thank you!!!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AkelPad Forum Index -> Discussion (English) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


SourceForge.net Logo Powered by phpBB © 2001, 2005 phpBB Group