This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
howtos:toolcoding:tool_shell_scripts [2010/03/16 12:54] shona.weldon |
howtos:toolcoding:tool_shell_scripts [2010/03/16 13:03] shona.weldon |
||
---|---|---|---|
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. | ||