reteset
11-01-2009, 05:58 AM
Hi everyone
this is a commandline plugin that executes DOS commands through system's CMD.exe and retruns the output as a lua table
it also supports your custom commandline applications as long as you use a file path
i built this plugin by member requests
there is only one action with two arguments
there is no much difference between File.Run() that you familiar
table = CommandLine.Execute((string) Commandline,(number) TimeOut);
Commandline : a commanline string Ex: "ping 127.0.0.1"
TimeOut : (ms 1000 = 1 second) the time out , if you want to terminate a executed commanline application then a certain time period you can specify it here
if you set the timeout 0 then action will wait until commandline app. exits
Return Value : if an error occurs the return value is nil
the return value is a table otherwise , and the table indexes are
(string) StdOut , (string) StdError , (number) ExitCode
Execute a Standard MS DOS command :
StatusDlg.Show(MB_ICONNONE, false);
StatusDlg.ShowProgressMeter(false);
StatusDlg.SetTitle("Working..");
StatusDlg.SetMessage(" Executing Command...");
tblResult = CommandLine.Execute("ping 127.0.0.1", 0);
if (tblResult ~= nil ) then
Input.SetText("Input1", tblResult.StdOut);
Input.SetText("Input2", tblResult.StdError);
Input.SetText("Input3", tblResult.ExitCode);
StatusDlg.Hide();
else
StatusDlg.Hide();
Dialog.Message("Error", "Failed To Execute command Line..", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
end
Execute your own commandline application:
StatusDlg.Show(MB_ICONNONE, false);
StatusDlg.ShowProgressMeter(false);
StatusDlg.SetTitle("Working..");
StatusDlg.SetMessage(" Executing Command...");
local sz_commandline = _SourceFolder.."\\AutoPlay\\Docs\\ConsoleTest.exe Hello World \"NonBreaked Hello World\""
tblResult = CommandLine.Execute(sz_commandline, 0);
if (tblResult ~= nil ) then
Input.SetText("Input1", tblResult.StdOut);
Input.SetText("Input2", tblResult.StdError);
Input.SetText("Input3", tblResult.ExitCode);
StatusDlg.Hide();
else
StatusDlg.Hide();
Dialog.Message("Error", "Failed To Execute command Line..", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
end
Screenshot : Click Here (http://www.amsplugins.com/screenshots/CommandLine.jpg)
Download : Click Here (http://www.amsplugins.com/details.asp?ID=95&CID=1)
this is a commandline plugin that executes DOS commands through system's CMD.exe and retruns the output as a lua table
it also supports your custom commandline applications as long as you use a file path
i built this plugin by member requests
there is only one action with two arguments
there is no much difference between File.Run() that you familiar
table = CommandLine.Execute((string) Commandline,(number) TimeOut);
Commandline : a commanline string Ex: "ping 127.0.0.1"
TimeOut : (ms 1000 = 1 second) the time out , if you want to terminate a executed commanline application then a certain time period you can specify it here
if you set the timeout 0 then action will wait until commandline app. exits
Return Value : if an error occurs the return value is nil
the return value is a table otherwise , and the table indexes are
(string) StdOut , (string) StdError , (number) ExitCode
Execute a Standard MS DOS command :
StatusDlg.Show(MB_ICONNONE, false);
StatusDlg.ShowProgressMeter(false);
StatusDlg.SetTitle("Working..");
StatusDlg.SetMessage(" Executing Command...");
tblResult = CommandLine.Execute("ping 127.0.0.1", 0);
if (tblResult ~= nil ) then
Input.SetText("Input1", tblResult.StdOut);
Input.SetText("Input2", tblResult.StdError);
Input.SetText("Input3", tblResult.ExitCode);
StatusDlg.Hide();
else
StatusDlg.Hide();
Dialog.Message("Error", "Failed To Execute command Line..", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
end
Execute your own commandline application:
StatusDlg.Show(MB_ICONNONE, false);
StatusDlg.ShowProgressMeter(false);
StatusDlg.SetTitle("Working..");
StatusDlg.SetMessage(" Executing Command...");
local sz_commandline = _SourceFolder.."\\AutoPlay\\Docs\\ConsoleTest.exe Hello World \"NonBreaked Hello World\""
tblResult = CommandLine.Execute(sz_commandline, 0);
if (tblResult ~= nil ) then
Input.SetText("Input1", tblResult.StdOut);
Input.SetText("Input2", tblResult.StdError);
Input.SetText("Input3", tblResult.ExitCode);
StatusDlg.Hide();
else
StatusDlg.Hide();
Dialog.Message("Error", "Failed To Execute command Line..", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
end
Screenshot : Click Here (http://www.amsplugins.com/screenshots/CommandLine.jpg)
Download : Click Here (http://www.amsplugins.com/details.asp?ID=95&CID=1)