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

PMString to int32 values

Explorer ,
Jun 01, 2020 Jun 01, 2020

Copy link to clipboard

Copied

Hi,

I have an code to bind the numeric values inside the panel. Can someone provide me some guidelines. And I have attached the doubt code which is used in my code
PMString importScript;

importScript.Append("alert( app.activeDocument.stories[i].words.length);");
PMString scriptCode("wordcode");

int32 errorCode = Utils<IExtendScriptUtils>()->RunScriptInEngine(scriptCode, importScript);
Utils<IScriptArgs>()->Clear();

// Use the suite to access the data.
K2Vector<WideString> values1;
InterfacePtr<IBPISuite> bpiSuite1(fCurrentSelection, UseDefaultIID());
if (bpiSuite1 && bpiSuite1->CanGetBPIData()) {
bpiSuite1->GetBPIData(values1);
}

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

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

textControlData1->SetString(int32(scriptCode));// which I have used to convert String to int32 values
} while (false);

Nithu
TOPICS
How to , Scripting , SDK

Views

638

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
Community Expert ,
Jun 01, 2020 Jun 01, 2020

Copy link to clipboard

Copied

Look at the following method of PMString

int32 PMString::GetAsNumber

 

-Manan

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
Explorer ,
Jun 01, 2020 Jun 01, 2020

Copy link to clipboard

Copied

Nithu_S_0-1591015633720.png

After adding the code it displays like this...

Nithu

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
Community Expert ,
Jun 01, 2020 Jun 01, 2020

Copy link to clipboard

Copied

I don't see any numeric value in the values that are displayed in your screenshot. How do you think this method should convert these string values into a number. Can you please enlighten us on what should happen according to you

 

-Manan

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
Explorer ,
Jun 01, 2020 Jun 01, 2020

Copy link to clipboard

Copied

I want to display the page count value inside the panel dynamically for that I have written the code in JavaScript. But it displays the script code inside the panel and for the reference I have attached the code above

Nithu

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
Community Expert ,
Jun 01, 2020 Jun 01, 2020

Copy link to clipboard

Copied

Here you are saying that you have called the method but the results are not as you expected, and today you post another thread that says you are not able to call the method.

https://community.adobe.com/t5/indesign/error-in-visual-studio-2015-for-c-project/m-p/11176026?page=...

What is going on here?

 

-Manan

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
Explorer ,
Jun 02, 2020 Jun 02, 2020

Copy link to clipboard

Copied

LATEST

I have solved this issue and now it works fine using C++ code not after binding the Javascript inside the sdk. And thanks for the suggestions

Nithu

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