Sign in to follow this  
Followers 0
CalDude

Send text to old 16-bit DOS EXE, can it be hidden?

10 posts in this topic

Hi,

I'm using AutoItX to send commands to an old 16-bit DOS program. Im calling it from VB.net with the code below. Right now the code works, but is not very elegant; it pops up a black 'dos' window and the user sees everything that's happening (although it only takes a second or two). My question is: is there anyway to hide this dos window? I'm told this program doesnt take stdin, which is why I'm turning to AutoItX. If the 'dos' window can't be hidden can it be made real small?

Thanks,

Jon

Dim cAutoit As AutoItX3Lib.AutoItX3     'declare the AutoitX DLL
        cAutoit = New AutoItX3Lib.AutoItX3       'create a new instance
        cAutoit.Run("nist14.exe")      'open the notepad window
        cAutoit.Sleep(100)     ' wait till cmd window opens
        cAutoit.Send("Y")
        cAutoit.Send("{ENTER}")
        cAutoit.Send(tempinputfile)
        cAutoit.Send("{ENTER}")
        cAutoit.Send("Y")
        cAutoit.Send("{ENTER}")
        cAutoit.Send(outputfile)
        cAutoit.Send("{ENTER}")
        cAutoit.Sleep(200)     ' wait for nist to process
        cAutoit.Send("^C")
        cAutoit.Sleep(100)       ' wait for output file to become free
        cAutoit = Nothing

Share this post


Link to post
Share on other sites



I wonder why AutoItX does not have a WinHide function. That would help.

Share this post


Link to post
Share on other sites

Well, they actually do... and then your supposed to use an AutoItX.ControlSend command with your sendkey string and some window identifier information like title and text, but I can't seem to get that to work with a commandprompt window. I'm really hoping there's a way...

Share this post


Link to post
Share on other sites

I'm not sure about command prompts. I've never known anyone to try to automate one. What exactly are you trying to do that has to be 16-bit?

Also, in VB.Net, why not run it as a System.Diagnostics.Process and set not to create window and reroute stdin.

Share this post


Link to post
Share on other sites

In AutoIt3 Beta there is function called StdinWrite that may help you but it is not in theAutoIt3X version.


.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I'm told this program does not accept stdin.

Also, I truncated the sendkeys above, the actual code was:

Dim intResult As Integer 'declare a variable to hold autoitx function return values
        Dim cAutoit As AutoItX3Lib.AutoItX3 'declare the AutoitX DLL
        cAutoit = New AutoItX3Lib.AutoItX3   'create a new instance
        intResult = cAutoit.Run("nist14.exe") 'open the notepad window
        cAutoit.Sleep(100) ' wait till cmd window opens
        cAutoit.Send("{ENTER}")
        cAutoit.Send("Y")
        cAutoit.Send("{ENTER}")
        cAutoit.Send(tempinputfile)
        cAutoit.Send("{ENTER}")
        cAutoit.Send("Y")
        cAutoit.Send("{ENTER}")
        cAutoit.Send(outputfile)
        cAutoit.Send("{ENTER}")
        cAutoit.Send("N")
        cAutoit.Send("{ENTER}")
        cAutoit.Send("Y")
        cAutoit.Send("{ENTER}")
        cAutoit.Send("3")
        cAutoit.Send("{ENTER}")
        cAutoit.Send("X")
        cAutoit.Send("{ENTER}")
        cAutoit.Sleep(500) ' ' wait for nist to process
        cAutoit.Send("^C") ' Close nist with ctrl-c
        cAutoit.Sleep(450)  ' wait for nist output file to unlock before we read it
        cAutoit = Nothing

NIST14.zip

Edited by Jonathan

Share this post


Link to post
Share on other sites

If the program accepts keys, it should accept stdin. Have you actually tryed it?

What does nist do? I'm not going to try to automate it unless I know it won't damage my computer because I don't know how to use it.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I was told by an someone I outsourced to that nist wouldnt take stdin (he was writing something himself, not using AutoItX. NIST is a program put out by the government (national institute of standards in technology) it's used to calculate injection temp and pressure for use in oil wells. In the same zip file there is a sample input file. I think the file was written in fortran5, but not 100% on that. I'll be verifying the stdin thing as soon as I can, but the Indian outsource guy is pretty knowladgable.

Edited by Jonathan

Share this post


Link to post
Share on other sites

You get to that, as I will not test the application's sdtin for the reason above. Why in the world would it not support stdin?

Share this post


Link to post
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
Sign in to follow this  
Followers 0