Color Gradient script?

 From:  GonzoRus
9676.81 
Hi.

Please tell me how to assign hotkeys for the following actions:

1. Assign a fixed color to selected curves?

2. Assign a fixed color to all curves?

The color will be assigned in advance in the script:
"var red = XX, green = XX, blue = XX"

For version 3.0

All gradient scripts are very cool, but sometimes I need to quickly assign a color with hotkeys to individual curves or all curves.

I understand that the script will be like this:

"script: / * Assign styles to solids * / var styles = moi.geometryDatabase.getObjectStyles (); var breps = moi.geometryDatabase.getObjects (). getBReps (); var style_index = 0; for (var i = 0; i <breps.length; ++ i, ++ style_index) {if (style_index == styles.length) {style_index = 0;} var brep = breps.item (i); brep.styleIndex = style_index;} "

only for a single color and only for curves.

tried to edit this script, but I lack knowledge of syntax)