I'm trying to write a script for a Batch Process. Is there a key-in to click Yes on the dialog shown below?
Hi Josh,
Jan Šlegr said:so it's not clear what product and version you use
From the dialog icon I assume you do not use MicroStation, but some civil product (OpenRoads Designer?). In such case, it's even more important to follow the best practices and to specify exactly, what product do you use (because you ask about ORD in MicroStation forum).
Josh M said:Is there a key-in to click Yes on the dialog shown below?
Oto is right, that in CE, there is no standard way how to go over modal dialog and that the key-in does not work (next reason why used version has to be specified always).
Because GUI does not allow (as far as I know) to use key-in to confirm or reject modal dialog, a workaround, where no GUI is used, must be used. You can call "one line VBA code" using key-in, without requirement to create VBA macro (-mvba file):
macro vba execute ActiveDesignFile.Models.Delete ActiveDesignFile.Models("<model name>")
for example
macro vba execute ActiveDesignFile.Models.Delete ActiveDesignFile.Models("Layout 2B")
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Answer Verified By: Josh M
Jan,
Thank you for your help. I actually tried in both ORD 2021R1 (built on MS CE Update 16) and MS CE Update 16 to no avail. I posted in MS forum since all of the help in ORD is specifically for ORD and I felt this is more of a "platform" issue, thinking I would have better luck here.
In any case, I got it to work using the key-in: macro vba execute ActiveDesignFile.Models.Delete ActiveDesignFile.Models("Layout1").
Thanks again,Josh
Please tell us what worked.
Connect r17 10.17.2.61 self-employed-Unpaid Beta tester for Bentley
Josh M said:I actually tried in both ORD 2021R1 (built on MS CE Update 16)
To be precise, other products like ORD, OBD etc. are not based on MicroStation. It was commented in the past (I am not able to find that discussion now), that all products are based on a shared core (power platform). It's the same also for MicroStation, so they all are "power products".
Even when the power platform is very close to MicroStation functionality, in details products can be different: It's not only about adding new functionality, but also any product can decide to omit specific functionality from the shared core (to forbid it using so called "feature aspects") or to modify it.
Josh M said:I posted in MS forum since all of the help in ORD is specifically for ORD and I felt this is more of a "platform" issue
Yes, that's right and makes sense, but even than it should be noted in the discussion, because there is always a chance that some difference exist between products: the feature/tool is modified in other product, or a shortcut / more powerful solution is available.
Regards,
Only issue you can get a error if no project is loaded(No VBA project available to execute under- Before executing any VBA code, you must load a project in the project manager) so add this line before but again it will show modal window if default macro exists.
macro vba new default macro vba execute ActiveDesignFile.Models.Delete ActiveDesignFile.Models("<model name>")
Oto said:Only issue you can get a error if no project is loaded
That's right, a bit annoying prerequisite.
Oto said:so add this line before but again it will show modal window if default macro exists.
In my opinion such solution is wrong, because as you wrote, it's not robust enough (does not work in all conditions).
In my opinion, better is to use configuration variable to auto load chosen VBA project, when MicroStation is started. My experience is that many (from my customers, all ;-) use it anyway to have their VBA-based tools ready automatically.
MS_VBAAUTOLOADPROJECTS > default