Jump to content

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


CalDude
 Share

Recommended Posts

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
Link to comment
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...

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
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...