Announcement

Collapse
No announcement yet.

Command line (CMD)

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

  • #16
    In all fairness startup, it's not all about code. The context with the code is more important. Aside from that, BioHazard shared an example project in the third post on this thread, so there is code.

    Again though, it's not just 'ask and get code' - as a software developer or engineer code is just a tool, the context around this code is what matters.

    As for your question why you should care about the command window popping up; it's not clean, it's not neat, if the command window just sits there until a command is done. If the command is fast, the end user sees a flashing console window which might scare the novice PC user. It's always best to eliminate visual surprises.

    Let's chill out and stay on topic
    Bas Groothedde
    Imagine Programming :: Blog

    AMS8 Plugins
    IMXLH Compiler

    Comment


    • #17
      ok
      i think
      that all available surprises solutions are based on using a visible or hidden w32 dll
      no pure lua solutions
      even the plugin

      Comment


      • #18
        i just notice the APZ in post 3
        so
        Good Work BH !!

        Comment


        • #19
          Hi there,
          well, good talking here, 'Failed executing command line' by pushing "volume name , DIR and so on .." :(
          I dont want to use a temp text file that sniffers may notice on that!

          Comment


          • #20
            @hamedn53
            Can you clarify what you're trying to do? From the limited info in that last request, it looks like you're trying to return the contents of a directory via cmd? More info needed.

            Comment


            • #21
              Originally posted by BioHazard View Post
              @hamedn53
              Can you clarify what you're trying to do? From the limited info in that last request, it looks like you're trying to return the contents of a directory via cmd? More info needed.
              Yes, I do. for example, I'm trying to execute some "ADB" codes that wont returns any table to command-line, as you may know, this command-line is not supports system - file system or anything like that. If i want to make a program in AMS that flashesh , unlocking or any commands for "ADB - android flashing tools" I want the result in the AMS directly from cmd, that's what i'm trying to do. (and not writing / reading from a temp text file!)
              I have no problems in delphi Or C#. The Big problem seems being with the AMS! Is it possible with AMS after all??

              Comment


              • #22
                Upload the .apz (project file) so I can take a closer look at what's going on in there.

                Comment


                • #23
                  Originally posted by BioHazard View Post
                  Upload the .apz (project file) so I can take a closer look at what's going on in there.
                  hi , sorry for my delay,
                  I have these files in the folder named "FlashTools"
                  1. adb.exe
                  2. AdbWinApi.dll
                  3. AdbWinUsbApi.dll
                  4. fastboot.exe
                  now in AMS with command-line plugin I'm trying to execute "adb.exe" through cmd that causes "Failed, program hangs".

                  download ASUS Android Flash tools

                  thanks by the way
                  Attached Files

                  Comment


                  • #24
                    Okay, so there's a few things to take note of here: The 1st thing is that your command-line tools need to be correctly referenced. At the moment, you have them referenced as:
                    Code:
                    tblResult = CommandLine.Execute('C:\Users\Hamed\Downloads\adbdriver\FlashTools64_20161125\FlashTools\\adb.exe'..sInput, 0);
                    For the sake of convenience/testing (for the moment), drop them into the project's Docs folder, instead. So that they're referenced like this:
                    Code:
                    tblResult = CommandLine.Execute(_SourceFolder.."\\AutoPlay\\Docs\\adb.exe "..sInput, 0);
                    The critical thing to note here is that you must leave a space between the name of the command-line tool and the command being referenced via the sInput variable. You currently have:
                    Code:
                    \\adb.exe"..sInput
                    So, add the space by changing it to:
                    Code:
                    \\adb.exe "..sInput  [COLOR=#008000][I]-- note the space after 'adb.exe[/I][/COLOR][COLOR=#FF0000][/COLOR][COLOR=#008000][I]'[/I][/COLOR]

                    The 2nd thing to take note of is that if you're going to use a Paragraph object to catch the console output, then you must remember that the Paragraph object cannot append lines the way a textfile can. It requires a custom-function to give it this capability. (Have modded your apz to show how - the code is in Globals).

                    3rd and last, the above is based on the assumption that you're inputting legit 'adb' commands. When you run an 'ipconfig' command via the adb.exe, it does NOT return a single string to Std.Out as you might expect. Instead, it returns a table consisting of two values. So you have to iterate over the tblResult variable via a for/do loop, instead of trying to catch the output via the tblResult.StdOut string like you normally would.

                    So, attached below is your apz (now modded with these adjustments). But keep in mind that it's based on the 'ipconfig' command that you provided. I personally know next-to-nothing about interacting with Android apps via the command-line. So whatever commands you end up running, you'll have to work out beforehand, whether the plugin is returning a single string to Std.Out like it's designed to do; or whether it's returning a combination of values in the form of a table.
                    Attached Files

                    Comment


                    • #25
                      how to get the USB Hardware ID using cmd commandline?

                      Comment


                      • #26
                        Originally posted by telco View Post
                        how to get the USB Hardware ID using cmd commandline?
                        Hey, telco.

                        This topic has actually been covered fairly extensively already, buddy. See this thread. It's quite a long thread but covers some important issues, so take your time and have a read through it all. Then have a look at the apz-demo I posted on page-3, here.

                        Comment


                        • #27
                          Hi i managed to get it, but how to get only specific drive letter? example G:?
                          the listbox will display all the usb if i have inserted more than 1.. so i want to get only one specific drive if thats possible.
                          i already made it using luacom and wmi but it think commandline if more faster.

                          Comment


                          • #28
                            This is the WMIC command which will return a list of your USB devices (via their drive letters) to the Std.Out string:
                            Code:
                            wmic logicaldisk where DriveType=2 get DeviceID
                            ... which, you'd need to enclose (at commandline level) within an if/then statement together with the original WMIC command that's returning the Hardware IDs.

                            And as it must be done at commandline level, it'd take some time to research to figure out the correct syntax (something which I'd encourage you to look into - but which I don't currently have the inclination for). That's if you want the immutable Hardware IDs, of course. Doing it via Lua would be a lot simpler because you can just use the Drive.GetInformation() table to process the results.

                            Is there any particular reason you require it be done via immutable Hardware IDs? I get it, commandline is faster - but if that's the case, it's up to you find the commandline code required for the initial input. Am happy to help you with the Lua side of it (ie. processing the Std.Out) but you gotta do the legwork, buddy.

                            Comment

                            Working...
                            X
                            😀
                            🥰
                            🤢
                            😎
                            😡
                            👍
                            👎