Skip to main content
sensibleworld
Participating Frequently
November 15, 2017
Answered

Script to Sort Artboard List Alphabetically

I'm on the lookout for a simple script to sort an Illustrator artboard list alphabetically. (I don't need the artboards themselves rearranged on the canvas, just the order of the artboards in the list.)

In the example (image) below, the artboard list reads:

1. life-ring

2. wheelchair-alt

3. wheelchair

4. information

...

30. blind-walking

The desired result would be for the artboard list itself to be sorted to read:

1. assistive-listening

2. assistive-listening-telecoil

3. blind-walking

4. braille

...

30. wheelchair-alt

I've scoured the forums for solutions to this. The closest I could find is here: Sort artboards by name, but it doesn't seem to work in Illustrator CC. Also found this (How to sort objects alphabetically (inside of a layer)?), but it is layer-specific, not artboard.

Thanks so much for any help!

Service283589231bf1Correct answer
Participant
June 17, 2025

Never mind. It did alphabetize the artboards, it just didn't rearrange them. I forgot that I did that myself last week (using the Rearrange All artboard tool) so I thought it wasn't working at first. All good!

16 replies

Participant
May 27, 2026

Worked perfectly! Thanks so much :)

Translate
CarlosCanto
Community Expert
Community Expert
December 1, 2019

Hi majliniok, transitioning to the new forums ruined all scripts. 

Here's the original script posted by OMOTI

function sortArtboard() {  
    var doc = app.activeDocument,  
        properties = [],  
        i,  
        max;  
  
    function copyProperties(source) {  
        var props = {},  
            key;  
        for (key in source) {  
            try {  
                props[key] = source[key];  
            } catch (e) {  
            }  
        }  
        return props;  
    }  
  
    function pasteProperties(source, destination) {  
        var key;  
        for (key in source) {  
            destination[key] = source[key];  
        }  
    }  
  
    function compareName(a, b) {  
        var comparison = 0;  
        if (a.name > b.name) {  
            comparison = 1;  
        } else if (a.name < b.name) {  
            comparison = -1;  
        }  
        return comparison;  
    }  
  
    for (i = 0, max = doc.artboards.length; i < max; i += 1) {  
        properties.push(copyProperties(doc.artboards[i]));  
    }  
  
    properties.sort(compareName);  
  
    for (i = 0, max = doc.artboards.length; i < max; i += 1) {  
        pasteProperties(properties[i], doc.artboards[i]);  
    }  
  
}  
  
sortArtboard(); 
Translate
Participant
December 1, 2019

Thank You ! Now working great 🙂

Translate
OMOTI
Inspiring
November 18, 2017

Hi,

Artboard object probably has no method for sorting.

Since it does not generate an Artboard object, it may run lightly.

This try it.

function sortArtboard() {

    var doc = app.activeDocument,

        properties = [],

        i,

        max;

    function copyProperties(source) {

        var props = {},

            key;

        for (key in source) {

            try {

                props[key] = source[key];

            } catch (e) {

            }

        }

        return props;

    }

    function pasteProperties(source, destination) {

        var key;

        for (key in source) {

            destination[key] = source[key];

        }

    }

    function compareName(a, b) {

        var comparison = 0;

        if (a.name > b.name) {

            comparison = 1;

        } else if (a.name < b.name) {

            comparison = -1;

        }

        return comparison;

    }

    for (i = 0, max = doc.artboards.length; i < max; i += 1) {

        properties.push(copyProperties(doc.artboards));

    }

    properties.sort(compareName);

    for (i = 0, max = doc.artboards.length; i < max; i += 1) {

        pasteProperties(properties, doc.artboards);

    }

}

sortArtboard();

Translate
sensibleworld
Participating Frequently
November 18, 2017

Awesome! That worked exactly as I needed it to. Thank you so much!

Translate