Archicad C++ API
About Archicad add-on development using the C++ API.
SOLVED!

Skip exclusive access by code?

Anonymous
Not applicable
Hi!

So my goal is to open a file and to run some functions on the opened file. I am able to do that with catchprojectevent, but my problem is when the file is already opened. AC then asks if I want to open the file with exclusive access or as read only.
Is there a way to skip the message box? And choose one of it’s options automatically by code?

Thank you!
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Hi Tomer1,

If you are implementing an automation, then all the dialogs will stuck your process. I recommend you the DGEnableAutoClose function (include DG.h). This function will automatically close all the popup dialogs. Please note that it's equivalent with clicking to the default button on the dialogs.
Do not forget to call DGDisableAutoClose after your automation finished working.
Tomer1 wrote:
AC then asks if I want to open the file with exclusive access or as read only.
AC asks this when the file is used by other process, locked. If you delete the lockfile next to the project file, then your issue can be solved.
But I still think the DGEnableAutoClose/DGDisableAutoClose solution could be better, because it's a solution for all other popup dialogs also.

View solution in original post

2 REPLIES 2
Solution
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Hi Tomer1,

If you are implementing an automation, then all the dialogs will stuck your process. I recommend you the DGEnableAutoClose function (include DG.h). This function will automatically close all the popup dialogs. Please note that it's equivalent with clicking to the default button on the dialogs.
Do not forget to call DGDisableAutoClose after your automation finished working.
Tomer1 wrote:
AC then asks if I want to open the file with exclusive access or as read only.
AC asks this when the file is used by other process, locked. If you delete the lockfile next to the project file, then your issue can be solved.
But I still think the DGEnableAutoClose/DGDisableAutoClose solution could be better, because it's a solution for all other popup dialogs also.
Anonymous
Not applicable
Thanks. That was exactly what I looked for.