Copy link to clipboard
Copied
There is a script for increase/decrease the number line of Drop Caps in text paragraph?
I use Indesign CS-5 for windows xp.
Thank you in advance!
Hi Obi-wan Kenobi,
May be the below code will meet your requirement.
...var incrementFlag = false;
var decrementFlag = false;
var w = new Window ("dialog", "Drop Cap");
var increment_button = w.add ("button", undefined, "Increment drop cap by one");
var decrement_button = w.add ("button", undefined, "Decrement drop cap by one");
increment_button.onClick = function(){incrementFlag = true; w.close();}
decrement_button.onClick = function(){decrementFlag = true; w.close();}
w.show ();
if(incrementFlag =
Copy link to clipboard
Copied
Try this,
Place the cursor in any paragraph and run the below script:
app.selection[0].dropCapCharacters = 2; //number of drop cap characters
app.selection[0].dropCapLines = 2; //number of drop cap lines
Vandy
Copy link to clipboard
Copied
Hi Cris,
Try this also.
var myTxt = app.selection[0];
myTxt.dropCapCharacters = 1;
myTxt.dropCapLines = myTxt.lines.length;
//Or you can use the below method.
myTxt.dropCapLines = 3;
thx,
csm_phil
Copy link to clipboard
Copied
Hi vandy88 and csm_phil,
As I've posted in 2 others situations, I think that Cris Ider talk about the possibility to modify the number of lines by incrementation.
So, after selecting a para with a drop cap, e.g., on 3 lines, he would want make it on 2, 4, 5, … lines.
For that, use 2 [JS]: one for increase the number of lines, the other to decrease it! ![]()
Copy link to clipboard
Copied
Hi Obi-wan Kenobi,
May be the below code will meet your requirement.
var incrementFlag = false;
var decrementFlag = false;
var w = new Window ("dialog", "Drop Cap");
var increment_button = w.add ("button", undefined, "Increment drop cap by one");
var decrement_button = w.add ("button", undefined, "Decrement drop cap by one");
increment_button.onClick = function(){incrementFlag = true; w.close();}
decrement_button.onClick = function(){decrementFlag = true; w.close();}
w.show ();
if(incrementFlag == true)
{
app.selection[0].dropCapLines = app.selection[0].dropCapLines + 1;
}
else if(decrementFlag == true)
{
app.selection[0].dropCapLines = app.selection[0].dropCapLines - 1;
}
Vandy
Copy link to clipboard
Copied
Hi Vandy,
Cool! ![]()
A question: Is this code difficult to write: Conserve the window opened while we test the drop cap and Include a "X" to close the window when the drop cap is OK?
Copy link to clipboard
Copied
Hi Obi-wan Kenobi,
I never tried such scripting in UI, but the below code will be closer to your requirement.
var mainFlag = false;
var incrementFlag = false;
var decrementFlag = false;
var incre_count = 0;
var decre_count = 0;
var w = new Window ("dialog", "Drop Cap");
var incrementGroup = w.add ('group');
var increment_button = incrementGroup.add ("button", undefined, "Increment drop cap by one");
var increment_txt = incrementGroup.add('edittext', [30,20,100,50]);
var decrementGroup = w.add ('group');
var decrement_button = decrementGroup.add ("button", undefined, "Decrement drop cap by one");
var decrement_txt = decrementGroup.add('edittext', [30,20,100,50]);
increment_button.onClick = function(){decre_count = 0; decrement_txt.text = ""; incrementFlag = true; incre_count++; increment_txt.text = incre_count;}
decrement_button.onClick = function(){incre_count = 0; increment_txt.text = ""; decrementFlag = true; decre_count--; decrement_txt.text = decre_count;}
OK_Btn = w.add('button', [25,115,100,150], 'OK');
OK_Btn.onClick = function(){
if(increment_txt == "" || decrement_txt == ""){
alert("Fields should not be blank !!!")
}
else{
mainFlag = true;
w.close();
}
}
w.show ();
if(mainFlag == true)
{
if(incrementFlag == true)
{
app.selection[0].dropCapLines = app.selection[0].dropCapLines + incre_count;
}
else if(decrementFlag == true)
{
app.selection[0].dropCapLines = app.selection[0].dropCapLines + decre_count;
}
}
Vandy
Copy link to clipboard
Copied
Vandy,
I know that writing lines of code can be extremely complex!
I'm very curious and, in fact, I think the ideal way would be to see "in live" the changes! ![]()
Copy link to clipboard
Copied
Thank you for script!
I just modifyed the script to increase:
And decrease:
Copy link to clipboard
Copied
Thank you for help me!
I apreciated your script!
Copy link to clipboard
Copied
Thank you for help me!
I apreciated your script!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now