General :  K-Meleon Web Browser Forum
General discussion about K-Meleon 
Run console application from exec statement?
Posted by: JamesD
Date: September 27, 2008 07:25PM

Is there a way to run a console application such as ping.exe from the exec statement in a macro? I wish to run a command like
ping.exe -n 1 sourceforge.net > c:\pingback.dat
but I get nothing. If I type the line at the command prompt then it works and my information is in the pingback.dat. I can make the exec statement produce the correct line, but in what environment does that run?

Options: ReplyQuote
Re: Run console application from exec statement?
Posted by: kko
Date: September 27, 2008 08:09PM

You have to put this command into a bat/cmd file and call that from your macro.
The output diversion (> c:\pingback.dat) is a feature of the command console. Ping.exe can't do that itself.

Options: ReplyQuote
Re: Run console application from exec statement?
Posted by: JamesD
Date: September 28, 2008 01:15AM

@ kko

I still do not have it right. I have the following batch file.
PingBack.bat
ping.exe -n 1 %1 > PingBack.dat
I have tried the following lines from the exec statement.
C:\Program Files\k-meleon\Profiles\tq3p1wcv.default\macros\PingBack.bat www.perigee.net
"C:\Program Files\k-meleon\Profiles\tq3p1wcv.default\macros\PingBack.bat" www.perigee.net
"C:\Program Files\k-meleon\Profiles\tq3p1wcv.default\macros\PingBack.bat www.perigee.net"
"C:\Program Files\k-meleon\Profiles\tq3p1wcv.default\macros\PingBack.bat" "www.perigee.net"
Lines two and four seem to start the console but I never get any PingBack.dat file built.

Options: ReplyQuote
Re: Run console application from exec statement?
Posted by: kko
Date: September 28, 2008 09:26AM

Quote
JamesD
I never get any PingBack.dat file built.

Maybe you are looking in the wrong location.

Specify fully qualified paths. Ping.exe is located in the %path%, so the console should find it. But it's not clear where PingBack.dat is meant to be located - in the directory of the batch file or in the directory of ping.exe.

Options: ReplyQuote
Re: Run console application from exec statement?
Posted by: JamesD
Date: September 28, 2008 01:33PM

@ kko

You are right, as usual. I found it here. C:\Program Files\k-meleon

I guess I will have to fully qualify the location. May have to be in quotes. I found a file called C:\Program on the system during a re-boot.
The system warned me about that one.

Options: ReplyQuote
Re: Run console application from exec statement?
Posted by: JamesD
Date: September 28, 2008 08:41PM

@ kko

Thanks so much for your help. The results are in this thread. http://kmeleonbrowser.org/forum/read.php?4,83918

Options: ReplyQuote
Re: Run console application from exec statement?
Posted by: kko
Date: September 29, 2008 05:10PM

Thank you for your efforts, James.

Options: ReplyQuote


K-Meleon forum is powered by Phorum.