Copy link to clipboard
Copied
What is the replacement for scripting property TextStyleRanges?
Regards,
Chinna
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Have a look at.
SnpInspectTextModel::ReportParagraphs in SnpInspectTextModel.cpp.
P.
Copy link to clipboard
Copied
Thank you Manan/Pickory,
I will give it a try.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more