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..
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.
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.