• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Need help with making 308 different-numbered text boxes.

New Here ,
Jul 09, 2024 Jul 09, 2024

Copy link to clipboard

Copied

So I need to make lists of 30 numbers on a page until it reaches 308. What is the best way to do this? I've tried a script but it's giving an error and was just wondering if there was a better way to do it or if anyone has a better script to use. Any help is appreciated! 

Thanks in advance!

TOPICS
How-to , Scripting , Tools

Views

259

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Participant ,
Jul 09, 2024 Jul 09, 2024

Copy link to clipboard

Copied

could you provide an image of what youre looking for?

is Indesign an option for you?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 09, 2024 Jul 09, 2024

Copy link to clipboard

Copied

It is, yes. And the layout would look somewhat like this. Each page would have 30 numbers and I need the numbers to go until 308- however many pages that is.

The layout doesn't matter too much, placing them would be easy, I'm just mainly looking for a way to get 300 unique textboxes without typing them.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 09, 2024 Jul 09, 2024

Copy link to clipboard

Copied

a script could do this, but i think learning InDesign's Data Merge tool would be better.

you would create an excel sheet of whatever Data you want. in this case it's just the numbers 1-300+.

Then you create a file in indesign and design the text box to your liking then merge the data and it will replicate the data through the design. It would be a multi-record merge.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 09, 2024 Jul 09, 2024

Copy link to clipboard

Copied

Ok, sweet thanks for the help. Didn't know such a tool existed haha.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 09, 2024 Jul 09, 2024

Copy link to clipboard

Copied

With some helper objects (straight lines with a certain number of anchor points), you may use the NumeratePoints script that is provided by Sergey Osokin.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 09, 2024 Jul 09, 2024

Copy link to clipboard

Copied

LATEST

As @Robert38512781pn4f mentioned, they may be better ways to do this. But since I had a function already that does most of this, I will share this script, too.

- Mark

/**
 * @file Make Numbered Text Frames On Artboards.js
 * 
 * Makes numbered text frames on available artboards.
 * Adjust the constants START, END, ITEMS_PER_ARTBOARD,
 * GAP_PTS and TEXT_SIZE_PTS.
 *
 * @author m1b
 * @version 2024-07-10
 * @discussion https://community.adobe.com/t5/illustrator-discussions/need-help-with-making-308-different-numbered-text-boxes/m-p/14728931
 */
(function () {

    const START = 1,
        END = 308,
        ITEMS_PER_ARTBOARD = 30;

    const GAP_PTS = 60,
        TEXT_SIZE_PTS = 30;

    var doc = app.activeDocument,
        total = END - START,
        len = Math.ceil(total / ITEMS_PER_ARTBOARD);

    if (doc.artboards.length < len)
        return alert('Not enough artboards to fit ' + ITEMS_PER_ARTBOARD + ' numbers per artboard.\n(' + doc.artboards.length + ' available, ' + len + ' required).');

    for (var i = 0, ab, bounds, remainder = total + 1, counter, frame, frames; i < len; i++) {

        frames = [];
        counter = Math.min(ITEMS_PER_ARTBOARD, remainder);

        while (counter--) {
            frame = doc.textFrames.add();
            frame.contents = total - (--remainder) + START;
            frame.textRange.size = TEXT_SIZE_PTS;
            frames.push(frame);
        }

        ab = doc.artboards[i];
        bounds = ab.artboardRect;

        arrangeItems({
            items: frames,
            gap: GAP_PTS,
            maxWidth: bounds[2] - bounds[0],
            origin: [bounds[0], bounds[1]],
        });

        if (remainder < START)
            break;

    }

})();


/**
 * Positions page items in a simple L-R, T-B grid,
 * given `maxWidth`, with `gap` between each item.
 * The `lineHeight` variable is the largest height
 * in a given row.
 * @author m1b
 * @version 2023-11-01
 * @param {Object} options
 * @param {Array<Number>} options.origin - the origin [x,y] of the top-left of the grid.
 * @param {Array<PageItem>} options.items - the items to position.
 * @param {Number} [options.maxWidth] - the maximum width of the grid area, in points (default: no maximum).
 * @param {Number} [options.gap] - the gap between items (default: 0).
 */
arrangeItems = function arrangeItems(options) {

    options = options || {};

    var origin = options.origin,
        items = options.items,
        maxWidth = options.maxWidth || Infinity,
        gap = options.gap || 0;

    var x = 0,
        y = 0,
        lineHeight = 0;

    for (var i = 0; i < items.length; i++) {

        var item = items[i];

        if (x + item.width > maxWidth) {
            // move down
            x = 0;
            y -= (lineHeight || item.height) + gap;
            lineHeight = 0;
        }

        // position the item
        items[i].position = [origin[0] + x, origin[1] + y];

        // move right
        x += item.width + gap;

        if (item.height > lineHeight)
            lineHeight = item.height;

    }

};

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines