Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 13 of 13
  1. #1
    Join Date
    May 2006
    Posts
    1,443

    FREE CommandLine Action Plugin

    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
    Code:
    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 :


    Code:
    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:


    Code:
    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

    Download : Click Here

  2. #2
    Join Date
    Oct 2009
    Location
    Merton, United Kingdom
    Posts
    684
    Useful if I ever return to AutoPlay scripting.

  3. #3
    Join Date
    Aug 2003
    Posts
    2,427
    Thank you very much Reteset. I usually stay with native AMS but this one is too good to miss .

  4. #4
    Join Date
    Jun 2007
    Location
    Delphi II
    Posts
    1,534
    Thanks so much Reteset, I was working on one of these (based on one of sside's dlls) but now I don't have to finish it....

    It couldn't have come at a better time either, I have been using created batch files in one of my projects to run the commands; this plugin will solve that work-around.

    Nice job and thanks again for the contribution.
    Last edited by Centauri Soldier; 11-01-2009 at 09:31 AM.
    Action Plugins
    AllOn | Box | Class | Code | Cursor | DXML | Error | Frames | GlobalPaths | Group | INIPlus |KeyBind | KeyLock | MathEx | Menu | Name | Project | Resize | StatusBar
    Download

  5. #5
    Join Date
    Jul 2007
    Posts
    1,512
    Once again a great tool thanks hope i get chance to use it in the future

  6. #6
    Join Date
    Aug 2007
    Location
    Leon, Mexico.
    Posts
    406

    Hey Rex, Nice to See you...

    Quote Originally Posted by rexzooly View Post
    Once again a great tool thanks hope i get chance to use it in the future
    I wonder if u will change your undernick soon.
    That will differece you from the rest off us... rigth... a new level rigth...

    Nice to se you Rex, Bye.

  7. #7
    Join Date
    May 2004
    Location
    Belgium
    Posts
    129
    Thnx, very usefull
    (like sside's DLL but without the .Net dependency )

  8. #8
    Join Date
    Jan 2001
    Location
    Anderson Island, WA, USA
    Posts
    2,863
    does this work if you have standard output redirected to a file? ie: does it trap stderr output to the table and leave stdout into a redirect file?
    or is a wrapper for calling the command interpreter and redirects output?


    (Click here to contact me)
    Providing Independent Professional Consulting Services for
    IndigoRose products, World Wide.
    Located in -8:00 (-7:00 DST) GMT Timezone (Western United States)

  9. #9
    Join Date
    Apr 2004
    Location
    Vancouver, Canada
    Posts
    1,790
    At least in my tests, if the commandline app as an option to output to a file, it will still output to the file as well as return the output in the returned table.

    Quote Originally Posted by jassing View Post
    does this work if you have standard output redirected to a file? ie: does it trap stderr output to the table and leave stdout into a redirect file?
    or is a wrapper for calling the command interpreter and redirects output?
    Dermot

    I am so out of here

  10. #10
    Join Date
    May 2006
    Posts
    1,443
    Quote Originally Posted by jassing View Post
    does this work if you have standard output redirected to a file? ie: does it trap stderr output to the table and leave stdout into a redirect file?
    or is a wrapper for calling the command interpreter and redirects output?
    yes it does so ,
    but why did you want to redirect output to file ??
    whereas you already have that data

    i made this plugin to save you from use of text file redirection
    also this plugin makes necessary CODE page conversion too
    of course if you work for only english systems this is not a problem
    but in non-english operating systems you need to make some text conversions to avoid unexpected sysbols

    if you want to have both ,you could just use something like below


    PHP Code:
    tblResult CommandLine.Execute("SYSTEMINFO",0);

      if (
    tblResult ~= nil then
      
        
    if (tblResult.ExitCode == then -- 0 means success in MS DOS
        
         TextFile
    .WriteFromString("C:\\MyFile.txt"tblResult.StdOutfalse);
         
         else
         
         
    Dialog.Message("Error"tblResult.StdErrorMB_OKMB_ICONINFORMATIONMB_DEFBUTTON1);
        
    end
       
      end 

  11. #11
    Join Date
    May 2006
    Posts
    1,443
    CommandLine Action Plugin Has Been Updated To AutoPlay Media Studio 8

    More Info Can Be Found Here

  12. #12
    Join Date
    Jul 2010
    Posts
    10
    Is there still a 7.5 version?

  13. #13
    Join Date
    May 2006
    Posts
    1,443
    you are in your lucky day , here it is
    Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts