Highlighted

Refreshing the content

Explorer ,
Jul 10, 2020

Copy link to clipboard

Copied

Hi,

For my concern company, we have a plugin to display the document name and some count values. In that plugin we have fetched and bind the values into the panel, but I cannot refresh the values without closing the panel. For that I have used this code

 

InterfacePtr<IScriptManager> scriptManager(Utils<IScriptUtils>()->QueryScriptManager(kJavaScriptMgrBoss));
InterfacePtr<IScriptRunner> scriptRunner(scriptManager, UseDefaultIID());
PMString importScript;
PMString documentName;
importScript.Append("app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;");
importScript.Append("var documentName = app.activeDocument.name;");
//importScript.Append("alert(documentName);");
importScript.Append("app.scriptArgs.set(\"documentName\",String(documentName));");
importScript.Append("app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;");
PMString engineName("myengine");
int32 errorCode = Utils<IExtendScriptUtils>()->RunScriptInEngine(engineName, importScript);
documentName = Utils<IScriptArgs>()->Get("documentName");
CAlert::InformationAlert(documentName);
Utils<IScriptArgs>()->Clear();

 

// Update the data displayed in the panel's widgets.
InterfacePtr<IPanelControlData> panelControlData(this, UseDefaultIID());
ASSERT(panelControlData);
if (!panelControlData) {
break;
}


// Display each string returned by the suite in a line in the multi line widget.
IControlView* textControlView = panelControlData->FindWidget(kDocumentNameTextEditBoxWidgetID);
ASSERT(textControlView);
if (!textControlView) {
break;
}
InterfacePtr<ITextControlData> textControlData(textControlView, UseDefaultIID());
ASSERT(textControlData);
if (!textControlData) {
break;
}

textControlData->SetString(documentName);

 

please guide me on this..

-Monisha

Search the SDK for ActiveSelectionObserver, e.g. CustSEObserver or LinksUIPanelTreeObserver get close.

Also drop that convoluted script call and glue - have a look at IDocument.

TOPICS
How to, Scripting, Server developers

Views

72

Likes

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

Refreshing the content

Explorer ,
Jul 10, 2020

Copy link to clipboard

Copied

Hi,

For my concern company, we have a plugin to display the document name and some count values. In that plugin we have fetched and bind the values into the panel, but I cannot refresh the values without closing the panel. For that I have used this code

 

InterfacePtr<IScriptManager> scriptManager(Utils<IScriptUtils>()->QueryScriptManager(kJavaScriptMgrBoss));
InterfacePtr<IScriptRunner> scriptRunner(scriptManager, UseDefaultIID());
PMString importScript;
PMString documentName;
importScript.Append("app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;");
importScript.Append("var documentName = app.activeDocument.name;");
//importScript.Append("alert(documentName);");
importScript.Append("app.scriptArgs.set(\"documentName\",String(documentName));");
importScript.Append("app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;");
PMString engineName("myengine");
int32 errorCode = Utils<IExtendScriptUtils>()->RunScriptInEngine(engineName, importScript);
documentName = Utils<IScriptArgs>()->Get("documentName");
CAlert::InformationAlert(documentName);
Utils<IScriptArgs>()->Clear();

 

// Update the data displayed in the panel's widgets.
InterfacePtr<IPanelControlData> panelControlData(this, UseDefaultIID());
ASSERT(panelControlData);
if (!panelControlData) {
break;
}


// Display each string returned by the suite in a line in the multi line widget.
IControlView* textControlView = panelControlData->FindWidget(kDocumentNameTextEditBoxWidgetID);
ASSERT(textControlView);
if (!textControlView) {
break;
}
InterfacePtr<ITextControlData> textControlData(textControlView, UseDefaultIID());
ASSERT(textControlData);
if (!textControlData) {
break;
}

textControlData->SetString(documentName);

 

please guide me on this..

-Monisha

Search the SDK for ActiveSelectionObserver, e.g. CustSEObserver or LinksUIPanelTreeObserver get close.

Also drop that convoluted script call and glue - have a look at IDocument.

TOPICS
How to, Scripting, Server developers

Views

73

Likes

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
Jul 10, 2020 0
Advisor ,
Jul 10, 2020

Copy link to clipboard

Copied

Search the SDK for ActiveSelectionObserver, e.g. CustSEObserver or LinksUIPanelTreeObserver get close.

Also drop that convoluted script call and glue - have a look at IDocument.

Likes

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
Reply
Loading...
Jul 10, 2020 1