Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-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
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
 
Is there some reason you cannot simply use DOS's redirected input capability, with a command line resembling:
[tt]MyProg < MyAnswers.txt[/tt]
 
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.

Part and Inventory Search

Sponsor