Thread View: adobe.scripting.indesign
4 messages
4 total messages
Started by Baljeetsingh
Tue, 17 Mar 2009 11:03
Find based on style in CS2
Author: Baljeetsingh
Date: Tue, 17 Mar 2009 11:03
Date: Tue, 17 Mar 2009 11:03
25 lines
1107 bytes
1107 bytes
Hi All
I am trying to write script for search based on paragraph style here is my code
var myDoc = app.activeDocument;
var myStylename = myDoc.paragraphStyles.everyItem().name;
var myStylenamelen = myStylename.length;
var myStyles = myDoc.paragraphStyles;
var mySlen = myStyles.length;
for (var a=0; myStylenamelen > a; a++) {
for (var j=1; mySlen > j; j++)
{
if (myStyles[j].basedOn == myStylename[a])
{
alert("Paragraph style " + myStyles[j].name + " " + myStylename[a]);
exit();
}
}
}
can anyone tell me what me doing wrong
Thanks
Shonky
Re: Find based on style in CS2
Author: Glen_Bal
Date: Thu, 19 Mar 2009 09:30
Date: Thu, 19 Mar 2009 09:30
19 lines
1173 bytes
1173 bytes
Hi,
Is this what you want:
var myDoc = app.activeDocument;
var myStyles = myDoc.paragraphStyles;
var mySlen = myStyles.length;
for (var a=0; mySlen > a; a++) {
try {
alert("Paragraph style " + myStyles[a].name + " " + myStyles[a].basedOn.name);
} catch (e) { alert("Paragraph style " + myStyles[a].name + " undefined"); }
}
I don't know why you made the big construction when you can get the name of the basedOn with no extra effort. But that could be me.
I have inserted a try-catch because you get an error when you take a basedOn of a root paragraph style.
Greetz,
Glen
Re: Find based on style in CS2
Author: Baljeetsingh
Date: Sat, 21 Mar 2009 11:49
Date: Sat, 21 Mar 2009 11:49
8 lines
917 bytes
917 bytes
Dear Glen, Thanks for help me but i want script that alert me when i used any based on style other then [No Paragraph Style] mean i want use based on style [No Paragraph Style] in my all style if it is not then script alert me. I hope you help me out Thanks Shonky
Re: Find based on style in CS2
Author: Baljeetsingh
Date: Sat, 21 Mar 2009 12:13
Date: Sat, 21 Mar 2009 12:13
25 lines
1130 bytes
1130 bytes
Hi Glen
I work out on this script now
here is what i want
var myDoc = app.activeDocument;
var myStylename = myDoc.paragraphStyles.everyItem().name;
var myStyles = myDoc.paragraphStyles;
var mySlen = myStyles.length;
for (var j=1; mySlen > j; j++)
{
if (myStyles[j].basedOn != myStylename[0])
{
alert("Your used wrong basedon style in " + myStyles[j].name + "\r Rectify it and run script agian");
exit();
}
}
alert("Your all Paragraph style based on " + myStylename[0])
but i really thanks for your response
Shonky
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads