APIAny_​CreateAnAutoTextID

Creates a new entry in the Project Info.

    GSErrCode ACAPI_Goodies (
        APIAny_CreateAnAutoTextID,
        const API_Guid*     guid,
        const char*         uiKey
    );

 

Parameters

guid
[in] The guid of the autotext (stored in the database).
uiKey
[in] The string appear in the GUI (Project Info, Insert Autotext dialog).

 

Return Values

NoError
The function has completed with success.
APIERR_BADPARS
The guid or the uiKey parameter is nullptr or uiKey already exists.

For other common API errors see the API Errors document.

 

Remarks

This function is used to create a new entry in the Project Info. It will apear in the Insert Autotext dialog also.

This function is a non-undoable data structure modifier function. See more details on this topic at Command Overview.

 

Example


bool    InsertAutotext (void)
{
    char* uiKey = {"Created Via API"};
    GS::Guid guid;
    guid.Generate ();
    API_Guid dbKey = GSGuid2APIGuid (guid);

    GSErrCode err = ACAPI_Goodies (APIAny_CreateAnAutoTextID, &dbKey, uiKey);
    if (err != NoError)
        DBPrintf ("APIAny_CreateAnAutoTextID function failed.");

    if (err == NoError) {
        GS::UniString dbKey ("autotext-");
        dbKey.Append (guid.ToUniString ());
        GS::UniString value ("custom text");
        err = ACAPI_Goodies (APIAny_SetAnAutoTextID, &dbKey, &value);
        if (err != NoError)
            DBPrintf ("APIAny_SetAnAutoTextID function failed.");
    }
}

 

Requirements

Version: API 12 or later
Header: APIdefs_Goodies.h

 

See Also

ACAPI_Goodies, APIAny_GetAutoTextsID, APIAny_SetAnAutoTextID, API Functions