Original Article Date: July 19, 2002
Execute a BASIC macro (or run commands) every time a file is opened.2003-11-24 Included notes from MicroStation /J's ReadMe file.2005-09-27 Confirmed workflow in MicroStation V8.
2018-11-26 Updated for clarity
This following information will allow you to configure MicroStation /J or V8 to execute a startup macro each time a DGN file is opened.
Copy the .ma and .dll to the installation folder .../mdlsys/asneeded/
Dim startPoint As MbePoint
Dim point As MbePoint, point2 As MbePoint
' Send a keyin that can be a command string
MbeSendKeyin "POINT absolute"
MbeSendKeyin "FIT VIew Extended"
MS_DGNAPPS > runmacro
Now everytime a file is opened, the macro name RunMe will be run. You can also configure MicroStation to run a suite of macros. In that case you would set MS_DGNMACROS as follows:MS_DGNMACROS=The_First_Macro_to_run.baMS_DGNMACROS>The_Second_Macro_to_run.bas
2003-11-24:The following notes were posted to v8.general newsgroup by Bentley's Phil Chouinard and can also be found in MicroStation /J's ReadMe:
The configuration variable MS_MACRO is used to define the folders that contain the macros.
If RunMacro is defined in MS_INITAPPS, MicroStation /J will ignore any command line parameters and the MicroStation Manager dialog box will be opened after all macros have been completed.RunMacro can be run as both an INITAPP and a DGNAPP.
Any number of macros may be included in either the MS_INITMACROS or MS_DGNMACROS configuration variables. Simply separate the macro names with a semi-colon when using MicroStation/J's Configuration Variables dialog box, or use the ">" sign as shown above.
MicroStation BASIC macro names may be specified in the configuration variables with no extension, .BA extension, or .BAS extension.
MS_INITMACROS [is] run before a design file is opened. Therefore, the macro must not access any design file objects or attempt to do anything which requires an open design file.
Source code for RunMacro is provided with MDE. RunMacro starts MicroStation/J graphics environment using mdlSystem_enterGraphics. However, this MDL application may be modified to not start the graphics environment. In this case, the application must not perform any MicroStation BASIC function which requires graphics (like opening a dialog box, for example).
AskInga Article #116
Great Article but cannont find the MS_DGNMACROS
This is what I have, that I was able to see
Sure wanted this feature already made the macro
and stepped through it and it worked via the Utilities>Macro>MicroStation>Basic
Someone please help, Jon, Ron ??
Richard, please ask in forum (optionally with a link to this wiki page). Wiki pages themselfs are not intended for discussions and the questions can be easily missed by the most of people.
Ok, thank you again. Upon replying to you a pop up box came up with a link to the VBA version.
heading to read and download the zip file. I try but continue to make too many mistakes. Appreciate the reply