ACAPI_Automate - OpenID
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-04-24
11:06 AM
- last edited on
2022-10-05
01:27 PM
by
Daniel Kassai
I have two problems:
Problem 1: When I pass GS::UniString as a parameter in the constructor the part of extension is eaten.
Problem 2: When I try to Open I got an error: 2130312312 APIERR_REFUSEDCMD
Example code with commented problems based on DoOpen form Automation example:
DoOpen() { //Based on DO_OPEN form API API_FileOpenPars fop; GSErrCode err; BNZeroMemory(&fop, sizeof(API_FileOpenPars)); fop.fileTypeID = APIFType_PlanFile; fop.useStoredLib = true; IO::Location appFolderLoc; GSErrCode errorCode = IO::fileSystem.GetSpecialLocation(IO::FileSystem::Desktop, &appFolderLoc); GS::UniString myPath = GS::UniString("empty"); IO::Name myName = IO::Name(Name); // Name pased in Constructor from GS::UniString myName.AppendExtension("pln");//Problem 1: Need to apend because passed name is up to dot for example test.pln -> test fop.file = new IO::Location(appFolderLoc, myName); err = ACAPI_Automate(APIDo_OpenID, &fop); // Problem 2: returns error :APIERR_REFUSEDCMD -2130312312 81060388 The passed identifier is not subject to the operation. if (err != NoError) ACAPI_WriteReport("Error in APIDo_OpenID:", true); delete fop.file; return; } // Do_Open
Solved! Go to Solution.
- Labels:
-
Add-On (C++)
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-04-26 03:55 PM
- You use this code inside an undoable scope (ACAPI_CallUndoableCommand).
- You executed this code inside a notification handler function (ACAPI_Notify_CatchProjectEvent).

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-04-26 11:41 AM
However, the error is still the same. The weird thing is that when I use example form Automate_Functions it's working on demo mode. However, when I use an identical approach in my registered addon it dosent work and the error appears anyway.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-04-26 03:55 PM
- You use this code inside an undoable scope (ACAPI_CallUndoableCommand).
- You executed this code inside a notification handler function (ACAPI_Notify_CatchProjectEvent).

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-04-27 10:52 AM
Tibor wrote:This was my case. I didn't realize that I was using menu registration form Properties example and there are actually called as undoable commands. Thanks a lot now it's 'working.
You use this code inside an undoable scope (ACAPI_CallUndoableCommand).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-07-22 03:42 PM
I would like to open the file without being disturbed a least with the Library Manager, Drawing manager, Midding Addon Info and Hotlink Manager - as far as I observed those menus break opening procedure.
I found useStoredLib and libGiven properties in API_FileOpenPars. But it feels like it doesn't mean to control UI only opening procedure itself.
If there is no way of modyfing the opening procedure. I was thinking about a method that clicks OK or ESC on each appearing UI element. Is it possible with DG library?
I'm aware that things will change in AC23 on startup but I'm looking for a working solution for today.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-07-22 04:37 PM
kzaremba wrote:Please check the DGEnableAutoClose/DGDisableAutoClose functions. You can find them in the DG.h header file.
I was thinking about a method that clicks OK or ESC on each appearing UI element. Is it possible with DG library?
If you call DGEnableAutoClose then each dialog will be automatically closed by ARCHICAD.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-07-23 09:03 AM
Tibor wrote:Thanks a lot for suggestion Tibor. It works perfectly and its only one line of code to make it work.. Cool
If you call DGEnableAutoClose then each dialog will be automatically closed by ARCHICAD.
