Jump to content

AutoIT script executable as DOS box command


Recommended Posts

I'm automating the use of a USB-connected robotic system by calling into DLLs from an autoIT script and want to make the automation work as a command line program that can be used by other batch or autoit scripts.

The problems encountered are:

1. No way to directly make the compiled script wait to return to the command prompt until execution is finished. Kludgy workaround: use start /wait commandname.

2. No way to directly make the compiled script return an error code to the command prompt environment after the execution is finished. Kludgy workaround: use start /wait commandname.

3. Return text (e.g. command line usage, error message) to the command prompt environment. Workaround: NONE.

Any ideas on how to proceed?

-brendan

Link to comment
Share on other sites

1. No way to directly make the compiled script wait to return to the command prompt until execution is finished. Kludgy workaround: use start /wait commandname.

Try:

RunWait(@ComSpec & ' /k start ' & $sCommand, '', @SW_HIDE)

(note the "/k" switch)

Link to comment
Share on other sites

Try:

RunWait(@ComSpec & ' /k start ' & $sCommand, '', @SW_HIDE)

(note the "/k" switch)

Hmm, no that wouldn't allow me to have a batch file or other scripting language wait for my script to finish.

What I am trying to do is have a compiled au3 script called "text.exe" behave like this:

1. C:\> test.exe dostuff 4<enter>

2. <20 seconds pass, prompt is not returned>

3. Error with dostuff: device is not ready after 4 retries.

4. <prompt returns>

5. C:\>

In other words, I want the compiled script itself to not return control to the dos prompt until it is finished, and also be able to output an error message (and implied, set an error level as can be done with the "c:\> start /wait test.exe dostuff" approach), or a usage message.

From purusing the forums, it appears this capability isn't available. Presumably this is because 95% of the applications are meants to use the GUI and only occassionally do developers use AutoIT scripts for command line work.

Hmm, I propose a compiler directive that would allow for this, something like "#EnableConsoleInteraction". Is this something that would be feasible in the dev cycle of AutoIT?

-brendan

Edited by bhoar
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...