Jump to content

Change the color of a button in a script?


Tom Kennedy

This topic is 5214 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • 3 months later...
  • Newbies

I see how you set up the script to toggle between the default and fill colors. Is it possible to assign a specific color (hex?) in the script. For example if I want the button background to be able to be set to multiple colors, I want to be able to tell it specifically which one it should change to (instead of toggling between two).

Thanks!

- Garrett

Link to comment
Share on other sites

You can set up multiple conditions Under a Conditional Formatting for an object... So set up one for each color you want and then make the Formula choose which to display. Let's say you want Red, Green and Blue, set a variable in your script, call it $$ChangeColor (or whatever), that you set to be the color you want through the script... Then your Formula under Conditional Formatting is set with three (3) conditions / formulas, IF($$ChangeColor = "RED") It runs this condition, IF($$ChangeColor = "BLUE", than this condition, etc. There's probably a more elegant way to do this, but this is how I show different colored words on a manufacturing schedule report as certain criteria change to better highlight - tasks to go ahead (green), Problem hold (Red), DONE (gray-out), etc. As each line of each job goes to a different level or task it makes a large list a lot more readable for differnt users...

Hope this helps - the key is setting up your conditions. And if you want to duplicate the same Conditions list without having to retype, duplicate the object (word, or field) and then change it - this will keep the attributes of the condition for the new/next field. Format painter may work also but I don't know...

Kind regards,

Royce

Link to comment
Share on other sites

  • Newbies

I appreciate the help and I think I am following your conditional logic. I actually have an even more basic question in terms of setting the color.

I cannot figure out how to write the syntax to actually change this to "Red" for example. I have a script that currently has:

Name: $$overdueBkgd (for example)

Value: Abs ($$overdueBkgd- 1)

This is the way it was originally set up earlier in the sample from this thread. I tried replacing the "1" with "Red" to no avail. How do I change this to a specific color. In my case I was trying to get it to set itself to the lightest gray in the color palette.

Thank you for your help!

- Garrett

Link to comment
Share on other sites

This topic is 5214 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.