User Tools

Site Tools


howtos:toolcoding:tool_shell_scripts

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
howtos:toolcoding:tool_shell_scripts [2010/03/16 12:54]
shona.weldon
howtos:toolcoding:tool_shell_scripts [2010/07/07 16:03]
marcus.williams
Line 1: Line 1:
 ====== TOOL Shell Scripts ====== ====== TOOL Shell Scripts ======
  
-Sometimes it is useful to use TOOL scripts in a "​sandbox"​ or "​scratchpad"​ manner—for experimentation,​ learning new tools, instant feedback, etc.—without the overhead of setting up a new model family and framework, and without the worry of breaking anything. ​ In this cases, TOOL shell scripts can be handy.+Sometimes it is useful to use TOOL scripts in a "​sandbox"​ or "​scratchpad"​ manner—for experimentation,​ learning new tools, instant feedback, etc.—without the overhead of setting up a new model family and framework, and without the worry of breaking anything. ​ In these cases, TOOL shell scripts can be handy.
  
 Using the TOOL shell application,​ which can be launched from the Programs menu under the whatIf grouping, gives you an interactive TOOL session which can be used to run tool commands directly or run a tool script. Using the TOOL shell application,​ which can be launched from the Programs menu under the whatIf grouping, gives you an interactive TOOL session which can be used to run tool commands directly or run a tool script.
Line 16: Line 16:
   * look() - shows what is in the current directory optionally a string can be provided to filter the results   * look() - shows what is in the current directory optionally a string can be provided to filter the results
  
 +**TIP:** In the interactive TOOL window hit <​Ctrl>​ and the up arrow key to get the previous command to save typing
  
  
Line 73: Line 74:
 Suppose you wanted to test some code in a script which required building a shaped object (with an informant from your model called canReg) running a couple of tools and then showing the result with table. ​ Here's one example of how to use interactive TOOL and a tool script to do that. Suppose you wanted to test some code in a script which required building a shaped object (with an informant from your model called canReg) running a couple of tools and then showing the result with table. ​ Here's one example of how to use interactive TOOL and a tool script to do that.
  
-  ​Make a sub directory in your model account (can also be done in a user account depending on what you want to do) to hold your test script and any data it may create +  ​Make a sub directory in your model account (can also be done in a user account depending on what you want to do) to hold your test script and any data it may create 
-  ​In that directory write your script text file (myScript.t) just as you would any other piece of tool code (most similar to view writing):+  ​In that directory write your script text file (myScript.t) just as you would any other piece of tool code (most similar to view writing):
 <​file>​ <​file>​
 informant canReg[] informant canReg[]
Line 85: Line 86:
 table (myStockTot[ts]) table (myStockTot[ts])
 </​file>​ </​file>​
-  ​Launch interactive TOOL - find it under Start/All Programs/​whatIf/​TOOL +  ​Launch interactive TOOL - find it under Start/All Programs/​whatIf/​TOOL 
-  ​Login as your model account +  ​Login as your model account 
-  ​Check where you are and move to the directory you created above:+  ​Check where you are and move to the directory you created above: 
 + 
 +**TIP:** In the interactive TOOL window hit <​Ctrl>​ and the up arrow key to get the previous command to save typing 
 <​code>​ <​code>​
 TOOL> where() TOOL> where()
 TOOL> look() TOOL> look()
 TOOL> moveto("​the appropriate path to your testing directory"​) TOOL> moveto("​the appropriate path to your testing directory"​)
 +</​code>​
 +  * Make sure your $informDir points to the model informants you wish to use.
 +<​code>​
 +TOOL> showenv()
 +TOOL> $informPath = "full path to model'​s informants directory"​
 +</​code>​
 +  * Look to see that your script exists in the current directory if not check where you are and that the file actually does exist where you think it should!
 +<​code>​
 +TOOL> look()
 +</​code>​
 +  * Run your script:
 +<​code>​
 +TOOL> tool -l myScript.t
 </​code>​ </​code>​
  
 +You can modify your script with a text editor and save it and then re-run it in the same TOOL session.
  
  
howtos/toolcoding/tool_shell_scripts.txt · Last modified: 2011/05/13 12:27 by shona.weldon