You are currently reviewing an older revision of this page.
With thanks to Duane Marshall for contributing this workflow that will allow you to replace cells by simply selecting a customized right-click menu item when using Windows Explorer. It's really quick slick!
Simply put, an MS-DOS Batch File is a text file filled with DOS commands that will be executed by the Windows operating system. Batch files have an extension of bat are commonly used to run frequently used commands such as deleting a series of files, renaming files, or running an program. If you're new to the concept of using or writing up batch files, you might want to explore a few external links first. In this sample tutorial, a little batch file is written to replace cells called prelim with cells called final using msbatch as the mechanism to make the file changes. If you're completly unfamiliar with msbatch, you may want to read this first: Using MSBATCH for command line processing (was *** Understanding and using MSBATCH *** ) . In addition, take a peek at MicroStation's HELP file and specifically search on repcell. Ok, now you can proceed. To get started open any text editor and write the following commands as it would apply to your situation. Save the file with a bat extension and in a safe folder such as c:\batch\: @echo off c: cd.. cd.. cd.. cd program files\bentley\program\microstation msbatch repcell.ma %1 "k:\projects\2007\cell\ABCompany.cel" y prelim final Where: @echo off suppresses the printing of each command in the window. Refer to Wikipedia > Batch File for additional information. cd.. changes the current folder. See also: Wikipedia > List of DOS Commands program files\bentley\program\microstation would be the install folder of your MicroStation. msbatch repcell.ma kicks off the msbatch utility with the Replace Cell application. %1 gets converted to a file name. "k:\projects\2007\cell\ABCompany.cel" is the name of the cell library. y tells the replace cells application to save the attributes prelim is the name of the cell to replace final is the name of the replacment cell. The next task is to add a shortcut that points to the batch file in the Windows Explorer right click menu. For example, when selecting and right-clicking on a design file in Windows Explorer, the following menu will appear. (Note, that your menu may be slightly different depending on your operating system and installed software).
In Windows Explorer, select Tools > Folder Options... In the resulting dialog, navigate to the File Types tab and highlight DGN
Choose Advanced > New and fill in the following fields: Action is the name of the entry that will be added to the right click menu. Application used to perform action would be the location and name of the batch file created earlier. Don't forget to put "%1" at the end so that the selected file will be acted upon. Use DDE enabled. Application set to ustation Note, depending upon how many version sof MicroStation you have running, you may need to input the entire path in this field. Topic set to System Note, to learn more about Dynamic Data Exchange refer to Windows Help or Wikipedia > Dynamic Data Exchange
Save all of the changes and then go proceed to right click on any MicroStation design file via Windows Explorer. Note the addition of the Update Prelim cell to Final cell menu item as per the above instructions. Selecting this option will execute the commands located in the batch file. In this case, msbatch will replace cells called prelim with cells called final and will do do without actually starting MicroStation. That's the power of msbatch!
Troubleshooting Double check your syntax! Ensure that each command entry in the batch file is correct. In other words...will they run successfully on their own in a DOS Command Window? If not, you've probably got a typo. ;-)
As you can see, knowing just a wee bit of DOS can open an entirely new world for you. Of course, it goes without saying that you should always test this kind of stuff on scrap files. Also note that the information contained in this article is designed for experienced users. This information is supplied as is and does not come with support. AskInga, Bentley Systems Inc., and the author of the workflow assumes no liability for damages direct, indirect, or consequential, which may result from the use of these instructions. Use these instructions at your own risk.
AskInga Article #309