Need help working from home with your Bentley software? We're here to help - click here
Original Article Date: January 2001
Updated: August 2006
Originally titled The Power of Keyins - Part 2 and published in the July 2000 issue of the MicroStation Manager Magazine, this tutorial covers how to create script files to streamline your workflows.
The ability to string keyins together is often referred to as a keyin script or action string. Whatever terminology you use, it's all a fairly easy to understand. In addition, by understanding the various options and components of action strings, you'lll be able to create very powerful scipts to streamline your workflow and minimize repetitive tasks. Let's get started!Action StringsWhatever MicroStation does when you activate a tool, menu item or function key can be referred to as an Action String. In other words, there is always some kind of keyin that executes a set of instructions when one of these items is selected. A great example of an action string is the F8 function key which toggles the display of construction elements on or off with this keyin: set construct toggle; selview all; update all where...set construct toggle Is the actual command to turn the construction elements on or off.selview all Instructs MicroStation to apply the keyin to all views.update all Updates all the views.
Action TypesThere are a variety of action types associated with tools, view controls, menu items and function keys. Note that some of these pre-date the current version of MicroStation and are shown with a (*).
A couple of things to point out with Action Types:If no type is specified, then MicroStation assumes that it will be a command entry keyin (E).For some terrific examples of action strings, take a look at the sample tablet menu in this file: ...\workspace\system\menus\dgn\v8menu.dgn. You'll want to navigate to the Command model and view the Command Text level.
Action Type OptionsIn addition to the Action Types, there are several options which can be used following the E, T or K action types. These options can be positioned anywhere in a multiple action string and must be followed with a semi-colon.
Stringing Multiple Keyins TogetherThere are two ways of stringing keyins together. The first is to simply keyin them all in on one line and separate each keyin with a semi-colon. This is typically referred to as an action string. The other is to use a script file which is described below. Seriously, that's all there is to it.Take this for example, this action string sets up your attributes and then selects the correct drawing tool.CO=3;LV=12;LC=2;WT=4;PLACE SMARTLINEWhere:CO=3 Sets the Active Colour to number 3LV=12 Sets the Active Level to 12LC=2 Sets the Active Line Style to 2WT=4 Sets the Active Weight to 4PLACE SMARTLINE Activates the Place Smartline toolAnd this example shows the use of the various action types. After setting up the active attributes, it places a circle with a 12 inch radius at a user-defined point:CO=7;LV=23;LC=0;WT=1;E,Place Circle Radius;T,12;M,Place Manhole;%d;nullWhere:CO=7 Sets the Active Colour to number 7LV=23 Sets the Active Level to 23LC=0 Sets the Active Line Style to 0WT=1 Sets the Active Weight to 1E,Place Circle radius A command keyin which activates the Place Circle Radius toolT,12 A terminated keyin that enters a radius of 12M,Place Manhole Displays a message in the status bar which reads “Place Manhole”%d MicroStation waits for a data point which defines the location of the manhole.NULL After the arc has been placed, MicroStation executes the NULL key-in so that no tool or view control is active.Script FilesSimply put, a script file is a list of MicroStation keyins stored in an external text file such as the following two examples. Note that in this case, you can enter each keyin on a separate line rather than stringing them all together on one line as described above.
Script files can be executed a number of different ways:
Whatever your need is for stringing multiple keyins together, there's no doubt that utilizing script files will allow you to improve upon your workflows. Have fun!
AskInga Article #37