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

What is the replacement for scripting property TextStyleRanges?

Enthusiast ,
Jan 02, 2019 Jan 02, 2019

What is the replacement for scripting property TextStyleRanges?

Regards,

Chinna

TOPICS
SDK
1.1K
Translate
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

correct answers 1 Correct answer

Community Expert , Jan 10, 2019 Jan 10, 2019

Hi Chinnadk,

A strand is composed of runs, iterating runs on the kCharAttrStrandBoss class should give you what should be equivalent to textStyleRanges. You would use GetRunLength method of IStrand to iterate over the runs. I have not tested it but looking at the documentation i think this should work.

-Manan

Translate
Community Expert ,
Jan 02, 2019 Jan 02, 2019

What is the end goal here Chinna, the question is not very clear. Are you implementing something that is stuck while you use the TextStyleRanges. Some more context would help bring in better suggestions.

-Manan

Translate
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
Enthusiast ,
Jan 02, 2019 Jan 02, 2019

Hi Manan,

Thanks for your reply,

Here is the script which I have written in Javascript. I'm trying to write the same in C++ Plugin.

var doc = app.activeDocument;

var stories = doc.stories.everyItem().getElements();

for(var i=0;i<stories.length;i++)

{

        var tsr = stories.textStyleRanges;

        for(var j=0;j<tsr.length;j++)

        {

                var cValue = tsr.fillColor.colorValue;

                var tint = tsr.fillTint;

                if(tint == -1)

                {

                        tint = 100;

                    }

                for(var k=0;k<cValue.length;k++)

                {

                        if(cValue != 0)

                        {

                                var val = (cValue / 100) * tint;

                                if(val < 4)

                                {

                                        $.write(tsr.contents);

                                    }

                            }

                    }

            }

    }

If any text in the document has a tint of less than 4% then this script will write the content in the console.

For this I'm searching similar to the textStyleRanges.

Is there any other way to find the fillTint of the text in the document stories?

Regards,

Chinna

Translate
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
Enthusiast ,
Jan 09, 2019 Jan 09, 2019
Translate
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 ,
Jan 10, 2019 Jan 10, 2019

Hi Chinnadk,

A strand is composed of runs, iterating runs on the kCharAttrStrandBoss class should give you what should be equivalent to textStyleRanges. You would use GetRunLength method of IStrand to iterate over the runs. I have not tested it but looking at the documentation i think this should work.

-Manan

Translate
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
Guide ,
Jan 10, 2019 Jan 10, 2019

Have a look at.

SnpInspectTextModel::ReportParagraphs in SnpInspectTextModel.cpp.

P.

Translate
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
Enthusiast ,
Jan 10, 2019 Jan 10, 2019
LATEST

Thank you Manan/Pickory,

I will give it a try.

Translate
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