Regular Expression test file exist, then drive GUI

Here's a question that is actually two questions combined. Before you tell me to post 'm seperately, hear me out first please.

Is it possible to have Regular Expressions test for the existence of a certain file?
Is it possible to have a tool change it's icon, depending on a certain situation?


This is what I got myself into.
I have a Word icon in microstation that starts MS Word. The icon is the rather old WinWord 2002 icon. Some people have a newer version from Office 2013. I'd like to match the icon/tool accordingly, so people can see which version is avalable to them.

Here's what I had in mind:
On startup Microstation looks for a file (..\Office10\Winword). When that file is found, display the Word 2002 icon or tool in a tool bar. If not found, look for another file (..\Office15\Winword) and display the Word 2013 icon. If that is not found, disable the tool or hide it. Or whatever is convenient for the users.

Any chance I can pull this off?

TIA

Parents
  • Hi Ivo,


    I think the answer to both your questions is "No", but I think there is a way how to implement your request:

    Unknown said:
    Is it possible to have Regular Expressions test for the existence of a certain file?

    No, it's not possible, because there is not such symbol set available (at least I didn't find such). But it can be added, because it's possible to develop and add own symbol providers.

    Unknown said:
    Is it possible to have a tool change it's icon, depending on a certain situation?

    Not, such feature is not supported, the tool icon is static setting and cannot be modified by Named Expressions.

    So how to implement such icon?

    Step 1: Configuration variable definition

    One way is to develop own symbol provider, but it's probably not the best choice for you ;-) Fortunately we have configuration files. You can use conditionl variable definition, the syntax will be somthing like

    _OFFICE2010PATH = C:/Program Files (x86)/Microsoft Office/Office14/
    _OFFICE2013PATH = C:/Program Files (x86)/Micr...

    %if exists ($(_OFFICE2010PATH)WINWORD.EXE)
    WORD2010AVAILABLE = 1
    %endif

    Extend it to all required programs and put it into your site or project configuration file.

    Step 2: GUI customization

    It's not possible to change icons of a particular tool dynamically, but your can create separate tools for every Word or other application version and to apply own Show/Hide test for every tool, e.g.:

    ConfigVar.IsConfigVarDefined("WORD2010AVAILABLE")

    Together, when task tools will be initialized and evaluated, because only WORD2010AVAILABLE will be defined (and not WORD2013AVAILABLE), only this tool will be displayed ... and if I understand you right, it's what you would like to have ;-)

    With regards,

      Jan

    Answer Verified By: Ivo Blaauw 

  • Jan,

    Thanks a lot. You described what I was hoping to achieve. Doesn't really matter how to get there, just as long as I get there.

    To be honest; I pretty much expected the icons to be firmly fixed like a beached whale. On the other hand, maybe this will be a new feature in the future: icons and tools that behave and appear differently in a variety of situations.

    Regards

    Ivo Blaauw
    = = = = = = = = = = = = =
    Look what the CAD dragged in...

Reply
  • Jan,

    Thanks a lot. You described what I was hoping to achieve. Doesn't really matter how to get there, just as long as I get there.

    To be honest; I pretty much expected the icons to be firmly fixed like a beached whale. On the other hand, maybe this will be a new feature in the future: icons and tools that behave and appear differently in a variety of situations.

    Regards

    Ivo Blaauw
    = = = = = = = = = = = = =
    Look what the CAD dragged in...

Children