Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using old fortran code in dos 2

Status
Not open for further replies.

mkholcomb

New member
Jun 23, 2005
5
0
0
US
Old question I think but I cannot find an answer.

I have an old fortran code that runs fine in a Dos window.
The code asks several questions interactivaly. I want to
create a UNIX like .com file to answer these questions automatically. I have looked into VBscripting but cant seem to figure it out. I can launch the fortran code but cant get the script to accept any of my answers.

Dim oShell,oExec
Set oShell = WScript.CreateObject ("WSCript.shell")
oShell.run("C:\mycode.exe" )
??? now what????
Thanks for any help!
Mark
 
Replies continue below

Recommended for you

Something like this. I've called your oShell dos.
Code:
dim dos
const app = "C:\mycode.exe"

set dos = CreateObject ("WScript.Shell")
dos.run app
' Wait for the process to be active
WScript.sleep 1000
while dos.appactivate (app) <> vbTrue
   WScript.sleep 500
wend
' Talk to it
Send "100", 200
' More sends as required
' ...
' Terminate
WScript.Quit

sub Send (pin_str, pin_delay)
   dos.sendkeys pin_str
   ' Give the program a chance to recover
   WScript.sleep pin_delay
end sub
 
Thanks for you help xwb.. Looks beautiful. Just what I was looking for.
I will try these things.

Denial,
I didnt know you could redirect.
That could be another solution.

Thank you,
Mark
 
Status
Not open for further replies.
Back
Top