Quantcast
Channel: Adobe Community : Popular Discussions - InDesign Scripting
Viewing all articles
Browse latest Browse all 15932

How to set a keyboard event, which can response to dropdown list?

$
0
0

Hi every one

 

 

Can you set a keyboard keydown event for select the dropdown list item?

 

Thanks

Regard

John

 

 

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 

var

  w = new Window('dialog {orientation: "row", alignChildren: ["", "top"]}',"Indesign Tricks Wizard_Beta_V3", undefined, {closeButton: false}),  

  stringList = ["01   Close and SAVED",                                                        //       0

        "02   Close WITHOUT save",                                                   //       1

        "03   Save all files",                                                                //       2

        "04   Reverse",                                                                        //       3

        "-",                                                                                          //       4

        "05   Remove empty pages",                                                  //       5

        "-",                                                                                          //       6

        "06   Update years on Master in all opening Doc",               //       7

        "07   Years + 1 in Specific cells",                                          //       8

        "08   Copy and paste to Next Master",                                 //       9

        "-",                                                                                         //       10

        "09   Bring Styles and Swatches to next Doc",                      //       11

        "10   DEL and Replace Color",                                               //       12

        "11   Remove unused color",                                                 //       13

        "-",                                                                                         //       14

        "12   Remove missing link in all open files",                         //       15

        "13   Remove layer and missing link ",                                  //       16

        "14   Batch import styles from source document",               //       17

        "-",                                                                                         //       18

        "15   Gen Revised PDF",                                                        //       19

        "16   Report empty return at top",                                       //       20

        "17   Find-Change Paragraph Names",                                //       21

        "-",                                                                                         //       22

        "18   Break link from story",                                                //       23

        "19   Joint link to story",                                                       //       24

        "20   Extract pages",                                                            //       25

        "21   Joint text fame together",                                           //       26

        "22   Resize selected text"],                                                //       27

                       

                       

  mReminderString = "\"Batch import styles from source document\" usually cause indents problem.",

  lastSelected = Number(app.extractLabel("dialogWizard") ),

  p = w.add("panel", undefined, "Choose a job to do:"),

  s = p.add("group"),

  mDD = p.add("dropdownlist", undefined, stringList),

  mRem = p.add("statictext", undefined, mReminderString, {multiline: true} ),

  b = w.add('group {orientation: "column"}');

 

     mDD.preferredSize = [320,20];

     mRem.preferredSize = [320,30]; // set reminder height as 20 * line count (here 2 lines)

     if ( !lastSelected ) mDD.items[0].selected = true;

     else mDD.items[lastSelected].selected = true;

 

// |||||||||||||||||||||||||||||||||||||||||||||||| modify reminder font here |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

         w.graphics.backgroundColor = w.graphics.newBrush (w.graphics.BrushType.SOLID_COLOR, [1, 0.26, 0.2]);

     mRem.alignment = "left";

     mRem.graphics.font = ScriptUI.newFont ("Arial", "Bold", 11);

     mRem.graphics.foregroundColor = mRem.graphics.newPen (w.graphics.PenType.SOLID_COLOR, [1, 1, 1], 1);

     p.graphics.font = ScriptUI.newFont ("Arial", "Bold", 10);

     p.graphics.foregroundColor = mRem.graphics.newPen (w.graphics.PenType.SOLID_COLOR, [1, 1, 1], 1);

     mDD.graphics.font = ScriptUI.newFont ("Arial", "Bold", 11);

     mDD.graphics.foregroundColor = mRem.graphics.newPen (w.graphics.PenType.SOLID_COLOR, [1, 0.26, 0.2], 1);

// ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| |||||||||||||||||||||||||||||||||||||||||||||||

 

        var myIcon = "";

        var ib = b.add ('iconbutton', undefined, myIcon);

              ib.onClick = function() {

                     w.close(1);

                }

        w.addEventListener ("keydown", function(k) {if (k.keyName == "Enter") w.close(1);})

// ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| |||||||||||||||||||||||||||||||||||||||||||||||

        b.add ('button', undefined, "取り消す", {name: "Cancel"}); 

// ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| |||||||||||||||||||||||||||||||||||||||||||||||

 

w.show();

 

 

 

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


Viewing all articles
Browse latest Browse all 15932

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>