Key-ins are what drive the Batch Process utility. Adding key-ins to your command file allows you to direct the set of actions that will be applied and the order in which to apply them. It is possible to use MicroStation key-ins directly, run a MicroStation VBA Macro or an MDL application through a key-in, and potentially integrate key-ins from a specific vertical application if that application is also running (such as those commands associated with a specific PowerPlatform).
You may ask yourself, “How do I find the key-ins to use?” Locating the desired key-ins can range from quite easy to difficult, or not possible to locate at all if a key-in doesn’t exist for what you are trying to do. Let’s look at a couple of possibilities.
The Key-in Browser
The Key-in browser is probably the first place most will go to start looking for key-ins…it is logical to look for key-ins in a “Key-in” dialog. In the MicroStation CONNECT Edition the Key-in browser can be opened several different ways:
Let’s say that you want to remove any unused levels in a set of DGN files. In the Key-in dialog it is reasonable to begin searching for key-ins that start with the word delete.
Begin by typing in a few characters from the word delete. The display of key-ins is alphabetical…dropping to the first word (key-in) that begins with the characters supplied. You can see “delete” in the list within the first column.
Next, in the second column, scroll down in the list. Here you see displayed the key-ins that can be used to delete various things, including unused items. Pick “unused” in this column.
In the third column you will see displayed the individual types of unused items that can be deleted, including levels. The key-in for deleting unused levels from within the active DGN has just been discovered!
But not all key-ins are quite that logical to locate, with many key-ins having existed for many years and software generations.
Note: Not every command has an equivalent key-in. You may occasionally run into a situation where a key-in for what you are trying to do is not available
Review an Existing Tool
Another way to discover a key-in is to look at existing tools and interface items through the customize dialogs (Customize and Customize Ribbon). From Search Ribbon, type in the first few characters of the word “customize”, picking Customize from the search results shown. This opens the Customize dialog.
In the left pane of the Tools tab, expand Application Tools > MicroStation. Here you will find many of the tool boxes and tools found within MicroStation.
Pick a tool within a tool box. Once selected, you will see the Properties for that tool, including the Command Data. The Command Data is where the key-in for the command con be found. In the following illustration, Fit View has been selected. As can be seen in the Key-in field, the command to fit the view is “fit view extended”.
Finding a Key-in Using the Bentley Macro Recorder
Another way of attempting to locate a key-in is to record a command (or sequence of commands) using the Bentley Macro Recorder. The Bentley Macro Recorder provides a set of features to allow non-programmers to record and play back macros. Once recorded, the macro is saved as a .bmr file and stored at the location identified through the MS_MACRONEWFILEDIRECTORY configuration variable.
From the Utilities tab in the Drawing workflow, locate the Macros ribbon group. As was done in the previous example, an attempt will now be made to locate the “fit” command.
The macro editor is then opened with the recorded command displayed. What is seen here differs from that seen earlier when viewing the Fit View tool through the Customize dialog. When the macro was recorded, the number “1” was appended to the key-in: FIT VIEW EXTENDED 1
The addition of the “1” is used to designate which view window the command should be applied to. The key-in could be modified to specify any of the view windows 1-8:
Note: The sequence that was recorded by the Bentley Macro Recorder could have been much more extensive than the example seen here. The macro could then be used to identify potential MicroStation key-ins or the macro could be ran as a macro file (.bmr file) using a key-in within a command file.
Additional useful key-ins
The following is a list of some additional key-ins that you may find useful when creating a command file, some of which are illustrated in the examples that may be downloaded from this blog post. Remember, when it makes sense to do so, more than a single command can be issued from a line within the command file. A string of commands is composed of individual key-ins (on a single line) that are separated by a semicolon. Additional useful key-ins include:
These are certainly not the only key-ins that can be used in command files for the Batch Process utility. There are multitudes of additional useful key-ins that can be applied to meet your needs.
The Batch Process utility is a powerful tool in your Bentley toolbox. The next time you need run a sequence of commands give it a try!