[CE VBA] Configuration variable query?

I am working on our company configuration and looking at -debug files is making my eyes cross.

I would like to write a VBA project to help me analyze variables, but I'm not sure if I can do what I want. I'd like some suggestions for a direction.

For instance, I might like to redefine _USTN_HOMEPREFS but I have no easy way of finding all the places _USTN_HOMEPREFS is used. I don't want the expansion, I want to know the names of other variables that are defined using _USTN_HOMEPREFS.

Or I'd like to look at MS_DEF and see a listing of the files and variables that process through to the current configuration. Some kind of single variable debug; the final expansion value is great, but I'd rather know how we got there.

Or even a VBA that could sort through the -debug text file so I could isolate all mentions of a single variable. This may be the easiest...Go through the debug, line by line. If the variable is mentioned in that line, copy the whole line to a text file and move to the next line.

I currently have OpenRoads Designer 2020 R3 (V. 10.9.0.91) I am limited to VBA by my distinct lack of programming ability.

Thank you.
MaryB

  • Hi MaryB,

    Yes its possible to create a project where you could select either a debug file or multiple CFG files and basic perform string operations on their contents however, from what you have mentioned by looking to track down instances of the variables, I would suggest to you a far simpler and more powerful solution:

    1. Download Notepad++
    2. Drag all your CFG files into the window (and debug text file too if you so wish)
    3. Open the search function on whatever variable(s) you wish to review (you have the option to search all open files as the search utility is quite comprehensive). The search results list every instance and, what file they occur and on what line. Double clicking each search result opens that file and highlights the instance.
    4. You can also highlight a string of text e.g variable name, and press the Binoculars (search button) and it will paste the string into the Find What box. Additionally, you can double click a variable name and all instances in a file will highlight. You can also create your own visual formatting style for CFG files too.

    I personally don't have any issues with tracking down variables usage as I leave the Standards.cfg in its delivered state and have 7 different CFG files of my own (also seen in the above image) where I have variables organised and processed in a specific order which makes for an easy to manage system, however Notepad++  being such a good text editor, makes the job so much easier than trying to do the same task in Notepad.

  • I would like to write a VBA project to help me analyze variables

    Here are a couple of articles that may be useful...

     
    Regards, Jon Summers
    LA Solutions

  • Hi Mary,

    I would like to write a VBA project to help me analyze variables, but I'm not sure if I can do what I want. I'd like some suggestions for a direction.

    Hmmmm ... it depends on

    • What do you want to achieve (because some things are not possible or can be done using specific workflow)
    • What type of information you would like to obtain (because some information is not available in MicroStation session)

    ... and, unfortunately, VBA is not the best tool for some operations.

    For instance, I might like to redefine _USTN_HOMEPREFS but I have no easy way of finding all the places _USTN_HOMEPREFS is used.

    That's good question, but it's not possible. The problem is that MicroStation knows the variable definition, but it does not know "steps before". A simple example:

    • _USTN_HOMEPREFS is used to define (for example) MS_DWGDATA=$(_USTN_HOMEPREFS)dwgdata\
    • You can see this definition in Configuration Variables dialog (but not to access it using VBA)
    • But you cannot see that _USTN_HOMEPREFS itself is defined using _USTN_HOMEROOT

    Because of that, it's possible to find "direct impacts" of the variable change, but not (in a simple way) to find further impacts..

    A workaround can be similar to what wrote:

    • Create msdebug.txt for original state
    • Change _USTN_HOMEPREFS definition
    • Create 2nd version of msdebug.txt
    • Use any software able to compare two text files, where you should be able to identify all changes, not only where _USTN_HOMEPREFS is used directly
    Or I'd like to look at MS_DEF and see a listing of the files and variables that process through to the current configuration.

    To go through msdebug.txt is the only option I guess.

    Or even a VBA that could sort through the -debug text file so I could isolate all mentions of a single variable. This may be the easiest.

    As I wrote above, I think it's not the easiest (because it's not simple), but it's the only way, because MicroStation (during a session) does not know how workspace configuration was processed. Even when in C++ API (and maybe also in NET) there is ConfigurationManager API available, it also does not provide complete information.

    But, VBA is not in my opinion the right tool to write such tool, because of very limited string parsing and other missing advanced features. Something like C# is probably better tool to analyze msdebug.txt (or, even better, to analyze all cfg files directly ;-)

    Regards,

      Jan