|
Saving and Using a Script |
Top Previous Next |
|
The IDE has a facility to allow one to run a set of pre specified commands though the Utilities>script menu choice, A script can be a set of pre specified commands stored in a text file and can be built either manually or by recording commands much as one can do with spreadsheet macros. The most important commands that can be used in a script are as follows Fileopen - Opens a GAMS job Filerun - Runs a GAMS job Filewait - Waits until a running GAMS job is complete
The general format of these commands is
Fileopen;filename; Filerun;filename;command line parameters Filewait;filename;
where filename gives the name of the file to be run which is proceeded by %ProjDir% if it is in the project directory and otherwise needs the full path specified. command line parameters gives any command line parameters that are to be associated with the GAMS job. Example One could manually prepare a script file (script.txt) as follows fileopen;%ProjDir%trandata.gms; filerun;%ProjDir%trandata.gms; s=r1 filewait;%ProjDir%trandata.gms; fileopen;%ProjDir%trandata.gms; filerun;%ProjDir%tranmodl.gms; r=r1 s=r2 filewait;%ProjDir%tranmodl.gms; fileopen;%ProjDir%trandata.gms; filerun;%ProjDir%tranrept.gms; r=r2 filewait;%ProjDir%tranrept.gms;
which implements the save restart example from above.
One cam also use the command
Message;text to put in message box;
that inserts a yes no message box to inform the user but note this requires a mouse click answer and stops the job until it gets that answer.
Example (script1.txt)
*GAMSIDE script V1 filerun;%ProjDir%trandata.gms; s=r1 filewait;%ProjDir%trandata.gms; message;Data job done ; filerun;%ProjDir%tranmodl.gms; r=r1 s=r2 filewait;%ProjDir%tranmodl.gms; message;Model job done ; filerun;%ProjDir%tranrept.gms; r=r2 filewait;%ProjDir%tranrept.gms; message;Whole job done ; Notes
|