Announcement

Collapse
No announcement yet.

Command line (CMD)

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

  • Command line (CMD)

    Hi guys, I'm new here and I just need a consol app, can anyone help please?

  • #2
    Hi and welcome to the forum
    Please find attached zip with console,commandline & luacom plugs
    I don't have an example at the moment but if U search forums you might find a couple
    Cheers
    Actions.zip

    Comment


    • #3
      Originally posted by hamedn53 View Post
      hi, i searched but found nothing.

      I need a project of a cmd_consol in the project, STDOUT. I'm new and I don't know how to do that.
      I want cmd logs to show in rich text box..

      can you help me?

      thank you
      Okay, you seem to have double-posted on this topic. So the above reference is from your request made at: https://forums.indigorose.com/forum/...864#post301864

      So, here's an example demonstrating how to pipe command-line output (ie. StdOut) into a RichText object, using reteset's CommandLine plugin. Colc's already provided a link (thanks, babe!) to this plugin (above), so first download the attached "Actions.zip" file you see up there. Given that you're new, you may be unfamiliar with the use of action plugins, yeah?

      So, extract the folder titled, "CommandLine' from the aforementioned zipfile to your AMS Plugins\Actions folder:
      Code:
      ie. C:\Program Files (x86)\AutoPlay Media Studio 8 Personal Edition\Plugins\Actions
      Nb. Extract the whole folder as is. Don't change anything (although you don't actually need the 'CommandLine_ExampleV8.apz' file which is in there).

      Now the example attached for you below, will work.

      To use this plugin in future, whenever you start your project, ensure the CommandLine plugin has been 'ticked' in the Action Plugins dialog. Which you'll now see listed under: Project >> Plugins from the main AMS Menu bar:



      .................................................. .................................................. .............

      If you don't want to use plugins, there is one other way to pipe command-line output (ie. StdOut) into a Lua variable. And that's by referencing the Lua IO library. For example, the function io.popen() executes a command-line program and returns a file handle from which data can be read back into Lua. This is the function's structure:

      io.popen (prog [, mode])

      And these are the available options for mode:
      • "r" - The calling process can read the spawned command’s standard output via the returned stream. This is the default.
      • "w" - The calling process can write to the spawned command’s standard input via the returned stream.
      • "b" - Open in binary mode.
      • "t" - Open in text mode.
      Consult documentation online for more info, starting here: https://www.lua.org/manual/5.1/manual.html#pdf-io.popen

      Personally, I've found this latter method problematic because it's a function that's system dependent and not available on all platforms. It's better suited for use with native Lua under Linux. Reteset's CommandLine plugin however, simplifies things, making the process a lot easier. So my advice would be to stick with that. The trade-off is having an application that's dependent on an external plugin. But the overhead is tiny, so IMO is a non-issue.
      Attached Files

      Comment


      • #4
        Originally posted by colc View Post
        Hi and welcome to the forum
        Please find attached zip with console,commandline & luacom plugs
        I don't have an example at the moment but if U search forums you might find a couple
        Cheers
        [ATTACH]n301867[/ATTACH]
        Hi Colc, thank you so much, I have found your "Actions" very useful after a lot of wasting time! So very thanks to you.

        Comment


        • #5
          Originally posted by BioHazard View Post

          Okay, you seem to have double-posted on this topic. So the above reference is from your request made at: https://forums.indigorose.com/forum/...864#post301864

          So, here's an example demonstrating how to pipe command-line output (ie. StdOut) into a RichText object, using reteset's CommandLine plugin. Colc's already provided a link (thanks, babe!) to this plugin (above), so first download the attached "Actions.zip" file you see up there. Given that you're new, you may be unfamiliar with the use of action plugins, yeah?

          So, extract the folder titled, "CommandLine' from the aforementioned zipfile to your AMS Plugins\Actions folder:
          Code:
          ie. C:\Program Files (x86)\AutoPlay Media Studio 8 Personal Edition\Plugins\Actions
          Nb. Extract the whole folder as is. Don't change anything (although you don't actually need the 'CommandLine_ExampleV8.apz' file which is in there).

          Now the example attached for you below, will work.

          To use this plugin in future, whenever you start your project, ensure the CommandLine plugin has been 'ticked' in the Action Plugins dialog. Which you'll now see listed under: Project >> Plugins from the main AMS Menu bar:



          .................................................. .................................................. .............

          If you don't want to use plugins, there is one other way to pipe command-line output (ie. StdOut) into a Lua variable. And that's by referencing the Lua IO library. For example, the function io.popen() executes a command-line program and returns a file handle from which data can be read back into Lua. This is the function's structure:

          io.popen (prog [, mode])

          And these are the available options for mode:
          • "r" - The calling process can read the spawned command’s standard output via the returned stream. This is the default.
          • "w" - The calling process can write to the spawned command’s standard input via the returned stream.
          • "b" - Open in binary mode.
          • "t" - Open in text mode.
          Consult documentation online for more info, starting here: https://www.lua.org/manual/5.1/manual.html#pdf-io.popen

          Personally, I've found this latter method problematic because it's a function that's system dependent and not available on all platforms. It's better suited for use with native Lua under Linux. Reteset's CommandLine plugin however, simplifies things, making the process a lot easier. So my advice would be to stick with that. The trade-off is having an application that's dependent on an external plugin. But the overhead is tiny, so IMO is a non-issue.
          Hi Hazard, thank you for replying, after a lot of wasting time, you have saved my life, Your guidance very awsome and because of your last attached file, command-line works like a charm very interesting, I appreaciate to you, thanks so much man.
          a little changes on the size, looks like awsome!
          Click image for larger version

Name:	snap067.png
Views:	924
Size:	12.3 KB
ID:	301873

          Comment


          • #6
            can you share the apz? how to do that? thanks

            Comment


            • #7
              Originally posted by BioHazard View Post

              If you don't want to use plugins, there is one other way to pipe command-line output (ie. StdOut) into a Lua variable. And that's by referencing the Lua IO library. For example, the function io.popen() executes a command-line program and returns a file handle from which data can be read back into Lua. This is the function's structure:

              io.popen (prog [, mode])

              Personally, I've found this latter method problematic because it's a function that's system dependent and not available on all platforms.
              I see why the Lua docs give you that idea, considering they worded it poorly. It should be available on every Windows system though. Lua can be compiled for literally anything, including potatoes (I bet), so that's why some features in Lua will not work on all of those platforms.
              Bas Groothedde
              Imagine Programming :: Blog

              AMS8 Plugins
              IMXLH Compiler

              Comment


              • #8
                I never had much luck with it under WinXP. Spent quite some time looking for a way to pipe Wget output back into AMS some months back. As I recall, what bothered me the most was that there seemed to be no way to suppress that annoying command window with this method. And in the end is what led me back to settling on reteset's plugin instead.

                Admittedly, I've never tried since moving my stuff over to Win 7 but am working under the assumption that one is likely to experience the same difficulties. I'd be stoked to see someone demonstrate io.popen() returning command-line output with a suppressed command window. Any ideas, sensei?

                Comment


                • #9
                  Originally posted by BioHazard View Post
                  I never had much luck with it under WinXP. Spent quite some time looking for a way to pipe Wget output back into AMS some months back. As I recall, what bothered me the most was that there seemed to be no way to suppress that annoying command window with this method. And in the end is what led me back to settling on reteset's plugin instead.

                  Admittedly, I've never tried since moving my stuff over to Win 7 but am working under the assumption that one is likely to experience the same difficulties. I'd be stoked to see someone demonstrate io.popen() returning command-line output with a suppressed command window. Any ideas, sensei?
                  Yes it seems that io.popen in AMS opens up a console window, I didn't experience that in other Lua environments though. I wonder why popen does that in AMS.
                  Bas Groothedde
                  Imagine Programming :: Blog

                  AMS8 Plugins
                  IMXLH Compiler

                  Comment


                  • #10
                    you can do this
                    so easy
                    create temp file
                    use os.execute()
                    redirect your command to the temp file
                    display the output at any ams object

                    How ??
                    ok

                    make a new project with a button and a listbox
                    but this code in the button

                    Code:
                    Temp = os.tmpname ()
                    os.execute ("dir c:\ > " .. Temp)
                    for line in io.lines (Temp) do
                      ListBox.AddItem("ListBox1", line, "");
                    end
                    os.remove (Temp)[B][SIZE=14px][FONT=arial][/FONT][/SIZE][/B]


                    Comment


                    • #11
                      The whole point of piping StdOut into Lua via io.popen() or via reteset's plugin, is that it does so without resorting to the use of temp files. A point which you seem to have missed?

                      Comment


                      • #12
                        the plugin may use temp files
                        who knows ?
                        -----------------------------
                        is there a code posted here about io.popen() that i can not see ?
                        so strange

                        Comment


                        • #13
                          ok
                          here is the io.popen() version

                          Code:
                          for StrLine in io.popen("dir c:\\"):lines() do
                          ListBox.AddItem("ListBox1", StrLine, "");
                          end

                          Comment


                          • #14
                            Originally posted by startup
                            the plugin may use temp files
                            who knows ?
                            It doesn't. Read the author's original thread for this plugin - elucidated at Post-10.
                            Reteset quotes, "...i made this plugin to save you from use of text file redirection."

                            "who knows ?"
                            - Anyone who bothers to take the time to look first.


                            Originally posted by startup
                            ...is there a code posted here about io.popen() that i can not see ?
                            so strange
                            Apparently so. Though it's difficult to tell whether it's your vision that's the problem, or your comprehension? The constant large, bold type suggests the first. The constant missing-of-the-point suggests the latter.

                            "so strange"
                            - No, it's really not. Clicking the lua.org link that was provided is about as basic and ordinary as it gets. As is googling, 'lua io.popen'.

                            ...............................................


                            Originally posted by startup
                            ok
                            here is the io.popen() version
                            Really??? This has to be a trolling, right? Which parts of the thread in reference to io.popen() failing to suppress the command window, did you not understand?
                            From Post-8:
                            Originally posted by BioHazard
                            What bothered me the most was that there seemed to be no way to suppress that annoying command window with this method. And in the end is what led me back to settling on reteset's plugin instead.

                            I'd be stoked to see someone demonstrate io.popen() returning command-line output with a suppressed command window.
                            From Post-9:
                            Originally posted by Imagine Programming
                            Yes it seems that io.popen in AMS opens up a console window... I wonder why popen does that in AMS.


                            @startup
                            Before posting, it'd be really helpful to actually take the time to read the thread properly. So as to adequately comprehend the nuances of the topic. Leaping in like this - with stuff that misses the point (and which is thereby irrelevant) - just sullies the entire thread. (As does your continued proclivity to post in 14px bold type. We're not blind, we're not deaf, and we all know you're here). Sigh.

                            Comment


                            • #15
                              Originally posted by hamedn53 View Post
                              Hi guys, I'm new here and I just need a consol app, can anyone help please?
                              i was answering this Question
                              No more No less


                              Originally posted by BioHazard View Post
                              Which parts of the thread in reference to io.popen() failing to suppress the command window, did you not understand?
                              Why should i care about this ??
                              And sorry
                              i am lost my focus When reading long speeches
                              Specially that have no codes inside




                              Comment

                              Working...
                              X