Page 1 of 1

Desperately need help automating

Posted: 06 Dec 2010 00:18
by sulljoh1
I am new to using batch files and I do not really know what I am doing. I borrowed a friend's files to run various unix programs. It is as follows:

@ECHO OFF
@REM ===========================================
@REM By: Autodesk Ecotect Analysis 2010
@REM ===========================================
@ECHO ECO2RAD: SETTING UP ENVIRONMENT VARIABLES...
@REM ===========================================
SET RAYPATH=.;C:\Radiance\LIB
PATH=C:\Radiance\BIN;C:\Program Files\Autodesk\Ecotect Analysis 2010;$PATH
SET DOS4G=QUIET
@REM ===========================================
@ECHO ECO2RAD: DELETING AMBIENT AND OCTREE FILES...
@REM ===========================================
IF EXIST test_grid(3).oct DEL test_grid(3).oct
IF EXIST test_grid(3).amb DEL test_grid(3).amb
IF EXIST test_grid(3)*.pic DEL test_grid(3)*.pic
IF EXIST test_grid(3).ok DEL test_grid(3).ok
@REM ===========================================
@ECHO ECO2RAD: RUNNING RADIANCE TO GENERATE VIEWS...
@REM ===========================================
RAD -o SVGA test_grid(3).rif
@REM ===========================================
@ECHO ECO2RAD: CALCULATING GRID POINTS...
@ECHO WARNING: THIS COULD TAKE QUITE A WHILE...
@REM ===========================================
rtrace -I -h -dp 2048 -ar 32 -ms 0.063 -ds .2 -dt .05 -dc .75 -dr 3 -sj 1 -st

.01 -ab 8 -aa .1 -ad 512 -as 256 -av 0.01 0.01 0.01 -lr 12 -lw .0005 -af

CAL.amb test_grid(3).oct < test_grid(3).pts > test_grid(3).dat
@RENAME test_grid(3).dat test_grid(3).ok
@ECHO ECO2RAD: GRID POINTS COMPLETE.
@REM ===========================================
@ECHO ECO2RAD: LAUNCHING IMAGE VIEWER...
@REM ===========================================
RadianceIV .\test_grid(3)*.pic
@ECHO ECO2RAD: DONE!

The program launches an image viewer called WINVIEW (rview.exe) which I have to manually close. Once I close the viewer it launches a Radiance Image Viewer (RadianceIV.exe) and gives me the output ascii formatted .OK file.

All I want is the .OK file. This is part of an automatic process that has to happen thousands of times. Can I add any lines to the batch file that will close rview.exe and RadianceIV.exe?

On an unrelated note I was able to use a batch file automatically open and run an M file in matlab, but I would also like to open and run a vbscript in another program called rhino. Is there a standard way to do this?

Thank you very much for any help

Re: Desperately need help automating

Posted: 06 Dec 2010 12:14
by aGerman
sulljoh1 wrote:All I want is the .OK file. This is part of an automatic process that has to happen thousands of times. Can I add any lines to the batch file that will close rview.exe and RadianceIV.exe?

There is a command called TASKKILL.
Try:

Code: Select all

TASKKILL /F /IM rview.exe

There are two things you have to pay attention to:
- I don't see from where you run rview.exe. If it is opened by your batch file, the batch process usually waites until the program is closed. You should use the START command to run rview.exe asynchronously.
- Now you have to define a condition when rview.exe has to be killed (e.g. if a special file is created or after a delay or maybe both...?).



sulljoh1 wrote:On an unrelated note I was able to use a batch file automatically open and run an M file in matlab, but I would also like to open and run a vbscript in another program called rhino. Is there a standard way to do this?

There is never a standard way. The (rhino-)program developers defined if and which arguments their program accepts. But I have no idea what rhino is and if you could use command line options and arguments for it.

Regards
aGerman