Andromo - Start Making Apps - Free Signup

Announcement

Collapse

New Forum Software

If you're here, you've found the new home for our forums. There will be some bugs to iron out, so thanks for your patience...
See more
See less

FREE CommandLine Action Plugin

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    amsplugins.com Is Closed.

    Facebook Page

  • #2
    Useful if I ever return to AutoPlay scripting.

    Comment


    • #3
      Thank you very much Reteset. I usually stay with native AMS but this one is too good to miss :yes.

      Comment


      • #4
        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. :yes
        Last edited by Centauri Soldier; 11-01-2009, 10:31 AM.
        Action Plugins
        AllOn | Box | Class | Code | Cursor | DXML | Error | Frames | GlobalPaths | Group | INIPlus |KeyBind | KeyLock | MathEx | Menu | Name | PCall | Project | Resize | StatusBar
        Download

        Comment


        • #5
          Once again a great tool thanks :yes hope i get chance to use it in the future

          Comment


          • #6
            Hey Rex, Nice to See you...

            Originally posted by rexzooly View Post
            Once again a great tool thanks :yes 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.

            Comment


            • #7
              Thnx, very usefull
              (like sside's DLL but without the .Net dependency )

              Comment


              • #8
                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?

                Comment


                • #9
                  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.

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

                  Comment


                  • #10
                    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 
                    amsplugins.com Is Closed.

                    Facebook Page

                    Comment


                    • #11
                      CommandLine Action Plugin Has Been Updated To AutoPlay Media Studio 8

                      More Info Can Be Found Here
                      amsplugins.com Is Closed.

                      Facebook Page

                      Comment


                      • #12
                        Is there still a 7.5 version?

                        Comment


                        • #13
                          you are in your lucky day , here it is
                          Attached Files
                          amsplugins.com Is Closed.

                          Facebook Page

                          Comment

                          Working...
                          X