APIAny_​GetAutoTextKeysID

Retrieves all autotext keys and their values.

    GSErrCode ACAPI_Goodies (
        APIAny_GetAutoTextKeysID,
        char***     keys,
        char***     values
    );

 

Parameters

keys
[out] Pointer to an array of C strings to be filled with the available autotext keys
values
[out] Pointer to an array of C strings to be filled with the corresponding interpreted values (optional, can be nullptr)

 

Return Values

NoError
The function has completed with success.
APIERR_BADPARS
The passed keys parameter is nullptr.

For other common API errors see the API Errors document.

 

Remarks

21 This function and APIAny_GetAutoTextsID can only resolve non-context dependent autotexts like “PROJECTNAME”, “PROJECTNUMBER”, “COMPANY”, “SHORTDATE”. For context dependent autotexts please use APIAny_GetPropertyAutoTextKeyTableID with APIAny_InterpretAutoTextID

The function allocates memory for the string arrays and for each strings dynamically. Do not forget to dispose the retrieved pointers when you do not need them any more.

For the same purpose you can also use the APIAny_GetAutoTextsID function. You can modify the value of an autotext with APIAny_SetAnAutoTextID.

 

Example


char** keys;
char** values;

GSErrCode err = ACAPI_Goodies (APIAny_GetAutoTextKeysID, &keys, &values);
if (err == NoError) {
    Int32 count = BMGetPtrSize (reinterpret_cast<GSPtr> (keys)) / sizeof (char*);
    for (Int32 i = 0; i < count; i++) {
        if (keys[i] == nullptr) {
            BMKillPtr (&values[i]);
            continue;
        }

        DBPrintf ("AutoText[%03d] \"%s\" = \"%s\"\n", i, keys[i], values[i]);

        BMKillPtr (&keys[i]);
        BMKillPtr (&values[i]);
    }
}

BMKillPtr (reinterpret_cast<GSPtr*>(&keys));
BMKillPtr (reinterpret_cast<GSPtr*>(&values));

 

Requirements

Version: API 10 or later
Header: APIdefs_Goodies.h

 

See Also

APIAny_GetPropertyAutoTextKeyTableID
APIAny_InterpretAutoTextID
APIAny_GetAutoTextsID
APIAny_SetAnAutoTextID
ACAPI_Goodies
API Functions