Copy link to clipboard
Copied
I am trying to create a script which opens a command prompt and enters a command line.
var cmdpath = "C://WINDOWS/system32/cmd.exe"
var cmdfile =File(cmdpath)
function cmdrun(){
return cmdfile.execute()
}
cmdfile.execute() // hopefully open with command /C dir
This currently opens a command prompt window (or PowerShell if you change the path correctly), but I have yet to find a way to get a command line entered into cmd.
I have read a variety of ways it can be done in other Adobe programs app.system, system.callSystem, etc but have yet to find a method for FrameMaker. I have seen a person reference an app Method() but I am unable to find this reference again.
Cheers
Copy link to clipboard
Copied
Create a batch file and execute that.
Copy link to clipboard
Copied
As 4everJang mentioned, the way to do this is to create a new batch file or write to a preexisting batch file.
var commandpath = "C://FilePath/command.bat
var commandfile = File(commandpath)
var command = "ECHO OFF"+"\n"+"dir"+"\n"+"PAUSE";
commandfile.open("w");
commandfile.write(command);
commandfile.close();
commandfile.execute();