How to remove colors custom Script UI control?

Dear forum,

I am writing a script for batch renaming links in InDesign.

1.jpg

If the user types the text edit field the new name which coincides with name of the original link (1st static text in the Group), the script gives a warning and he painted red.

2.jpg

3.jpg

When the user solves the problem by making the new different name, the script he painted black.

15-11-2015 20-30-37.jpg

Here's where I got so far:

g.et.onChange = function() {
    if (this.parent.children[0].text.replace(/\.[^\.]+$/, '') == this.text) {
        alert("\"" + this.text + "\" - the new name is the same as the old one! The file won't be renamed.", "Error", true);
        this.graphics.foregroundColor = this.graphics.newPen(this.graphics.PenType.SOLID_COLOR, [1, 0, 0], 1);
    }
    else {
        if (this.graphics.foregroundColor != undefined) {
            $.writeln("Names are different: change the name from red to black.");                        
            this.graphics.foregroundColor = this.graphics.newPen(this.graphics.PenType.SOLID_COLOR, [0, 0, 0], 1);
        }
    }
}

"g" is the text in a group.

I wonder, is there a way to reset the color to the default text instead of repainting it?

Currently, it checks if foregroundColor of graph is not undefined - which is painted with "newPen" - and if it is true, he painted black. But I guess it is a clumsy workaround and there should be a good way to do this.

Kind regards

Kasyan

Hi Kasyan

Pre CC could set the color to null, CC, this causes an accident.

PS there are other options (color theme), but not on ID so paint is the only option I know.

The challenge is dealing with default colors that depend on the setting. To change the text in the foreground is always black background colors you can either take the approach here Re: Re: Re: Re: ScriptUI: element of change to the default color

Or a longer but more effective approach would be to go pass 100 values possible topic and get the associated rgb values.

Probably not interesting put in a lot of effort as the way things are going THAT SUI will not support editing text in a few years.

Concerning

Trevor

Tags: InDesign

Similar Questions

  • indexed - color mode how to remove a custom color table color

    Hello

    I'm working on a bitmap to which I put my color mode to "indexed color Mode.  I created a custom color table and I added 9 colors.  I would like to delete one of these colors, but I can't find a way to remove a color from my existing custom color table or start with an empty custom color table so that I can add only colours I want.  If someone can tell me how to do either of these things, I'd be very happy.

    Thanks in advance,
    Paul

    I had the same problem. I'm not sure that you can remove colors. I just changed the color, I'm not one of the existing colors that I want. It does not hurt to have two colors of the same value in the table.

    Edit: This is what I warned you about in your other post.

  • How to remove a custom theme color scheme

    Once a custom theme color scheme is created and recorded, how this set of custom colors can be deleted?

    Jay, I don't have time to test today, but did you read my last blog post?

    Captivate 8.0.1 Install? Keep your customization! -Captivate Blog

    You will find the path to the custom theme color palettes here, maybe delete the custom theme and restart CP will do?

  • How to remove a Custom DDL or ObjectChoiceField

    Hi all

    I am doing a shopping basket sort of thing...! for this I need to change the dropdownlists dynamically on the selection.

    !) When the user selects the button category, main ddl should be updated.

    (2) when the user selects a subacaegory of DOF, DOF sub must be courses.

    I realized this some how... dynamically, I changed the reference to the ddl and updated. It works fine but the problem is, when an another DOF makes its appearance the previous is there remain only and a new is overwhelming at this point. as a result when the width of the new ddl is lower than the previous ddl, it appeared in her underwear, which kills the look and feel of the screen.

    in some ways, I tried to remove the ddl, but it does not work for me.

    Please suggest me how to remove the ddl dynamically, when I try to remove it, it gives IllegalArgumentException meaning is the ddl

    not this Manager field. I'm removing the same administrator only, but I have not found why it's happening...!

    Please help me! Here is my

    It's my custom ddl code.

    public class CustomComboBox extends ObjectChoiceField   {
    
          private int width;        public boolean itemadded = false;
    
    //       CustomComboBox()//        {////         super("Currency",curr, 0, ObjectChoiceField.FIELD_LEFT);//        }     public CustomComboBox(String str,String []curr, int width)        {         super(str, curr, 0, ObjectChoiceField.FIELD_LEFT | ObjectChoiceField.USE_ALL_WIDTH);          this.width = width;           Font font = this.getFont().derive(Font.EMBOSSED_EFFECT | Font.BOLD, 14);          this.setFont(font);
    
         }     public CustomComboBox(String str,String []curr, int startindex, int width)        {         super(str, curr, startindex, ObjectChoiceField.FIELD_LEFT | ObjectChoiceField.USE_ALL_WIDTH);         this.width = width;           Font font = this.getFont().derive(Font.EMBOSSED_EFFECT | Font.BOLD, 14);          this.setFont(font);       }     protected void layout(int width, int height)      {         setExtent(this.width, 40);        }     public void paint(Graphics g)     {           //            g.setBackgroundColor(Color.BLUE);//           g.clear();            g.setColor(Color.BLACK);          super.paint(g);       }     public void setVisiblity(boolean on)      {//           this.setVisualState(VISUAL_STATE_DISABLED);//         this.setVisualState(VISUAL_STATE_DISABLED_FOCUS);
    
          }     protected void fieldChangeNotify(int context)        {          try {              this.getChangeListener().fieldChanged(this, context);                 } catch (Exception exception) {               }        } }
    

    This is the place where to use this object class

    class ItemList extends Manager implements FieldChangeListener{  SubItemList subitems;
    
      String []cycleitems = {"Standard", "Kids", "Racers"}; String []spareitems = {"Tyres", "Tubes", "Covers"};   String []healthitems = {"Medicines","Fruits","Drinks"};   String []fitnessitems = {"Walker", "Dumbles"};    String []empty = {"                    "};
    
      CustomComboBox ddl_cycle, ddl_spares, ddl_fitness, ddl_health, ddl;   MyTextField lbl_subcategory;//    CustomTextBox txt_qty;    ItemList(int index)   {     super(Manager.VERTICAL_SCROLL | Manager.HORIZONTAL_SCROLL);
    
            subitems = new SubItemList(index,0);
    
          ddl_cycle = new CustomComboBox("Cycles", cycleitems,  140);       ddl_spares = new CustomComboBox("Spares", spareitems, 140);       ddl_health = new CustomComboBox("Health", healthitems, 140);      ddl_fitness = new CustomComboBox("Fitness", fitnessitems,140);        ddl = new CustomComboBox("",empty ,100);
    
          lbl_subcategory = new MyTextField("Sub-Category:",Field.FIELD_LEFT, 16);//        lbl_qty = new MyTextField("Qty", Field.FIELD_LEFT, 16);//     txt_qty = new CustomTextBox(30,20);
    
          ddl_cycle.setChangeListener(this);        ddl_spares.setChangeListener(this);       ddl_health.setChangeListener(this);       ddl_fitness.setChangeListener(this);
    
          switch(index)     {         case 0: ddl = ddl_cycle;                  break;            case 1: ddl = ddl_spares;                 break;            case 2: ddl = ddl_health;                 break;            case 3: ddl = ddl_fitness;                    break;        }     add(lbl_subcategory);     add(ddl);     add(subitems);    } public void delItems()    {     subitems.delSubItems();       deleteAll();  } public void setvisibility(boolean on) {     ddl.setVisiblity(false);  } protected void sublayout(int width, int height)   {     if(lbl_subcategory != null)       {         setPositionChild(lbl_subcategory, 0, 25);         layoutChild(lbl_subcategory, getScreen().getWidth(), getScreen().getHeight());        }
    
          setPositionChild(ddl, 110, 15);       layoutChild(ddl, getScreen().getWidth(), getScreen().getHeight());
    
          if(subitems != null)      {         setPositionChild(subitems, 0, 60);            layoutChild(subitems, getScreen().getWidth(), getScreen().getHeight());       }
    
          setExtent(360, 150);  }
    

    This is the place where works the dynamic change of ddl

    class OrderEntryManager extends Manager implements FieldChangeListener{
    
    ItemList items;    ButtonField   btn_submit;     MyButtonField  btn_cycles, btn_spares, btn_health, btn_fitness, btn_go;
    
    OrderEntryManager(){items = new ItemList(0);btn_cycles = new MyButtonField("Cycles", "orderimg/cycle.png", "orderimg/cycle.png",0x00FFE7AD);     btn_spares = new MyButtonField("Spares", "orderimg/spares.png", "orderimg/spares.png",0x00FFE7AD);        btn_fitness = new MyButtonField("Fitness", "orderimg/fi.....);
    
    add(items);
    
    }public void fieldChanged(Field field, int context)    {
    
          if(field instanceof MyButtonField)        {         if (((MyButtonField) field).getLabel().equalsIgnoreCase("Cycles"))            {//               items.delItems();//               this.delete(items);//             items.setVisualState(VISUAL_STATE_DISABLED);              items.setvisibility(false);               items = new ItemList(0);              add(items);            }            else if (((MyButtonField) field).getLabel().equalsIgnoreCase("Spares"))           {//               items.setVisualState(VISUAL_STATE_DISABLED);//                items.setvisibility(false);               items = new ItemList(1);              add(items);//             items = itemsnew;         }         else if (((MyButtonField) field).getLabel().equalsIgnoreCase("Health"))           {//               items.setVisualState(VISUAL_STATE_DISABLED);//                items.setvisibility(false);               items = new ItemList(2);              add(items);//             items = itemsnew;         }         else if(((MyButtonField) field).getLabel().equalsIgnoreCase("Go"))            {
    
              }         else if (((MyButtonField) field).getLabel().equalsIgnoreCase("Fitness"))          {//               items.setVisualState(VISUAL_STATE_DISABLED);//                items.setvisibility(false);               items = new ItemList(3);              add(items);//              items = itemsnew;            }     }     else if (field instanceof ButtonField)         {//           if (((ButtonField) field).getLabel().equalsIgnoreCase("Fitness"))//              {//                   items = new ItemList(3);//                    add(items);// //               items = itemsnew;  //                }           if(((ButtonField) field).getLabel().equalsIgnoreCase("Submit"))             {               synchronized(Application.getEventLock())                    {                     UiApplication.getUiApplication().popScreen(UiApplication.getUiApplication().getActiveScreen());                       UiApplication.getUiApplication().pushScreen(new OrderConfirmScreen());                    }             }      }            if(items != null)         {             updateLayout();           }
    
     }
    
    }
    

    Please suggest me how to remove the ddl for this!

    Hi all, I have solved this problem by using ddl.setChoice (String []);

    Thank you for all that you.

  • How to remove old custom workspaces?

    How can I remove old custom workspaces that I never use more?

    "Save, reset, or delete workspaces.

  • How to remove select data in the control table

    This problem makes me headache.

    I'm new to labview, when data in a table. a lot of lines and columns. How can remove on the line that I chose. the other lines are remain unchanged.

    I really need help.thanks in advance. It is best to attach the labview program.my is 2009

    That kind of thing does not work with the table that's why I suggested to go for the multicolumn list box. You can do simple.

    Good luck

  • How to remove a custom toolbar.

    Where are stored the definitions of the custom toolbar? I created one, but now want to permanently delete it.

    Everytime I open Firefox is activated and I have to disable in the view menu. My preferences are not stored. This has happened in the last update of Firefox. The upper area is also a nasty green color before it loads my custom background.

    No idea of what is happening and how I can fix?

    Either way, "assumptions" for this are all wrong. It shows my version 3.5.4 and my XP OS.

    You must remove all elements (including separators and elements of space) in a toolbar and have them drag in the toolbar palette to remove the toolbar, customize the window is closed.

  • How to remove the playback on iPad controls after the conversion of the HTML5?

    If you disable playback control in the CP5.5 skin Editor, it disappears from the SWF correctly, but still appears on the iPad after conversion of HTML5. Any way to remove it from the iPad?

    Take a look at this blog, scroll down and you will find how to hide the playback bar:

    y.html http://blogs.adobe.com/Captivate/2012/01/Rapid-eLearning-with-Adobe-Captivate-5-5-HTML5-wa #more-3743

    Lilybiri

  • How to remove your custom workflow?

    Hello

    Is it possible to delete a custom workflow that has already been uploaded to the database? How?

    Thank you
    Allen

    Please also see (how customizations are eliminated in a workflow? [REF 287369.1]) that mention two approaches (workflow designer and the wfrmitt.sql script).

    Again, try this on a test first instance before applying it to your production instance.

    Thank you
    Hussein

  • How to remove all the scripts on the instances of the object?

    I'm looking for one any solution here, not to mention disabling the setting warn.

    I hate it when I am converting someone to another project AS2 AS3 and buried on an instance on stage somewhere, that gives me the warning code:


    "The actions on the button or MovieClip instances are not supported in ActionScript 3.0." All the scripts on the instances of the object will be ignored. »

    How can i:
    Has) find what instances have code on them.
    or

    B) delete all of the code on all instances.

    Idea:
    Can I save as a different format/version/something and lose data in some way. Then I could convert back the current format of the FLA?

    use the movie in flash Explorer to search for actionscript.  whatever it is attached to an object must be removed.

  • How to remove a customer in R12

    Hi all, I need to delete a customer in R12 (html form) but I don't see any delete button.

    I have not any transaction with the customer, it's a whole new customer but I have a requirement to remove. So my question is how can I delete a customer?

    Thank you

    PL see if these Docs MOS help

    is 727169.1 - possible to delete customers, the possibilities and opportunities?
    is 412615.1 - possible to delete a customer record that was created in the Contact Center?

    HTH
    Srini

  • How to remove a customer interface in CRM Siebel 8.1?

    Hi all

    I would like to know how can I remove a client user of Siebel CRM 8.1 interface?

    Thank you

    Try to find the Administration of Contact view.
    SADMIN should have access to this point of view.

  • How to remove profiles customized in the section of camera calibration

    I installed the software, Xrite ColorChecker Passport and loaded a few profiles custom module development in respect of the calibration of the camera. There was a bug in the software and it me has failed to appoint these profiles. Once I uninstalled this version and loaded the new version of the name process works very well. I would like to be able to delete the profile unname of Lightroom, but I don't see how this is possible. Any suggestions?

    Thank you!

    C:\Users\{username}\AppData\Roaming\Adobe\CameraRaw\CameraProfiles

    in Windows 7, you can see: "Roaming", not "local".

  • How to remove the colors of the table of characters fill colors

    Hmm. I got to ask questions of the pages for Mac screen, but it looks different from what I've seen in the past. So, I hope I'm in the right place. Over time, I selected some colors in the color popup in the character frame and saved.  I tried to change a color by changing the opacity. Then I tried to save this color has changed for the lines at the bottom of the pop-up window.  It did not work. I would have saved the color that appears in the large square on the left.  Anyway my question is how to remove these incorrect colors lines down.

    I know that this little logical so I am attaching the screenshot I'm talking about.  I want to remove the three red squares, two on the line and the other on row down all in the middle of the screen.

    Thanks for your help.

    EHW

    HI ehw.

    This is the right place. He underwent extensive design of the overnight changes.

    don't think that you can "erase" the colors that you place in the custom palette, but you can replace them easily using the same method the first time:

    Set up color using the sliders or the color space, and then drag the big box and drop on the color you want to replace.

    Here I replaced two red with white.

    Interesting change of color of the header between the two images. Both are screenshots, the left using shift-control-command-4 then pasted from the Clipboard to an empty page in the Pages, the right is the actual color palette. Both were then with SHIFT-command-4 to maks a file that was then inserted here.

    Curious.

    Kind regards

    Barry

  • Scripts custom FDM HFM control (for example, perform a translate in HFM) after data FDM load via the batch Loader

    Currently, we have a Microsoft Access database + VBA Scripts that use the HFM API objects to connect to the HFM application to perform the following tasks:

    (1) delete the data according to a specific POV HFM

    (2) load some data from a text file to the request of HFM

    (3) run a Consolidation of data in HFM with 3 different POV

    (4) running a data translate in HFM with a specific POV.

    (5) when the process is complete, HFM send one connects e-mail to Hyperion administration team with newspapers.

    We want to replace this database MS Access with FDM.

    Custom script of FDM, I am able to run batch loader to load data at our request of HFM.

    However, FDM, I want to connect to our HFM application to perform a consolidation (in HFM) and also a Translate (in HFM) after that the data has been loaded by the loader of FDM data.

    The question I have is that I can't use the VB Scripts following FDM (this code works in MS Access)

    Function OpenHfmApp (sDomain As String, sUser As String, fun As String, sserveur As String, sApp As String)

    Dim customer as HsxClient

    Dim cSession as HsvSession

    Dim cServer As HsxServer

    Set customer = New HsxClient

    cClient.SetLogonInfoSSO sDomain, sUser, ' ", fun

    sApp sserveur, 'Financial management', cClient.OpenApplication, cSession cServer

    Set OpenHfmApp = cSession

    End Function

    FDM do not like the 'AS' - I should write:

    Function OpenHfmApp (sDomain, sUser, fun, sserveur, SAPP)

    Sun customer

    Dim cSession

    Dim cServer

    Set customer = New HsxClient

    cClient.SetLogonInfoSSO sDomain, sUser, ' ", fun

    sApp sserveur, 'Financial management', cClient.OpenApplication, cSession cServer

    Set OpenHfmApp = cSession

    End Function

    When I run this code of FDM, I get the following (of Financial Data Management Workbench) error message

    500 variable is undefined: 'HsxClient '.

    Online: 565

    My questions are:

    (1) is it possible to control via the Scripts VB FDM HFM realize some tasks such as claire HFM, Consolidation and HFM HFM translate?

    (2) if so, How can I reference objects in FDM HFM VB Scritp editor [custom general] (to use the HFM API via scripts VB FDM objects)?

    Thank you

    Claude

    Good to know that the 'out of the box' functionality meets your requirements. You can mark the thread as anawered now.

Maybe you are looking for

  • How to mirror the MacBook Pro w/retina to HDTV via HDMI

    The Mac and the TV are connected, but what I get on the TV is simply on my desktop, it does not appear even the desktop icons that I recorded on my desktop and when I open the program it will not display those.  Any help on what to change to fix this

  • Tecra PT634E A50 - need details on the SATA controller

    Hello I am looking for detailed specifications of Toshiba Tecra A50 (PT634E-00800JPL).I need to know what the internal port SATA version.What is SATA II or SATA III? I want to change the SSD hard drive and buy the most appropriate.

  • New H535s with Win 8.1

    I just bought a new H535s with Win 8.1 - do you know if there is a recovery already integrated into the system section or do I have to back up the system myself (using a lot of space) Thank you in anticipation

  • What is the "right amount" of thermal paste to use?

    I intend to replace the cpu in my compaq presario cq62-219wm. I intend to replace the celeron 900 with a t9300. What would be the right amount of thermal paste to use? I have perhaps a wedge? any advice on this subject would be greatly appreceated.  

  • How can I update the media library on remote pc?

    I have a configuration of sharing media using Windows Media Player 10 on Windows XP.  I recently added a few new media to my library and it appears on the player, but new media does not appear in the sharing of media to remote computers.  The remote