MicroStation V8i (SS3) using %if exists variable with spaces in the variable

I am not well versed in using expressions in the configuration files…

I have added this line to my User Configuration File – which allow me to access my networked MicroStation V8i (SS2) workspaces while using MicroStation V8i (SS3):

_USTN_SYSTEM_GUIDGNLIBLIST < C:/ProgramData/Bentley/MicroStation V8i (SELECTseries)/WorkSpace/System/GUI/*dgnlib

This works OK... but I do not want to modify everyone's UCF.

I want to add this configuration variable to my site configuration files (1 cfg file for each office location) so that if MicroStation determines that it is running MicroStation V8i (SS3) to load this variable and if MicroStation determines that it is running MicroStation V8i (SS2), ignore this variable.  

I have determined that there only a few differences (files/folders) between the default installs of MicroStation V8i (SS2) and MicroStation V8i (SS3).

There is a folder/file that exists on the local machine if MicroStation V8i (SS3) is installed – and does not exist if MicroStation V8i (SS2) is installed:

C:\ProgramData\Bentley\MicroStation V8i (SELECTseries)\WorkSpace\System\GUI\GUI.dgnlib

Here is what I am attempting to do in my Site Configuration File (currently testing in my User Configuration File):

%if exists ("C:/ProgramData/Bentley/MicroStation V8i (SELECTseries)/WorkSpace/System/GUI/gui.dgnlib")

               _USTN_SYSTEM_GUIDGNLIBLIST < C:/ProgramData/Bentley/MicroStation V8i (SELECTseries)/WorkSpace/System/GUI/*dgnlib

%endif

This does not work - I simply just get an error when starting MicroStation - when it hits the %if exists line.

I think this has to do with either the C:\ProgramData folder is a “hidden” folder (by default) or that there are spaces in the variable that are not being addressed by the “quotes”. I have tried this with and without the "quotes" - no difference.

So as a test, if I copy the gui.dgnlib file to C:\temp\, the following works correctly:

%if exists (C:/Temp/gui.dgnlib)

               _USTN_SYSTEM_GUIDGNLIBLIST < C:/ProgramData/Bentley/MicroStation V8i (SELECTseries)/WorkSpace/System/GUI/*dgnlib

%endif

So this tells me that my idea works and this variable is loaded when starting MicroStation v8i (SS3).

So as another test, if I copy the gui.dgnlib file to C:\ProgramData\Bentley\, the following works correctly:

%if exists (C:/ProgramData/Bentley/gui.dgnlib)

               _USTN_SYSTEM_GUIDGNLIBLIST < C:/ProgramData/Bentley/MicroStation V8i (SELECTseries)/WorkSpace/System/GUI/*dgnlib

%endif

So this tells me there is no issue with ”Program Data” being a hidden directory.

So as another test, I created my own MicroStation folder without the spaces before and after "V8i" - and this also works correctly:

%if exists (C:/ProgramData/Bentley/MicroStationV8i(SELECTseries)/WorkSpace/System/GUI/gui.dgnlib)

               _USTN_SYSTEM_GUIDGNLIBLIST < C:/ProgramData/Bentley/MicroStation V8i (SELECTseries)/WorkSpace/System/GUI/*dgnlib

%endif

As soon as I add any path that has any spaces in it, the variable no longer functions correctly.

Any ideas to get the syntax correct when using spaces?

Thanks!

David Allen

  • I finally figured it out - so I thought I would share my solution:

    I did a search to see if anything was still looking back to C:\ProgramData\Bentley\MicroStation V8i (SELECTseries)\Workspace\ after I load my custom workspaces. I only found 1 variable: _USTN_INSTALLED_WORKSPACEROOT

    After searching a little bit, I figured out that this variable is being defined here:

    C:\Program Files (x86)\Bentley\MicroStation V8i (SELECTseries)\MicroStation\config\msdir.cfg
    _USTN_INSTALLED_WORKSPACEROOT=C:\ProgramData\Bentley\MicroStation V8i (SELECTseries)\\WorkSpace/

    So now I can define %if exists (C:/ProgramData/Bentley/MicroStation V8i (SELECTseries)/WorkSpace/System/GUI/gui.dgnlib) without using any spaces.

    Here is my new config variable:
    %if exists ($(_USTN_INSTALLED_WORKSPACEROOT)system/GUI/gui.dgnlib)
    _USTN_SYSTEM_GUIDGNLIBLIST < C:/ProgramData/Bentley/MicroStation V8i (SELECTseries)/WorkSpace/System/GUI/*dgnlib
    %endif

    Now, all I am going to do it place the gui.dgnlib file in a common network directory (workspace/system) so everyone can see it/read the same file - from the same location.
  • would this work ?

    %if exists ($(_USTN_SYSTEM)GUI/gui.dgnlib)
    _USTN_SYSTEM_GUIDGNLIBLIST < C:/ProgramData/Bentley/MicroStation V8i (SELECTseries)/WorkSpace/System/GUI/*dgnlib
    %endif

    Timothy Hickman

    CADD Manager | CADD Department

    timothy.hickman@colliersengineering.com

    Main: 877 627 3772| 

    1000 Waterview Drive Suite 201 | Hamilton, New Jersey 08691

  • Tim -

    This did not work. This did not throw an error message, but it ignored the variable (did not load/see gui.dgnlib)
    I think this is because I am using a -wr workspace redirect - so it is looking to the server location of my workspaces for just about everything (including the "system" files delivered with MicroStation).
  • how about this then ?

    %if exists ($(_USTN_INSTALLED_WORKSPACEROOT)System/GUI/gui.dgnlib)
    _USTN_SYSTEM_GUIDGNLIBLIST < C:/ProgramData/Bentley/MicroStation V8i (SELECTseries)/WorkSpace/System/GUI/*.dgnlib
    %endif

    Timothy Hickman

    CADD Manager | CADD Department

    timothy.hickman@colliersengineering.com

    Main: 877 627 3772| 

    1000 Waterview Drive Suite 201 | Hamilton, New Jersey 08691

    Answer Verified By: Tim Hickman 

  • This worked great to check and see if a folder exist.  I assume it works to check for a file as well.

    _USTN_WORKSETSROOT              = $(_USTN_WORKSPACEROOT)WorkSets/

    _LOCAL_WORKSETROOT = C:/Projects/Projects_Worksets/

    %if exists ($(_LOCAL_WORKSETROOT))
    _USTN_WORKSETSROOT              = $(_LOCAL_WORKSETROOT)
    %endif

    Mike Longstreet
    Vermont Agency of Transportation
    Civil Engineering Technical Support
    VTCAD Help