23 Replies Latest reply on Sep 30, 2010 11:58 PM by VertexBee

    script request: switch Presets

    VertexBee Level 1

      http://www.vertexbee.com/pics/vBee_PSswitchPresets.jpg

      Martin

        • 1. Re: script request: switch Presets
          c.pfaffenbichler Level 9

          Sounds interesting.

          Unfortunately that would take a lot of insight into what I consider the more complex aspects of Photoshop-Scripting, but maybe it will pique the interest of some of the more experienced Scripters.

          Because so far I have not been able to determine the number and names of presets for a selected tool or select them other than by name.

           

          Another point: If you post your question as an image I doubt that it will be catalogued properly and may subsequently not get listed in Forum-searches it should turn up in, so you might want to reconsider that.

          1 person found this helpful
          • 2. Re: script request: switch Presets
            VertexBee Level 1

            I'm glad you find it interesting and thank you for the tip, I'll edit the first post to include a plain text along with the image

             

            I didn't know is hart to be implemented...hmmm...Is it possible to cycle through actions, instead of presets ?

            An action can load a particular preset file(.tpl or .abr).This way the user must first record several actions, each corresponding to a preset, and than

            the script could cycle through these actions. Is that possible ?

            • 3. Re: script request: switch Presets
              c.pfaffenbichler Level 9
              I'm glad you find it interesting and thank you for the tip, I'll edit the first post to include a plain text along with the image

              No hassle, just for future reference maybe.

               

              I didn't know is hart to be implemented.

              I suspect it is not really »hard« – I just haven’t been able to figure it out.

              Some of the regulars there usually also drop by here, but you could try posting at ps-scripts, too.

              http://www.ps-scripts.com/

               

              Anyway the Actions-approach might work, but it seems a bit convoluted.

              And one would still have to determine the currently selected toolPreset (which I also have not been able to) to be able to find out which one is the next or write a prefs-file which records the last Action performed or something …

              1 person found this helpful
              • 4. Re: script request: switch Presets
                Paul Riggott Level 6

                The difficulty will be that the presets include crops etc.

                The following code will list all the presets to ESTK console...

                var Presets = getPresetList();
                for(var v in Presets){
                 $.writeln(Presets[v]);
                }
                function getPresetList(){
                var ref = new ActionReference(); 
                   ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); 
                   var appDesc = executeActionGet(ref); 
                  var List = appDesc.getList(stringIDToTypeID('presetManager'));
                  var presetNames=[];
                    var list = List.getObjectValue(7).getList(charIDToTypeID('Nm  '));
                    for (var i = 0; i < list.count; i++) {
                      var str = list.getString(i);
                      presetNames.push(str);
                    }
                presetNames=ReturnUniqueSortedList(presetNames);
                return presetNames;
                }
                function ReturnUniqueSortedList(ArrayName){
                var unduped = new Object;
                for (var i = 0; i < ArrayName.length; i++) {   
                unduped[ArrayName[i]] = ArrayName[i];
                }
                var uniques = new Array;
                 for (var k in unduped) {
                   uniques.push(unduped[k]);
                   }
                return uniques.sort();
                }
                
                • 5. Re: script request: switch Presets
                  Muppet Mark-QAl63s Level 4

                  Have you looked at X's script PresetLister that is part of his tool kit? This breaks them down into groups brushes, styles, etc. etc. I think you would have to make use of Action's to be able to add keyboard shrotcut functionality…

                  • 6. Re: script request: switch Presets
                    Muppet Mark-QAl63s Level 4

                    btw… X you have been jinxed by the jive fairies… you need to contact forum admin to get that fixed else you'll end up with them silly 2 id's like what I have… They never did fix that for me… the aka is still lurking about…

                    • 7. Re: script request: switch Presets
                      Paul Riggott Level 6

                      Hi Mark, I don't think the "toolPreset" list can be broken down any more. The lists avilable are:-

                      0=brush

                      1=color

                      2=gradientClassEvent

                      3=styleClass
                      4= null not used

                      5=shapeCurveType

                      6=customShape

                      7=toolPreset

                      • 8. Re: script request: switch Presets
                        Muppet Mark-QAl63s Level 4

                        Sorry Paul may have things a bit confused your script return me…

                         

                        0.5 cm Black Arrow

                        5 Point White Star

                        Airbrush Soft Round 50% flow

                        Art History Brush 20 pixels

                        Aurora

                        Background Eraser 30 pixels

                        Chalk Build Up

                        Chalk with Medium Heavy Flow

                        Circular Rainbow

                        Close Cross Hatch

                        Crop 4 inch x 6 inch 300 ppi

                        Crop 5 inch x 3 inch 300 ppi

                        Crop 5 inch x 4 inch 300 ppi

                        Crop 5 inch x 7 inch 300 ppi

                        Crop 8 inch x 10 inch 300 ppi

                        Desaturate 13 pixels

                        Fill with Bubbles Pattern

                        Fuzzy Cluster Loose

                        Fuzzy Gesture Tool Small

                        Granite

                        Healing Brush 21 pixels

                        Heavy Marker Smaller Tip

                        Heavy Marker with Fuzzy Edges

                        Horizontal Type Myriad Roman 24 pt

                        Magnetic Lasso 24 pixels

                        Marker Medium Tip

                        No Style

                        Paintbrush Oval 45 pixels Multiply

                        Pointillism

                        Scattered Ornament Flower

                        Spongy

                        Spray Can

                        Starburst Color Target

                        Texture with Brush

                        TieDyed Impressionist 25 pixels

                        Transparent Red Spray Paint

                        Vertical Type Myriad Roman 24 pt

                         

                        Which is my tools presets yes? Where as X's gives me…

                         

                        [Brushes]

                        Hard Round 1 pixel

                        Hard Round 3 pixels

                        Hard Round 5 pixels

                        Hard Round 9 pixels

                        Hard Round 13 pixels

                        Hard Round 19 pixels

                        Soft Round 5 pixels

                        Soft Round 9 pixels

                        Soft Round 13 pixels

                        Soft Round 17 pixels

                        Soft Round 21 pixels

                        Soft Round 27 pixels

                        Soft Round 35 pixels

                        Soft Round 45 pixels

                        Soft Round 65 pixels

                        Soft Round 100 pixels

                        Soft Round 200 pixels

                        Soft Round 300 pixels

                        Airbrush Hard Round 9

                        Airbrush Hard Round 13

                        Airbrush Pen Opacity Flow

                        Airbrush Soft Round 17

                        Airbrush Soft Round 45

                        Airbrush Soft Round 65

                        Airbrush Soft Round 100

                        Airbrush Soft Round 200

                        Airbrush Soft Round 300

                        Spatter 14 pixels

                        Spatter 24 pixels

                        Spatter 27 pixels

                        Spatter 39 pixels

                        Spatter 46 pixels

                        Spatter 59 pixels

                        Chalk 11 pixels

                        Chalk 17 pixels

                        Chalk 23 pixels

                        Chalk 36 pixels

                        Chalk 44 pixels

                        Chalk 60 pixels

                        Star 14 pixels

                        Star 26 pixels

                        Star 33 pixels

                        Star 42 pixels

                        Star 55 pixels

                        Star 70 pixels

                        Dune Grass

                        Grass

                        Scattered Maple Leaves

                        Scattered Leaves

                        Flowing Stars

                        Fuzzball

                        Chalk

                        Charcoal Large Smear

                        Hard Pastel on Canvas

                        Oil Pastel Large

                        Dry Brush Tip Light Flow

                        Dry Brush

                        Watercolor Loaded Wet Flat Tip

                        Watercolor Small Round Tip

                        Oil Heavy Flow Dry Edges

                        Oil Medium Wet Flow

                        Wet Sponge

                        Rough Round Bristle

                        Airbrush 75 Tilt Size and Angle

                        Airbrush Dual Brush Soft Round 45

                        Sampled Brush 1

                        Circle 1

                        Circle 2

                        Circle 3

                        Circle 4

                        Concentric Circles

                        Crosshatch 1

                        Crosshatch 2

                        Crosshatch 3

                        Crosshatch 4

                        Dashed Circle 1

                        Dashed Circle 2

                        Dashed Circle 3

                        Diamond

                        Ornament 1

                        Ornament 2

                        Ornament 3

                        Ornament 4

                        Ornament 5

                        Ornament 6

                        Ornament 7

                        Ornament 8

                        Snowflake

                        Star - Small

                        Star - Large

                        Starburst - Small

                        Starburst - Large

                        Texture 1

                        Texture 2

                        Texture 3

                        Texture 4

                        Texture 5

                        Texture 6

                        Triangle

                        Triangle - Dots

                        Brush Heavy Flow Scattered

                        Drippy Water

                        Dry Brush on Towel

                        Heavy Scatter Flow

                        Heavy Stipple

                        Brush on Light Weave

                        Light Oil Flat Tip

                        Paint on Rough Texture

                        Paintbrush Tool Texture Comb

                        Rough Dry Brush

                        Rough Ink

                        Scattered Dry Brush

                        Scattered Dry Brush Small Tip

                        Large Texture Stroke

                        Oil Heavy Flow Small Tip

                        Brush with Thick Flow Medium Tip

                        Oil Medium Brush  Wet Edges

                        Oil Small Tip

                        Oil Medium to Large Tip

                        Brush Light Texture Medium Tip

                        Watercolor Heavy Loaded

                        Watercolor Heavy Pigments

                        Watercolor Heavy Medium Tip

                        Watercolor Fat Tip

                        Watercolor Textured Surface

                        Watercolor Light Opacity

                        [Colors]

                        Red

                        Orange

                        Yellow-???

                        Green

                        Blue

                        Violet

                        [Gradients]

                        Foreground to Background

                        Foreground to Transparent

                        Black, White

                        Red, Green

                        Violet, Orange

                        Blue, Red, Yellow

                        Blue, Yellow, Blue

                        Orange, Yellow, Orange

                        Violet, Green, Orange

                        Yellow, Violet, Orange, Blue

                        Copper

                        Chrome

                        Spectrum

                        Transparent Rainbow

                        Transparent Stripes

                        [Styles]

                        Default Style (None)

                        Color Target (Button)

                        Double Ring Glow (Button)

                        Striped Cone (Button)

                        Blue Glass (Button)

                        Negative (Image)

                        Puzzle (Image)

                        Sepia Tone (Image)

                        Sun Faded Photo (Image)

                        Blanket (Texture)

                        Nebula (Texture)

                        Sunspots (Texture)

                        Tie-Dyed Silk (Texture)

                        Chiseled Sky (Text)

                        Chromed Satin (Text)

                        Overspray (Text)

                        Sunset Sky (Text)

                        Basic Drop Shadow

                        1 Px Stroke 0% Fill Opacity

                        1 Px stroke 100% Fill Opacity

                        Default Style (None)

                        Color Target (Button)

                        Double Ring Glow (Button)

                        Striped Cone (Button)

                        Blue Glass (Button)

                        Negative (Image)

                        Puzzle (Image)

                        Sepia Tone (Image)

                        Sun Faded Photo (Image)

                        Blanket (Texture)

                        Nebula (Texture)

                        Sunspots (Texture)

                        Tie-Dyed Silk (Texture)

                        Chiseled Sky (Text)

                        Chromed Satin (Text)

                        Overspray (Text)

                        Sunset Sky (Text)

                        Basic Drop Shadow

                        1 Px Stroke 0% Fill Opacity

                        1 Px stroke 100% Fill Opacity

                        Pink Gloss

                        White Gloss

                        Orange Gloss

                        Black 3D

                        Blue 3D

                        White Gloss

                        Grey 3D

                        Blue 3D

                        Wax Flat

                        Yellow 3D

                        Yellow 3D

                        Grey Gloss

                        Green Flat

                        Black 3D

                        Pink Gloss

                        Orange Flat

                        Grey Blue 3D

                        Wax 3D

                        Red 3D

                        Blue 3D

                        Yellow Flat

                        Grey Gloss

                        Red Flat

                        Blue 3D

                        Blue Gloss

                        Red Gloss

                        Grey Flat

                        Green 3D

                        Blue 3D

                        Green Gloss

                        Black Gloss

                        Blue 3D

                        Wax 3D

                        Green 3D

                        Blue 3D

                        Blue 3D

                        Orange 3D

                        Green 3D

                        Pink 3D

                        Red 3D

                        Gren 3D

                        Olive 3D

                        Yellow 3D

                        Red 3D

                        Blue Gloss\

                        Blue Gloss

                        Pink 3D

                        White 3D

                        Blue Grey 3D

                        Orange 3D

                        Blue Flat

                        Olive Flat

                        Blue Gloss

                        Green 3D

                        Orange 3D

                        Olive 3D

                        Gold 3D

                        Pink 3D

                        Green Gloss

                        Green Flat

                        Grey Blue 3D

                        Blue 3D

                        Blue Gloss

                        Blue 3D

                        Blue Pipe

                        Purple 3D

                        Olive 3D

                        Blue 3D

                        Olive 3D

                        Green Flat

                        Green Flat

                        Orange 3D

                        Black Gloss Pipe

                        Blue 3D

                        Green Semi Flat

                        Blue 3D

                        Blue 3D

                        Pink Flat

                        Blue 3D

                        Blue 3D

                        Blue Pipe\

                        Green 3D

                        Grey Gloss

                        Grey 3D

                        Neon -  Use on Black BG

                        Grey Blue Gloss

                        Ornage 3D

                        Green Flat

                        Blue Pipe

                        Orange Flat

                        Wax 3D

                        Blue 3D

                        Grey 3D

                        Wax 3D

                        Black Gloss

                        Yellow 3D

                        Red Gloss

                        Green 3D

                        Blue Gloss

                        Blue 3D

                        Pink 3D

                        White Gloss

                        Blue Flat

                        Grey Pipe

                        White 3D

                        Blue Grey Flat

                        Green Flat

                        Blue 3D

                        Purple 3D

                        Lavendar 3D

                        Blue Flat

                        Blue 3D

                        Blue 3D

                        Red Flat

                        Grey 3D

                        Yellow Flat

                        Green 3D

                        Brown 3D

                        Brown Red 3D

                        L Green 3D

                        Grey Black 3D

                        Grey 3D

                        Blue 3D

                        Green Gloss

                        Orange 3D

                        Red Gloss

                        Brown Gloss

                        L Brown 3D

                        Red Gloss

                        Blue Gloss

                        Blue Gloss

                        drop

                        tj hughes blue

                        tj hughes yellow

                        tj hughes red

                        tj hughes green

                        tj hughes warehouse

                        [Patterns]

                        Bubbles

                        Wrinkles

                        Woven

                        Wood

                        Tie Dye

                        Satin

                        Optical Checkerboard

                        Nebula

                        Molecular

                        Metal Landscape

                        Herringbone 2

                        Clouds

                        Pattern 1

                        Pattern 2

                        Optical Checkerboard

                        Pattern 3

                        [Shaping Curves]

                        Linear

                        Cone

                        Cone - Inverted

                        Cove - Deep

                        Cove - Shallow

                        Gaussian

                        Half Round

                        Ring

                        Ring - Double

                        Rolling Slope - Descending

                        Rounded Steps

                        Sawtooth 1

                        [Custom Shapes]

                        Arrow 5

                        Arrow 7

                        Arrow 9

                        Banner 3

                        Frame 7

                        Eighth Notes

                        Lightning

                        Flower 5

                        Grass 2

                        Light Bulb 2

                        Thumb Tack

                        Envelope 2

                        Scissors 2

                        Stamp 2

                        Fleur-De-Lis

                        Hedera 2

                        Heart Card

                        Blob 1

                        Checkmark

                        Registration Target 1

                        "No" Sign

                        Talk 1

                        Tile 2

                        Tile 4

                        Grid

                        Starburst

                        Cat Print

                        Circle Thin Frame

                        Square Thin Frame

                        Copyright symbol

                        Registered Trademark symbol

                        Trademark symbol

                        Talk 1

                        Talk 2

                        Talk 3

                        Talk 4

                        Talk 5

                        Thought 1

                        Thought 2

                        Bone

                        Fish

                        Cat

                        Dog

                        Snail

                        Rabbit

                        Bird 1

                        Bird 2

                        Dog Print

                        Cat Print

                        Arrow 1

                        Arrow 2

                        Arrow 3

                        Arrow 4

                        Arrow 5

                        Arrow 6

                        Arrow 7

                        Arrow 8

                        Arrow 9

                        Arrow 10

                        Arrow 11

                        Arrow 12

                        Arrow 13

                        Arrow 14

                        Arrow 15

                        Arrow 16

                        Arrow 17

                        Arrow 18

                        Arrow 19

                        Arrow 20

                        Banner 1

                        Banner 2

                        Banner 3

                        Banner 4

                        Ribbon 1

                        Ribbon 2

                        Seal

                        Frame 1

                        Frame 2

                        Frame 3

                        Frame 4

                        Frame 5

                        Frame 6

                        Frame 7

                        Frame 8

                        Whole Note

                        Half Note

                        Quarter Note

                        Eighth Note

                        Eighth Notes

                        Sixteenth Note

                        Bass Clef

                        Treble Clef

                        Flat Symbol

                        Sharp Symbol

                        Tree

                        Fern

                        Shamrock

                        Butterfly

                        Sun 1

                        Sun 2

                        Waves

                        Raindrop

                        Cloud 1

                        Cloud 2

                        Lightning

                        Fire

                        Snowflake 1

                        Snowflake 2

                        Snowflake 3

                        Moon

                        Leaf 1

                        Leaf 2

                        Leaf 3

                        Leaf 4

                        Leaf 5

                        Leaf 6

                        Leaf 7

                        Flower 1

                        Flower 2

                        Flower 3

                        Flower 4

                        Flower 5

                        Flower 6

                        Flower 7

                        Grass 1

                        Grass 2

                        Grass 3

                        Light Bulb 1

                        Light Bulb 2

                        Left Hand

                        Right Hand

                        Left Foot

                        Right Foot

                        Umbrella

                        Key 1

                        Key 2

                        Bow

                        Puzzle 1

                        Puzzle 2

                        Puzzle 3

                        Puzzle 4

                        Pencil

                        Pen

                        Marker

                        Paintbrush

                        Crayon

                        Phone 1

                        Phone 2

                        Hourglass

                        Thumb Tack

                        Sheriff's Badge

                        Crown 1

                        Crown 2

                        Crown 3

                        Crown 4

                        Crown 5

                        Envelope 1

                        Envelope 2

                        Scissors 1

                        Scissors 2

                        Paper Clip

                        Stamp 1

                        Stamp 2

                        Confetti

                        Splatter

                        Holly

                        US Flag

                        Point Right

                        Point Left

                        Fleur-De-Lis

                        Ornament 1

                        Ornament 2

                        Ornament 3

                        Ornament 4

                        Ornament 5

                        Ornament 6

                        Ornament 7

                        Ornament 8

                        Leaf Ornament 1

                        Leaf Ornament 2

                        Leaf Ornament 3

                        Floral Ornament 1

                        Floral Ornament 2

                        Floral Ornament 3

                        Floral Ornament 4

                        Hedera 1

                        Hedera 2

                        Hedera 3

                        Spiral

                        ZigZag

                        10 Point Star

                        10 Point Star Frame

                        5 Point Star

                        5 Point Star Frame

                        Flower 1

                        Flower 1 Frame

                        Flower 2

                        Flower 2 Frame

                        Hexagon

                        Hexagon Frame

                        Club Card

                        Heart Card

                        Spade Card

                        Diamond Card

                        Crescent Moon

                        Crescent Moon Frame

                        Diamond

                        Diamond Frame

                        Heart

                        Heart Frame

                        8 Point Star

                        8 Point Star Frame

                        Rounded Square

                        Rounded Square Frame

                        Triangle

                        Triangle Frame

                        Blob 1

                        Blob 1 Frame

                        Blob 2

                        Blob 2 Frame

                        Circle

                        Circle Frame

                        Circle Thin Frame

                        Square

                        Square Frame

                        Square Thin Frame

                        Woman

                        Man

                        Airplane

                        Help

                        Phone 3

                        Checkmark

                        Exclamation Point

                        Question Mark

                        Starburst

                        X

                        Pedestrian

                        School

                        Wheelchair

                        Sign 1

                        Sign 2

                        Sign 3

                        Sign 4

                        Sign 5

                        Sign 6

                        Car 1

                        Car 2

                        Bicycle

                        Recycle 1

                        Recycle 2

                        Yin Yang

                        Female Symbol

                        Male Symbol

                        Bull's Eye

                        Radioactive

                        Nuclear

                        World

                        Compass

                        Boom 1

                        Boom 2

                        Star

                        Copyright

                        Registered

                        Trademark

                        Registration Target 1

                        Registration Target 2

                        Information

                        Campfire

                        "No" Sign

                        Mac Pointer

                        Windows Pointer

                        Checked Box

                        Check Box

                        Talk 1

                        Talk 2

                        Talk 3

                        Talk 4

                        Talk 5

                        Thought 1

                        Thought 2

                        Paw Prints

                        Tracks

                        Tile 1

                        Tile 2

                        Tile 3

                        Tile 4

                        Tile 5

                        Grid

                        Add

                        Delete

                        Back

                        Forward

                        Down

                        Up

                        Save

                        Mail

                        Checked Box

                        Home

                        Help

                        "No" Symbol

                        Movie

                        Music On

                        Music Off

                        Search

                        World Wide Web Search

                        Shopping Cart

                        Volume

                        Tabbed Button

                        Time

                        Tools

                        World Wide Web

                        [Tool Presets]

                        Healing Brush 21 pixels

                        Magnetic Lasso 24 pixels

                        Crop 4 inch x 6 inch 300 ppi

                        Crop 5 inch x 3 inch 300 ppi

                        Crop 5 inch x 4 inch 300 ppi

                        Crop 5 inch x 7 inch 300 ppi

                        Crop 8 inch x 10 inch 300 ppi

                        Fill with Bubbles Pattern

                        Horizontal Type Myriad Roman 24 pt

                        Vertical Type Myriad Roman 24 pt

                        5 Point White Star

                        0.5 cm Black Arrow

                        Starburst Color Target

                        Art History Brush 20 pixels

                        Circular Rainbow

                        TieDyed Impressionist 25 pixels

                        Airbrush Soft Round 50% flow

                        Aurora

                        Chalk Build Up

                        Chalk with Medium Heavy Flow

                        Close Cross Hatch

                        Fuzzy Cluster Loose

                        Fuzzy Gesture Tool Small

                        Granite

                        Heavy Marker Smaller Tip

                        Heavy Marker with Fuzzy Edges

                        Marker Medium Tip

                        No Style

                        Paintbrush Oval 45 pixels Multiply

                        Pointillism

                        Scattered Ornament Flower

                        Spongy

                        Spray Can

                        Texture with Brush

                        Transparent Red Spray Paint

                        Background Eraser 30 pixels

                        Desaturate 13 pixels

                         

                        Is this all the presets that I currently have loaded where I have used load/replace/Reset? Sorry about the length of all the junk

                        • 9. Re: script request: switch Presets
                          Paul Riggott Level 6

                          Yes that's your toolPresets trying to sort just the brush presets would be a nightmare!

                          • 10. Re: script request: switch Presets
                            Muppet Mark-QAl63s Level 4

                            Beyond me oh yes… I thought it 'may' be possible if some name prefixing was maybe added to the brushes before hand… I will go see if it lets me edit that post down now…

                            • 11. Re: script request: switch Presets
                              VertexBee Level 1

                              Hi, guys

                               

                              10x for the replies, although I don't know if you have understood my request completely.

                              I just want to swap brushes on the fly, whole sets of them = to cycle between several .abr files, that is all.

                              The simplest way for me to do this is to create actions that load different .abr files, but this can result in large amount of actions and if all of them are binded to a hotkey...it is not very efficient.

                               

                              I have no scripting experience, I would be really thankful if someone of you could write a script that cycles through several actions..if that's possible.

                               

                              Cheers!

                              • 12. Re: script request: switch Presets
                                jugenjury Level 2

                                Maybe I'm confused or missing something, but didn't the output Mark showed separate out the Brush presets?

                                 

                                I think a simple solution would be to actually make 2 scripts. One to set up your groups and save them into a config (.ini) file and another to cycle through the groups. This could be done with a single script, but since you want hot-key cycling you most likely wouldn't want a dialog to open up each time you run the script to ask if you want to alter the configuration. A way around this is to have the script cycle through the groups only if the brush tool is the actively selected tool. Otherwise, run the configuration dialog.

                                • 13. Re: script request: switch Presets
                                  jugenjury Level 2

                                   

                                   

                                  This is kinda what I thought you meant and the outline I just posted would work fine for this.

                                  • 14. Re: script request: switch Presets
                                    Michael L Hale Level 5

                                    Mark, the difference between X's script and Pauls' is X's lists all the presets, Paul's only the tool presets.

                                     

                                    You don't have to change the way you name your brush presets. Just change the 7 in Paul's code to 0. Then it will list only brush presets.

                                    • 15. Re: script request: switch Presets
                                      VertexBee Level 1

                                      Yes, that could do the work !

                                       

                                      Another way to tell the script which groups to use is to make an action set :

                                      http://www.vertexbee.com/pics/ActionPallete.png

                                      Than whenever you want to put another group you just put in one more action into the action set.

                                      This way such script could be useful not only for switching between groups of brushes (.abr files),

                                      but also for any single tool. For instance you can switch between the brush and eraser tools with

                                      one hotkey. Any given combination is possible - brush, eraser, stamp tool, etc.

                                       

                                      Could someone write such script ? PLEASEEEEEEE :)))))))))))))

                                      • 16. Re: script request: switch Presets
                                        Muppet Mark-QAl63s Level 4

                                        Mike, that is pretty much what I was thinking of (although bogged down at work) X's code did appear to me to break the presets down in to all their relative groupings. I was only trying to suggest where I would be looking to for a starting point if I were looking at this…

                                        • 17. Re: script request: switch Presets
                                          Paul Riggott Level 6

                                          This should loop through the loaded brushes.....

                                          N.B. You need to have tool selected that uses brushes.

                                          main();
                                          function main(){
                                          //Reset Custom Options.
                                          //app.eraseCustomOptions( '1ee71ba0-cc95-11df-bd3b-0800200c9a66' ); return;
                                          var Prefs = {};
                                          try{
                                          var desc1 = app.getCustomOptions('1ee71ba0-cc95-11df-bd3b-0800200c9a66');
                                          Prefs = eval(desc1.getString(0));
                                          }catch(e){
                                          Prefs.Brush=1;
                                          Prefs.BrushCount = getBrushCount();
                                          var desc2 = new ActionDescriptor();
                                          desc2.putString(0, Prefs.toSource()); 
                                          app.putCustomOptions('1ee71ba0-cc95-11df-bd3b-0800200c9a66', desc2, true );
                                              }
                                          if(Prefs.Brush > Prefs.BrushCount) Prefs.Brush = 1;
                                          selectBrushAtIndex(Number(Prefs.Brush));
                                          Prefs.Brush++;
                                          var desc2 = new ActionDescriptor();
                                          desc2.putString(0, Prefs.toSource()); 
                                          app.putCustomOptions('1ee71ba0-cc95-11df-bd3b-0800200c9a66', desc2, true );
                                          }
                                          function getBrushCount(){
                                          var ref = new ActionReference(); 
                                             ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); 
                                             var appDesc = executeActionGet(ref); 
                                            var List = appDesc.getList(stringIDToTypeID('presetManager'));
                                          var List = List.getObjectValue(0).getList(charIDToTypeID('Nm  '));
                                          return List.count;
                                          }
                                          function selectBrushAtIndex(index){
                                             var idSlct = charIDToTypeID( "slct" );
                                                 var desc1 = new ActionDescriptor();
                                                 var idNull = charIDToTypeID( "null" );
                                                     var ref1 = new ActionReference();
                                                     var idBrsh = charIDToTypeID( "Brsh" );
                                                     ref1.putIndex( idBrsh, index );  
                                                 desc1.putReference( idNull, ref1 );
                                             executeAction( idSlct, desc1, DialogModes.NO );
                                          }
                                          
                                          • 18. Re: script request: switch Presets
                                            c.pfaffenbichler Level 9

                                            I think the OP wants it to loop through the Tool Presets, not the 

                                            Brush Presets.

                                            • 19. Re: script request: switch Presets
                                              VertexBee Level 1

                                              I hope the image below does explain the original idea :

                                              http://www.vertexbee.com/pics/vBee_PresetSwitcherExplained.jpg

                                               

                                              Paul, great script, although that is not what I tried to explain.

                                              As I wrote in my previous post, is it possible to cycle between actions:

                                               

                                              "Another way to tell the script which groups to use is to make an action set :

                                              http://www.vertexbee.com/pics/ActionPallete.png

                                              Than whenever you want to put another group you just put in one more action into the action set.

                                              This way such script could be useful not only for switching between groups of brushes (.abr files),

                                              but also for any single tool. For instance you can switch between the brush and eraser tools with

                                              one hotkey. Any given combination is possible - brush, eraser, stamp tool, etc."

                                              • 20. Re: script request: switch Presets
                                                Paul Riggott Level 6

                                                Some tools are not selectable via an action and might be better to create another script with the tools required, in the mean time would this be any good as it loops through all the abrs?

                                                main();
                                                function main(){
                                                var abrPath = Folder(app.path+"/Presets/Brushes");
                                                var abrFiles = abrPath.getFiles("*.abr");
                                                //Reset Custom Options.
                                                //app.eraseCustomOptions( '4a01e9f0-cc9f-11df-bd3b-0800200c9a66' ); return;
                                                var Prefs = {};
                                                try{
                                                var desc1 = app.getCustomOptions('4a01e9f0-cc9f-11df-bd3b-0800200c9a66');
                                                Prefs = eval(desc1.getString(0));
                                                }catch(e){
                                                Prefs.ABR=0;
                                                Prefs.ABRCount = abrFiles.length;
                                                var desc2 = new ActionDescriptor();
                                                desc2.putString(0, Prefs.toSource()); 
                                                app.putCustomOptions('4a01e9f0-cc9f-11df-bd3b-0800200c9a66', desc2, true );
                                                    }
                                                if(Prefs.ABR == Prefs.ABRCount) Prefs.ABR = 0;
                                                loadABR(abrFiles[Number(Prefs.ABR)]);
                                                Prefs.ABR++;
                                                var desc2 = new ActionDescriptor();
                                                desc2.putString(0, Prefs.toSource()); 
                                                app.putCustomOptions('4a01e9f0-cc9f-11df-bd3b-0800200c9a66', desc2, true );
                                                }
                                                function loadABR(fileName) {
                                                    var desc10 = new ActionDescriptor();
                                                        var ref10 = new ActionReference();
                                                        ref10.putProperty( charIDToTypeID('Prpr'), charIDToTypeID('Brsh') );
                                                        ref10.putEnumerated( charIDToTypeID('capp'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
                                                    desc10.putReference( charIDToTypeID('null'), ref10 );
                                                    desc10.putPath( charIDToTypeID('T   '), new File( fileName) );
                                                    executeAction( charIDToTypeID('setd'), desc10, DialogModes.NO );
                                                }
                                                
                                                • 21. Re: script request: switch Presets
                                                  VertexBee Level 1

                                                  Wow, Paul, 10x !!! That is exactly what I wanted, thank you for the quick responce ))))

                                                   

                                                  One thing to know , it works fine in CS3 , but fails in CS2

                                                  • 22. Re: script request: switch Presets
                                                    Paul Riggott Level 6

                                                    Ah, yes it would fail as it doesn't understand custom option, for CS2 the results would have to be stored in a file, could you please try this with CS2...

                                                     

                                                    main();
                                                    function main(){
                                                    var PrefFile = new File("~/ABR_Prefs.dat");
                                                    var abrPath = Folder(decodeURI(app.path) + "/Presets/Brushes");
                                                    var abrFiles = abrPath.getFiles("*.abr");
                                                    Prefs = {};
                                                    if(PrefFile.exists){
                                                    PrefFile.open('r');
                                                    Prefs = eval(PrefFile.read());
                                                    PrefFile.close();
                                                    }else{
                                                    Prefs.ABR=0;
                                                    Prefs.ABRCount = abrFiles.length; 
                                                        }
                                                    if(Prefs.ABR == Prefs.ABRCount) Prefs.ABR = 0;
                                                    loadABR(abrFiles[Number(Prefs.ABR)]);
                                                    Prefs.ABR++;
                                                    PrefFile.open('w');
                                                    PrefFile.write(Prefs.toSource()); 
                                                    PrefFile.close();
                                                    }
                                                    function loadABR(fileName) {
                                                        var desc10 = new ActionDescriptor();
                                                            var ref10 = new ActionReference();
                                                            ref10.putProperty( charIDToTypeID('Prpr'), charIDToTypeID('Brsh') );
                                                            ref10.putEnumerated( charIDToTypeID('capp'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
                                                        desc10.putReference( charIDToTypeID('null'), ref10 );
                                                        desc10.putPath( charIDToTypeID('T   '), new File( fileName) );
                                                        executeAction( charIDToTypeID('setd'), desc10, DialogModes.NO );
                                                    }
                                                    
                                                    • 23. Re: script request: switch Presets
                                                      VertexBee Level 1

                                                      Yep, it works !

                                                      Thank you, Paul