Copy link to clipboard
Copied
Hi Professionals,
For our concerned company, we have developed a plugin. In that plugin we used to bind the values dynamically and it works fine. After doing a particular action in the indesign document we used to refresh the panel to display the action count values. Here I'm facing an issue while refreshing the panel to bind the count values, but the count values get displayed in the alert box after that it shows an Indesign crash message. I don't know why it happens....
do
{
InterfacePtr<IWidgetParent> myParent(this, UseDefaultIID());
InterfacePtr<IScriptManager> scriptManager(Utils<IScriptUtils>()->QueryScriptManager(kJavaScriptMgrBoss));
InterfacePtr<IScriptRunner> scriptRunner(scriptManager, UseDefaultIID());
PMString importScript;
PMString dragDropCount;
importScript.Append("app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;");
importScript.Append(" var dragDropCount = 0;");
importScript.Append("for (var i = 0; app.activeDocument.stories.length > i; i++)");
importScript.Append(" dragDropCount += app.activeDocument.textFrames[i].texts.length;");
//importScript.Append("alert(dragdropaction);");
importScript.Append("app.scriptArgs.set(\"dragDropCount\",String(dragDropCount));");
PMString engineName("myengine");
int32 errorCode = Utils<IExtendScriptUtils>()->RunScriptInEngine(engineName, importScript);
dragDropCount = Utils<IScriptArgs>()->Get("dragDropCount");
CAlert::InformationAlert(dragDropCount);
Utils<IScriptArgs>()->Clear();
InterfacePtr<IPanelControlData> panel((IPanelControlData*)myParent->QueryParentFor(IID_IPANELCONTROLDATA));
InterfacePtr<IControlView> editBoxView(panel->FindWidget(kDragdropactionTextEditBoxWidgetID), UseDefaultIID());
InterfacePtr<ITextControlData> selectedChar(editBoxView, UseDefaultIID());
selectedChar->SetString(dragDropCount);
} while (false);
Have something to add?