[JS] CS3 and later. Sort the Swatches alphabetically

Is there a way to sort the swatches, like I did for the paragraphStyles, characterStyles, and so on...?
There is no swatches[x].move(Location_option) in CS3 nor CS4 like paragraphStyles have.
Would CS5 have it?
Thanks, Alex.

Ok. More fixes posted at the original link:
http://ajarproductions.com/blog/2013/12/13/sort-swatches-in-adobe-inde sign/
Now includes:
Case-insensitive sorting
Error checking for certain Pantone colors that cannot be edited with a script
An alert that tells you which Swatches could not be sorted automatically
Automatically undoes the temporary name if a swatch cannot be edited
New code for those interested:
#target indesign
* Sort Swatches
* Created by Ajar Productions
* http://ajarproductions.com
* version 1.2.0
(function() {
var debug = false;
if(debug) $.writeln('--------');
app.doScript(sortSwatches, ScriptLanguage.JAVASCRIPT, [], UndoModes.ENTIRE_SCRIPT); //can undo entire script
function sortSwatches(){
    var docOpen = (app.documents.length > 0);
    var doc = (docOpen) ? app.activeDocument : null;
    var swatches = (docOpen) ? doc.swatches : app.swatches;
    var colors = (docOpen) ? doc.colors : app.colors;
    var tints = (docOpen) ? doc.tints : app.tints;
    var inks = (docOpen) ? doc.mixedInks : app.mixedInks;
    var gradients = (docOpen) ? doc.gradients : app.gradients;
    var swatchNames = swatches.everyItem().name;
    swatchNames = swatchNames.sort(customSort);
    var i = 0, len = swatchNames.length, tempSwatch, iSwatch, props, iType, unsorted = [];
    for(i;i<len;i++){
        try{
            iSwatch = swatches.item(swatchNames[i]).getElements()[0];
            iType = iSwatch.constructor.name;
            props = iSwatch.properties;
            collection = colors;
            switch(iType){
                case 'Tint':
                    iSwatch.tintValue += .01; //avoid duplicate
                    tempSwatch = tints.add(props.baseColor, props);
                    iSwatch.remove(tempSwatch);
                    break;
                case 'MixedInkGroup':
                case 'MixedInk':
                    unsorted.push(props.name);
                    break; //creates error -- skip for now
                    iSwatch.name = new Date().getTime() + ''; //produce unique value
                    tempSwatch = inks.add(props.inkList, props.inkPercentages, props);
                    iSwatch.remove(tempSwatch);
                    break;
                case 'Swatch':
                    unsorted.push(props.name);
                    break; //ignore [None]
                case 'Gradient':
                case 'Color':
                    try{
                        iSwatch.name = new Date().getTime() + ''; //produce unique value
                    } catch(e) {
                        unsorted.push(props.name);
                        break;
                    tempSwatch = (iType == 'Gradient') ? gradients.add(props) : colors.add(props);
                    try{
                        iSwatch.remove(tempSwatch);
                    } catch(e) {
                        tempSwatch.remove();
                        iSwatch.name = props.name;
                        unsorted.push(props.name);
                    break;
        } catch(e) {
            unsorted.push(props.name);
            if(debug) $.writeln(props.name +', ' + iType + ': ' + e + ', line: ' + e.line);
    if(unsorted.length) alert('Operation complete. The following swatches could not be sorted automatically:\r' + unsorted.join('\r'));
    function customSort(a,b){
        var aN = parseInt(a), bN = parseInt(b);
        if(isNaN(aN)){
            if(isNaN(bN)) {
                    var aL = a.toLowerCase(), bL = b.toLowerCase();
                    if (aL < bL) return -1;
                    if (aL > bL) return 1;
                    return 0;
            return 1;
        } else if(isNaN(bN)){
            return - 1;
        } else return aN - bN;

Similar Messages

  • I would like to create the a swatch, add it to the library and import to the swatch panel.  The help pages available relate to earlier versions of Muse, which does not work with the 2014.2 release version that I have.  I have created a library folder, imp

    I would like to create the a swatch, add it to the library and import to the swatch panel.  The help pages available relate to earlier versions of Muse, which does not work with the 2014.2 release version that I have.  I have created a library folder, imported the colour swatch as just 4 colours as a mulib file.  I drag the four colours on to the muse page in design view but that is as far as I get.  Can anyone help?  Thanks

    I don't know since I don't share anything. You'll have to peruse the help files and check the permissions and ACLs on the Shared folder. According to the permissions on the Shared folder everyone can R&W. If you want those to be inherited by everything dropped into the folder, add an ACL for
    everyone allow read, write
    Details in the manpage for chmod. The actual steps are left as an exercise.

  • HT4740 i already did the Hidding part and later moved the events and projects to the FCP events and projects folder . I still cannot share - keep getting this message "THE SHARE OPERATION 1080P FOR APPLE DEVICES (10 MBPS) HAS FAILED. Quicktime Error -50

    i already did the Hidding part and later moved the events and projects to the FCP events and projects folder . I still cannot share - keep getting this message "THE SHARE OPERATION 1080P FOR APPLE DEVICES (10 MBPS) HAS FAILED. Quicktime Error -50
    I dont know what else to do to be able to share my project - I know i updated FCPX before i shared this project  but i dont know what im doing wrong

    masterpieces wrote:
    later moved the events and projects to the FCP events and projects folder .
    Can you explain in detail what you did?
    Do any other shsre destinations complete? If not, do you get the same error message?

  • Run CS3 and 8 at the same time on mac?

    I want to download a trial version of the CS3 and run it, at
    the same time, as my existing Dreamweaver 8 on my G5 Mac running
    10.4.10. (It is NOT an Intel Mac.) There is a 30 day trial and this
    way, in the downtime between projects, I can test out and use the
    CS3 version and make sure it is stable on my system, learn to use
    it a bit, set it up the way I would want it, but always be able to
    cut back to 8 in a pinch if I have mission critical work that must
    get done. I know 8 like the back of my hand and know nothing about
    CS3 version, so I like the safety net of being able to run them
    both.
    Any issues with this? Is it possible? Will it break anything
    - like with my stable and running CS2 apps and Acrobat 7?

    On Fri, 22 Aug 2008 04:46:57 +0000 (UTC), "yuytjtdh"
    <[email protected]> wrote:
    >I want to download a trial version of the CS3 and run it,
    at the same time, as
    >my existing Dreamweaver 8 on my G5 Mac running 10.4.10.
    (It is NOT an Intel
    >Mac.)
    You can have several versions of Dw on your system ( I have
    Dw2004 up
    to CS4 beta ) but you can only have one running at a time on
    a
    standard machine.
    >There is a 30 day trial and this way, in the downtime
    between projects, I
    >can test out and use the CS3 version and make sure it is
    stable on my system,
    >learn to use it a bit, set it up the way I would want it,
    but always be able to
    >cut back to 8 in a pinch if I have mission critical work
    that must get done. I
    >know 8 like the back of my hand and know nothing about
    CS3 version, so I like
    >the safety net of being able to run them both.
    >
    > Any issues with this? Is it possible? Will it break
    anything - like with my
    >stable and running CS2 apps and Acrobat 7?
    CS3 is rather stricter about code - so depending on how well
    your code
    validates - it may complain if there are any problems.
    Bear in mind that CS4 may be released sometime in the next
    few months
    - there is no public info when that will be - so maybe better
    to wait
    for that.
    ~Malcolm~*...
    ~*

  • Can you run Photoshop CS3 and CS5 on the same system?

    I did this before on another system where I had both CS2 and CS3 installed and I could run either version when I wanted.  Back then I just never bothered to uninstall CS2.
    Now on this system I'm tunning CS3 and I have some plug ins I use regularly that aren't compatible with CS5 and I don't want to lay out the cash again for them.  So I'd like to be able to install CS5 and use it primarily but when I need to use the plug ins then just switch to CS3.
    I've noticed many programs these days won't run on top of another version.  So is there any reason I won't be able to run both?

    Absolutely.  All versions of Photoshop can coexist simultaneously, though you can only run one at a time.
    It's usual not to install the old version until you're sure the new one is working great.  If you have the space, never uninstall it.  It's handy to have it around for answering questions, here for example.
    -Noel

  • Cs2 and cs3 and cs4 on the same pc xp? could be a mess up?

    Hi
    i have some questions
    i bought cs2 some time ago , i guess 4 years but now i don't remember
    and i did installed on my pc ,  never had a problem
    after when cs3 come out , i tried the trial version , the first time i did  not like it , but after 2 weeks , i liked and i need it for camera raw
    i upgraded my cs2 license
    well the point i donwnload the trial version of cs4  (english version , because most of the tutorials are in english) while cs2 and cs3 are in my language
    i tried to make a custom install (i did not install all the comonent)
    something went wrong ,when i tried to uninstall cs4 , i don't know but cs4 did not uninstall all the components (the uninstaller keeps adobe color Na, Ja, Eu, color common setting and cmaps)
    i downloaded the cs4 cleaner for adobe page , but the adobe cleaner for cs4 was not able to clean these components, it tried to clean cs3
    well i  had to use windows installer clean up manually
    delete every thing that is related to cs4
    uninstall cs3 and re-install it
    so after this mess, i ask if i can keep cs2 cs3 and cs4 (i think i will buy or upgrade) in the same pc running xp?
    my second question
    2) after updating cs4 , run the cs4 update utility and update all the cs4 components , cs4 seems to be more fast then cs3 , still on old pc with a powerfull machine like a p4 3.6 with 2gb of ram  and a good graphic card pci express
    is my feeling ? is the cs4 more fast then cs3 on not fast pc , isn't it?
    thanks too much
    and have a nice day

    thanks John Joslin
    CS4 is faster than CS3 on a computer which supports it.
    which are the computer that supports it ? i run xp
    why did the uninstaller do a mess up ?
    thanks

  • Creating a KD Tree and only sorting the points once for each axis

    So right now I have some code for creating a KD Tree (2-Dimensions) but I am sorting the x and y values for the node each time I create a new node. Then I am taking the median, setting that as the nodes point, and passing on the left half and right halves of the remaining array to their respective children. I am using Arrays.Sort which I believe takes O(n log(n)) time per sort (once per node), but I have been reading a lot of stuff that states you can get the median in linear time so that the total build time is O(n log(n)). Unfortunately I am having difficulty understanding how. Here is a snippet of an explanation I found.
    Each node has both x-list (ordered in x-coord.) and y-list (ordered in y-coord.)
    Each pi in x-list and y-list is linked to each other.
    Both x-list and y-list can be built in linear time using the two lists of its parent.
    Thus total time to build all x-lists and y-lists is:
    T1 (n) = O(n) + 2T1 (n/2) = O(n log n).
    Since each splitting line can be found in O(1) time (via sorted lists), and there are n &#8722; 1 splitting lines in a kd-tree,
    Thus total time to find all splitting lines is
    T2 (n) = (n &#8722; 1) · O(1) = O(n).
    Hence, total prepossessing time
    = T1 (n) + T2 (n) = O(n log n).My question is, how can I build the arrays in linear time at each node? I have tried working it out on paper for the past few hours but lets say I sort the array using X first and I know that indices 0 - median will be on the left, however even if I had sorted the array by Y also, there is zero guarantee that all the points I need from x[0-median] will be in y[0-median]. They will obviously be included in x[0-median] but they will be sorted by x and not y, forcing me to resort at every single node.
    Any idea?

    swinte1 wrote:
    My question is, how can I build the arrays in linear time at each node? I have tried working it out on paper for the past few hours but lets say I sort the array using X first and I know that indices 0 - median will be on the left, however even if I had sorted the array by Y also, there is zero guarantee that all the points I need from x[0-median] will be in y[0-median]. They will obviously be included in x[0-median] but they will be sorted by x and not y, forcing me to resort at every single node.
    Any idea?So for example, you have 5 points and you sort them by x and y coordinates in two separate arrays:
    x-list: 6 1 4 3 2 5
    y-list: 6 5 1 2 3 4
    Now you want just the points to the right of 4:
    x-list: 3 2 5
    y-list: 5 2 3
    Create the x-list by iterating from the midpoint to the end.
    Add each element in the x-list to a set..
    Iterate through the y-list from left to right:
    If the point in the y-list is contained in the set, add it to the new y-list.
    This creates the arrays in linear time while keeping the points sorted. It does iterate over twice as many points in the y-list as needed though.

  • Using CS3 and CS4 on the same computer

    I have CS3 and have used it for about two years completing many projects and I am considering upgrading to either CS4 or CS5.  When and if i do this will I have to delete CS3 and replace it with the newer version or can they both remain functional on the computer?  And how compatible are the projects, can you open a CS3 project in CS4 or CS5 without issues?

    CS5 will ask to convert and save new copies of your CS3 and 4 projects when you open them. They will work in CS5, but they will not be backwards-compatible.
    And how compatible are the projects, can you open a CS3 project in CS4
    or CS5 without issues?

  • Can I still use CS3 and what is the cost to update or get another licence?

    Hello, I still have DW CS3, however I have not used it for awhile now. My questions are below.
    Is it still usable? and or how outdated is CS3?
    What is the cost to upgrade to the current version and where is the best place to purchase if I should decide to?
    I currently have it installed on 2 machines. How do I uninstall it on one of the machines to be able to install it on a 3rd machine?
    Thank you in advance for any help with these questions...very much appreciated.

    1. It's usable but very outdated by modern HTML5 and CSS3 standards.
    2. There is no upgrade option, it's too old.  You can purchase CS6 which is now 5 versions back from the current Creative Cloud version (CC 2014.1.1).   CS6 is no longer receiving updates either so  for the most part it's an "as is," legacy software.   Or you can join the Creative Cloud and get the very latest DW for approx $20/month.
    3.  No matter which product version you have, a single license allows you to have DW installed on only 2 machines at one time.  However, you can use only one at a time.   If you want to install on a 3rd machine you must deactivate one of your others or purchase another product license.  But CS3 is no longer offered or supported by Adobe.  It's too old.
    Nancy O.

  • I would like to go into my Artists section and then sort the songs by RATINGS....

    There is no longer any way to SORT MY SONGS... It only sorts the albums. which I RARELY rate.
    I should be able to go into Artists... type the name of my favorite artist in...  Nirvana for example. Then SORT BY RATING. Now I am seeing all my favorite songs, IN ORDER by my favorite band. This is the BEST way to isolate your favorite songs on an album. Otherwise I have to create a playlist for EVERY SINGLE ALBUM. Pain in the ***... PLEASE put the functionality of SORT BY RATING, DATE, ETC... back into Albums, Artists, Playlists...Genres... etc... it makes functionality of findins, selecting and sorting your music FAR MORE POWERFUL. I KNOW there are internal conflicts at Apple about this. Please put it back.

    Same way it works with any computer...when you delete something, the data isn't actually deleted, just the pointers to the data. As you use your device, the data gets overwritten, since the iOS views it as "free" space..
    If you want the data truly gone, you need to erase your phone. Same way it works on any computer.

  • Can I install Adobe CS3, and upgrade all the way through to CS5.5 on Lion?

    Hi,
    I have registered Adobe Suite products since CS3 (DVDs) and been incrementally upgrading to CS5.5 on my Macbook Pro late 2008.
    I recently bought a Mac Mini Server and I was wondering if I will be able to install my Adobe CS3 (imaged disks or external super drive) then run all my upgrades (see below) all the way through CS5.5 without any issues.
    1) Master Collection CS3 DVDs
    2) Design Premium CS4 DVDs
    3) Design Premium CS5 Download
    4) Design Premium CS5.5 Download
    I have read somewhere that I could perhaps skip the 2 older CSx, and instead, just install my CS5 from download and enter the earlier serial numbers (CS3 + CS4) requested. But until I receive the Mac Mini with Lion, I cannot try this and confirm if this actually works.
    Has anyone performed a similar installation on their Lion OS?
    Thank you.

    http://www.adobe.com/products/creativesuite/faq.html#lion-os
    Bob

  • Can't launch Phtoshop CS3 and Aperture at the same time on new iMac

    Need some assistance here. I'm extremely new to the Mac world, but my wife is having trouble editing photoshoots. She does a good deal of basic editing in Aperture, but also has some actions that she uses in CS3. She always has to close out almost all of her running application before she can launch photoshop. Message window "Adobe Photoshop CS3 cannot be launched". Is this a simple RAM upgrade issue?

    Do an +About This Mac+ from the Apple menu, and post back with the amount of RAM.
    If it has 1GB of RAM with Leopard, Mac OS X will rely more on using its virtual memory scheme. There's nothing wrong with that, but virtual memory will use hidden +swap files+ which are written to the hard drive. If the Mac has not been restarted for a while, those swap files can get fragmented over time and the Mac will run less efficiently.
    Restarting resets the swap files (starts with new ones).
    My guess is it is related to use of virtual memory and those swap files; something may have become out of sync. Or it could have been some underlying OS service (needed by CS3) that was not running properly. In any event, if it does not happen too often, I would just restart when it does happen.

  • CS3 and CS5 on the same Mac

    Hi
    Are there any known problems with keeping Indesign CS3, or for that matter the whole CS3 suite, on my Mac and installing the CS5 Suite as well. The installation docs note that I have to remove Acrobat 8 before installing 9, but I don't see any mention of having to remove CS3 apps.
    I will have the occasional need to keep files in CS3 for compatibility with some clients, so I would like to be able to run both.
    Thanks

    Might be of interest: in setups like this, with multiple versions of InDesign installed, to help avoid accidental 'up-saving' of documents, we created Soxy:
    http://www.rorohiko.com/soxy
    Cheers,
    Kris

  • Simple MouseBehavior example and later vanish the object !!!

    Hi all,
    I am new to Java3D and trying to model a network. For nodes of the network I am using spheres. Users of this model will click on any nodes, and links later, to get more information about it. I don�t know what is the best way to implement this, I know that I need a MouseBehavior to get the node which was clicked on and then show a label with some information in it. My problem is:
    1- I could not find a simple example of MouseBehavior to learn from.
    2- I don�t know how to make that label disappear later, as for example when user presses Esc.
    Thanks all,
    Ava

    Hi Venkat,
    It is still not working! I set the user data this way:
    [vector[][] include coordinates for each node]
    //To put each sphere in its position
            for ( j = 0; j < 2; j++ )// This representation includes a 2-layered network
                for ( i = 0; i < subnetCount; i++ ) {
                    if ( j == 1 && nodes2.get( i ).equals( "Not Found!" ) ) {
                        continue;
                    Sphere s = new Sphere( 0.07f );
                    s.setUserData( j+"."+i );
                    s.setCapability( Shape3D.ENABLE_PICK_REPORTING );
                    s.setCapability( Shape3D.ALLOW_PICKABLE_WRITE );
                    s.setCapability( Shape3D.ALLOW_PICKABLE_READ );
                    s.setCapability( Shape3D.ALLOW_APPEARANCE_WRITE );
                    s.setCapability( Shape3D.ALLOW_APPEARANCE_READ );
                    s.getShape(Sphere.BODY).setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
                    s.setAppearance( app[j] );
                    // This sphere can be picked to view more information about the corresponding cluster
                     s.setPickable( true );
                    TransformGroup tg = new TransformGroup();
                    Transform3D transform = new Transform3D();
                    transform.setTranslation( vector[j] );
    tg.setTransform( transform );
    tg.addChild( s );
    Bounds boundSphere = new BoundingSphere( new Point3d( vector[j][i].x, vector[j][i].y,vector[j][i].z), 1.0 );
    PickMouseBehavior mousePick = new PickHighlightBehavior ( canvas3D, globalBR, boundSphere );
    //Add the sphere to the graph
    globalBR.addChild( tg );
    }Then I try to get it by:pickResult = pickCanvas.pickClosest();
         if (pickResult != null) {
         shape = (Shape3D) pickResult.getNode(PickResult.SHAPE3D);
    System.out.println( "Shape name: "+shape.getUserData()); // It returns all nul!!!
    It returns null ! I checked It actually sets the user data but when it is picked, it returns null!
    Your concerns are appreciated,
    Ava                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • CS3 and CS5 on the same PC ?

    Hi all,
    I am currently working with the Creative Suite CS3. I recently purchased the Creative Suite CS5. But I would like to keep the CS3 on my computer (for info, the characteristics of my PC : Intel Pentium Dual-Core Processor I5500, 4GB Ram, Graphic Card ATI FirePro V5800 1GB, 320GB HD).
    Here is my question : can I install the 2 versions on my PC without any problem ? Problems of compatibility or other ?
    Thank you,
    Sof

    I’d be way more concerned that you just bought CS5 since it’s been replaced by CS5.5 for almost a year. Where did you buy it?
    If it was by chance an authorized reseller then yes, it’s perfectly okay to have it installed side by side with CS3.
    Bob

Maybe you are looking for