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
Next revision Both sides next revision
howtos:toolcoding:tool_shell_scripts [2009/12/17 21:15]
shona.weldon
howtos:toolcoding:tool_shell_scripts [2010/03/16 12:40]
shona.weldon
Line 2: Line 2:
  
 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 this 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.
 +
 +===== TOOL interactive commands =====
 +
 +When you launch the TOOL shell you will be asked for server connection information and then you will see a prompt:
 +<​code>​ TOOL> </​code>​
 +
 +You can run tool commands directly or you can run a script from a file.  The most commonly a script file is used.  Before you run a script you will need to get to the right directory and setup the environment. ​ Here are a few common commands you may find useful, more detail can be found in the documentation under TOOL Language/​TOOL Commands.
 +  * showenv() - shows all the builtin variables like $informPath,​ $toolsDir and $dir which you may want to set 
 +  * where() - shows what directory on the server you are in.
 +  * moveto("​path"​) - changes the current directory to path which can be either a relative or full path
 +  * look() - shows what is in the current directory optionally a string can be provided to filter the results
 +
 +
 +
 +
  
 ===== Calling a Shell Script ===== ===== Calling a Shell Script =====
Line 51: Line 68:
 ===== Using Local Mode ===== ===== Using Local Mode =====
  
-One of the challenges of running shell scripts in standard mode is the need to create and shape objects. ​[objectList appears to provide a mechanism for passing in and out objects, but this seems clunky for interactive,​ low-overhead TOOL - used by SAMM, views, etc?​].  ​To mitigate this, TOOL scripts can be run in //local// mode in which TOOL objects - as files - can be accessed from and output to the the local working directory. This is especially useful if certain TOOL objects (with instance data) exist in a modelbase. These variables can be exported directly from SAMM (right click on variable | Export Variables...) to the working directory. The TOOL file format preserves shape and instance data.+One of the challenges of running shell scripts in standard mode is the need to create and shape objects. To mitigate this, TOOL scripts can be run in //local// mode in which TOOL objects - as files - can be accessed from and output to the the local working directory. This is especially useful if certain TOOL objects (with instance data) exist in a modelbase. These variables can be exported directly from SAMM (right click on variable | Export Variables...) to the working directory. The TOOL file format preserves shape and instance data.
  
 ===== Other Useful Information ===== ===== Other Useful Information =====
Line 61: Line 78:
 </​code>​ </​code>​
  
-Environment variables, including the inform path can be checked by calling the command ​''​showenv()''​.+Environment variables, including the inform path can be checked by calling the command ​(either in your script or on the command line): 
 +<​code> ​showenv() ​</​code>​
  
 Other useful TOOL navigation commands are ''​where()'',​ ''​moveto(pathName)'',​ ''​up()''​ and ''​look()'';​ the declaration ''​localinformant''​ is useful. [move this stuff further up so the user knows to get up and running quickly; inform path and home, explain these concepts earlier] Other useful TOOL navigation commands are ''​where()'',​ ''​moveto(pathName)'',​ ''​up()''​ and ''​look()'';​ the declaration ''​localinformant''​ is useful. [move this stuff further up so the user knows to get up and running quickly; inform path and home, explain these concepts earlier]
howtos/toolcoding/tool_shell_scripts.txt · Last modified: 2011/05/13 12:27 by shona.weldon