Original Article Date: March 18, 2004
NTBang is an MDL application which provides a system command prompt for the execution of external programs. It is especially useful when attaching Engineering Links to elements to open external documents or to simply pop out to DOS to perform DOS commands.
In Pre-V8 MicroStation, the source code is delivered when you install the MDE Programming Tools. In addition, the source code for both MicroStation Pre-V8 and V8 can be found here http://microstation.bentley.com/files/motw/resources/utilities/V8MDLExamples.zip If you're like me and have no clue how to compile an MDL, you can grab the compiled versions from the following links...look at the very bottom for the attachment. With a huge thank you to Barry Bentley for making these available! NTBang for MicroStation pre-V8 NTBang for MicroStation V8 Now that you've got a copy of NTBang, you'll need to do a couple of housekeeping tasks: Place the compiled version of NTBang in the ...\Program\MicroStation\mdlapps\ folder, Add or set the configuration variable MS_CONSMODE = 1 And finally set MS_DGNAPPS to point to the NTBang MDL application. MicroStation V7 - NTBang Keyins: Once you've completed the above tasks, you'll be able to shell out to DOS and send DOS based keyins from MicroStation's keyin window. For example the following keyins and resulting actions can be expected in Pre-V8 versions of MicroStation. To open the DOS window use one of these keyins: dos DOS ! To open the DOS window, run a command and automatically close the DOS window: dos [command] DOS [command] ! [command] % [command]
MicroStation V8 - NtBang Keyins: For later versions of MicroStation, the results will be slightly different. To shell out to your Windows folders: DOS or dos To shell out to the DOS window: ! To shell out to DOS and run a DOS based command: ! [command]
To open a file and lauch the application associated with the file format: (MicroStation V8.5 - 2004 Edition and later) % file_name
Special Considerations for MicroStation pre-V8: DOS can only handle file and folder names up to 8 characters which means you'll have to abbreviate long names with ~1: !C:\Progra~1\Micros~1\Office\EXCEL.EXE d:\data\MyStuff.xls If you're having trouble excecuting certain commands, test the command outside of MicroStation using the normal Windows command prompt. In some situations, you may need to add Start to the beginning of the command line as follows: !start winword d:\temp\My_Notes.doc !start excel d:\temp\My_Data.xls
Final Thoughts: The keyins for NTBang and the results they produce may vary depending upon the version of your Windows operating system. The keyins for NTBang and the results they produce may vary depending upon the version version of MicroStation you're running.
AskInga Article #188