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

Script for increase/decrease the number line of Drop Caps?

Explorer ,
Sep 02, 2014 Sep 02, 2014

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!

TOPICS
Scripting
1.3K
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

Enthusiast , Sep 03, 2014 Sep 03, 2014

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 =

...
Translate
Enthusiast ,
Sep 02, 2014 Sep 02, 2014

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

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
Advocate ,
Sep 02, 2014 Sep 02, 2014

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

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
LEGEND ,
Sep 03, 2014 Sep 03, 2014

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! 

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 ,
Sep 03, 2014 Sep 03, 2014

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

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
LEGEND ,
Sep 03, 2014 Sep 03, 2014

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?

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 ,
Sep 03, 2014 Sep 03, 2014

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

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
LEGEND ,
Sep 03, 2014 Sep 03, 2014

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! 

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
Explorer ,
Sep 03, 2014 Sep 03, 2014

Thank you for script!

I just modifyed the script to increase:

  1.     app.selection[0].dropCapLines = app.selection[0].dropCapLines + 1;
  2. }

And decrease:

  1.     app.selection[0].dropCapLines = app.selection[0].dropCapLines - 1
  2. }
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
Explorer ,
Sep 03, 2014 Sep 03, 2014

Thank you for help me!

I apreciated your script!

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
Explorer ,
Sep 03, 2014 Sep 03, 2014
LATEST

Thank you for help me!

I apreciated your script!

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