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

Binding the values dynamically inside tha panel

Participant ,
Jul 29, 2020 Jul 29, 2020

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);

-Monisha
TOPICS
Bug , How to , Performance , Scripting , SDK

Views

96

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
no replies

Have something to add?

Join the conversation