Autodesk

Development site for Square One's software and teaching resources


Scripting

The standard ECOTECT distribution comes with a tool called the Script Manager which allows you to write scripts to control many of the more complex aspects of the modelling and analysis functions. You can start this tool using the Scripting... item in the Tools menu.

The scripting functions within ECOTECT offer users significant opportunity to extend its capabilities in ways we probably can't even imagine.

What is a Script

Basically, a script is a series of instructions laid out in a text file, typically supplied by a user and interpreted in more-or-less real time. By interpreted we mean that the text is directly read and executed by the script processor rather than having to be be first compiled into some binary executable form.

We can divide script instructions into different categories based on the what they do within the script. These categories include:

  • Commands to be sent to the host application,
  • Numbers, strings and variables for storing different types of data and information,
  • Expressions for manipulating numbers, strings and variables,
  • Flow control statements to determine the order in which everything occurs, and
  • Functions that group sub-sets of commands into a re-usable blocks.

From Help File

To load a script either drag and drop it into the Script Manager from Windows Explorer or select the Open... item from its File menu.

To run the script, choose Run Script item from the Script menu, or simply press the F9 key.

... abort a script half way through ? To abort a script while it is running, simply press the Escape key at any time in the Script Manager. It continually polls this key, however there may be a short pause as it communicates with ECOTECT. Alternatively, if ECOTECT is in the middle of a calculation, aborting this using the Escape key within ECOTECT will also cancel the script being run.

If the Script Manager appears to be locked and will not abort with the Escape key, simply choose the Disconnect From Server item in the Script menu. This will sever the connection and abort the script.

... find example scripts to see how things are done ? Example scripts are provided in the Scripts page on the Square One web site.

This is quite an active page with new scripts posted quite regularly so it may be work checking regularly to find the type of code you are after.

... find a particular script command if I am unsure ? Unfortunately, simply writing the Script Manager help file took me long enough - ordering all the commands alphabetically didn't even come into it. I kind of figure that they are so disparate that alphabetically probably wouldn't help anyway...

To get help on a particular command, simply place the cursor somewhere within the text you wish to look for and hit the F3 key. This will display the associated description in the help panel to the right-hand side.

... add or edit a command entry shortcut ? To add a new command shortcut, you will need to edit the ECOTECT command file. The quickest way to do this is to enter the edit command within the Command Entry Box. This will display the Ecotect_v550.cmd file within Notepad. Simply make the changes you need and save the file. ECOTECT will automatically detect the changes and use the new commands.

See the Command Entry Box page for more details on the location of the file and the format of commands.

Schedules and Operational Profiles

HOW WOULD YOU RATE THIS PAGE/DEFINITION ?

No votes yet