using cscript.exe and vvbs script for file-stored inputs



Hi,

Im doing some weird stuff with somthing called cscript (http://
technet.microsoft.com/en-us/library/bb490887.aspx), which basically
reads inputs from a file instead of waiting for a user to type them
in.

Im using the same software setup as the guy at (http://
people.bath.ac.uk/zw215/research.html).


He gets a Matlab file to write a .vbs script. The vbs script holds the
inputs in it for cscript.exe to use.
The vbs script looks something like:
Wscript.Stdout.WriteLine "naca 4412"
Wscript.Sleep 20
Wscript.Stdout.WriteLine "pane"
Wscript.Sleep 20
Wscript.Stdout.WriteLine "oper"
Wscript.Sleep 20

(the writeline statements make the inputs, the sleep statements cause
a pause between inputs)


He then runs a .bat file from matlab with the line:
!Name_of_bat_file.bat

The .bat file reads:
Cscript.exe //NoLogo test2.vbs | xfoilP4.exe

So basically cscript gets the inputs from test2.vbs and inputs them to
the user interface of xfoil.exe

I think that's really clever, I wish it was my idea! This way you can
write vbs scritps with fprintf to modify inputs and run the executable
many times. In this example, xfoil is an aerodynamics code, and i can
make different aerofoil shapes in matlab, changing a single input in
the vbs script for each aerofoil automagically. You could even leave
it running for a few days if you wanted. The really neat thing about
it is that you don't even need to interface other language code with
matlab, so no problems with reading other programming languages or ven
understanding someone elses code for that matter.

Just thought I'd share that little gem.

Adam


.



Relevant Pages

  • cscript errors when running many concurrent vbs scripts
    ... i have a java application that spawns cscript to run a simple vbs script ... concurrent calls are made some of the cscript invocations will fail in the ... * exit code -1073741502, no stdout/stderr ... stdout = CScript Error: ...
    (microsoft.public.scripting.wsh)
  • Cscript from a SQL Stored Procedure?
    ... Basically we are trying to add code that calls the .vbs script so that when ... stored procedure gets called from the application. ... CScript Error: Loading your settings failed. ...
    (microsoft.public.sqlserver.server)
  • Re: How to add multiple computers into collection
    ... theres a great vbs script called colladd.vbs by Mark Nunn that ... cscript /nologo Colladd.vbs smsserver filename collectionID ... We are using SMS 2003 in our organization. ... created a collection and asked me to add computers into it. ...
    (microsoft.public.sms.admin)
  • Re: execute .vbs
    ... The vbs script in fact runs on my host machine via a CRT serial ... connection to a WinCE box. ... for the added serial terminal support. ... > makes mention of a 'cscript' runner for a .vbs. ...
    (microsoft.public.windowsce.embedded.vb)