• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Setting document tags (labels?) from C++ to be accesses from JSX

Contributor ,
Nov 24, 2024 Nov 24, 2024

Copy link to clipboard

Copied

Hi,

I want to be able to set label on the document from my C++ plugin to that the same can be accessed from the jsx file.

 

IDocument* doc = GetIDocument(...)

UIDRef ownerUID = doc->GetDocWorkSpace();

 

 

 

Later during the persisting command execution I have code similar to the following 

 

	UIDRef owner = GetItemList()->GetRef(0);

	InterfacePtr<IStringData> stringData(this, UseDefaultIID());
	CHECK_BREAK(stringData);

	PMString stringToWrite = stringData->Get();

	InterfacePtr<I> persist(owner, UseDefaultIID());
	CHECK_BREAK(persist);

	persist->SetString(stringToWrite);

	InterfacePtr<IScript> script(owner, UseDefaultIID());
	if (script) {
		PMString key = WrapperUtils<IUtilitiesWrapper>()->MakePMString(L"MyPluginLabelInfo");

		script->SetTag(key, stringToWrite);
	}

 

The 'script' pointer is coming as null while it works perfectly well for Page Items such as Text. What is the correct way to assign Tags (labels?) in the above persist implementation so that the information can be accesses from the jsx script?

Thanks,

TOPICS
How to , SDK

Views

75

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guide , Nov 24, 2024 Nov 24, 2024

kDocWorkspaceBoss has no IID_ISCRIPT. Use kDocBoss instead - ::GetUIDRef(doc).

Not sure why you run your own command, I'm using IScriptUtils::SetScriptingTag even though setup is a bit convoluted.

Votes

Translate

Translate
Guide ,
Nov 24, 2024 Nov 24, 2024

Copy link to clipboard

Copied

LATEST

kDocWorkspaceBoss has no IID_ISCRIPT. Use kDocBoss instead - ::GetUIDRef(doc).

Not sure why you run your own command, I'm using IScriptUtils::SetScriptingTag even though setup is a bit convoluted.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines