1 Reply Latest reply on Apr 16, 2015 4:32 PM by DBarranca

    How can I get Pattern list Photoshop

    Mahdi Abedi Level 1

      Hi

      I want access to preset files list (Pattern , Style , ...) in Photoshop with ActionScript in ExtentionBuilder 2.1 or JavaScript. I can just get fonts and actions in API. Please Help me.

        • 1. Re: How can I get Pattern list Photoshop
          DBarranca Level 4

          Have fun!

           

          function s(str) { return stringIDToTypeID(str) }
          
          var ref = new ActionReference();
          ref.putProperty(s('property'), s('presetManager'));
          ref.putEnumerated(s('application'), s('ordinal'), s('targetEnum'));
          var desc = executeActionGet(ref).getList(s('presetManager'));
          
          var presetDesc = undefined,
              lists = desc.count;
          
          for (var i = 0; i < lists; i++) {
            var descName = undefined;
            if (typeIDToCharID(desc.getClass(i)) === 'PttR') { descName = "Pattern" } else { descName = typeIDToStringID(desc.getClass(i)) }
            $.writeln(descName.toUpperCase());
            presetDesc = desc.getObjectValue(i).getList(s('name'));
          
            var presetNames = [];
            for (var j = 0, len = presetDesc.count; j < len; j++) {
                presetNames.push(presetDesc.getString(j));
            }
            $.writeln(presetNames.toSource());
          }
          

           

          Davide Barranca

          ---

          www.davidebarranca.com

          www.cs-extensions.com