Posts: 53
Threads: 21
Joined: Jul 2021
Similiar to
this thread, I'd like to call a function (accepting a filename as a string argument) by a .cmd script.
I've seen a lot of doc about the reverse direction, but I imagine this will also be possible. Maybe it's alreadyx documented somewhere and I just didn't search well enough?
Posts: 12,071
Threads: 140
Joined: Dec 2002
01-17-2024, 12:02 PM
(This post was last modified: 01-17-2024, 12:02 PM by Gintaras.)
Create .exe program, and let .bat execute it.
Example. Compile or run this script. When compiling, LA creates C:\Test\LA\cmd1\cmd1.exe.
// script "cmd1.cs"
/*/ role exeProgram; outputPath C:\Test\LA\cmd1; /*/
if (script.testing) args = [@"C:\Test\test.txt"];
var file = args[0];
dialog.show(file, File.ReadAllText(file));
.bat:
C:\Test\LA\cmd1\cmd1.exe "C:\Test\abcg.txt"
Posts: 12,071
Threads: 140
Joined: Dec 2002
01-17-2024, 12:12 PM
(This post was last modified: 01-17-2024, 12:12 PM by Gintaras.)
Or without .exe.
// script "cmd2.cs"
if (script.testing) args = [@"C:\Test\test.txt"];
var file = args[0];
dialog.show(file, File.ReadAllText(file));
.bat
Au.Editor.exe *cmd2.cs "C:\Test\abcg.txt"
To create the command line can be used menu TT -> Script triggers.
Posts: 53
Threads: 21
Joined: Jul 2021
Super, thanks very much for that sample!