Page 1 of 1

How to launch an application in cmd using Akelpad?

Posted: Sun Jun 08, 2025 5:36 pm
by aks2161989
I love the simple interface and the rich set of features of Akelpad. I am using this editor to write and compile simple programs in Java.

I have used the Hotkeys plugin to compile Java programs with this command

Code: Select all

Call("Log::Output", 1, `"javac" "%f"`, "%d")
Then I used the Hotkeys plugin to run the compiled Java program as follows

Code: Select all

Call("Log::Output", 1, `"java" "%f"`, "%d")
But some Java programs need user input, so I want to call these Java programs using cmd. I think the log::Output plugin cannot take user input.

How can I call programs from cmd from within Akelpad?

Any tips would be greatly appreciated!

Re: How to launch an application in cmd using Akelpad?

Posted: Mon Jun 09, 2025 12:37 pm
by DV
You may try a script RunMe.js.
At first, you'll need to add a new command similar to:

Code: Select all

"java" :
  ":run_java(\"%d\", \"%n.%e\")",
to the `oCommands`.
And then add a new function:

Code: Select all

function run_java(fileDir, fileName, args) // 'args' is optional
{
  var cmd = (fileDir == "") ? fileName : fileDir + "\\" + fileName;
  cmd = buildCommandWithOptionalArgs("\"" + cmd + "\"", args);
  cmd = "cmd /C java " + cmd + " || pause";
  runCommand(cmd, "", 0); // do not capture output
}
Then you may specify the value of `args` either explicitly or by calling

Code: Select all

Call("Scripts::Main", 1, "RunMe.js", "1")
by means of the Hotkeys plugin.

Re: How to launch an application in cmd using Akelpad?

Posted: Mon Jun 09, 2025 10:49 pm
by aks2161989
Thank you DV! I am now able to run progtams in cmd from within Akelpad. I used your script and everything works well

Re: How to launch an application in cmd using Akelpad?

Posted: Tue Jun 10, 2025 6:48 pm
by DV
I've updated the script RunMe.js to include Java and apply the similar approach to the other languages.