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
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
Regards,