Skip to main content
Mimi Mart
Participant
November 28, 2020
Question

Is there a way to re-number values in a text box, or import a list of numbers to text box?

  • November 28, 2020
  • 3 replies
  • 350 views

I'm making a diagram of pattern peices that must be placed down in a numbered order, and often need to add a peice or redo the order of placement.  and every time I have to re number the entire file.  I have to click on every single text box and manually change everything.  Is there a way to make it so that when one value on an artboard changes, the rest do in turn, like in Excel?  Or a way to link excel and Illustraor? 

 

I personally use Illustrator but if this is possible for any of the Creative Suite programs, I'll happily switch over to another program once I am at the numbering stage.

 

Thanks in advance! 

This topic has been closed for replies.

3 replies

femkeblanco
Legend
November 29, 2020

Alternatively, this will increase every number higher than the selected number by one.

 

var frames = app.activeDocument.textFrames;
var x = 0;
for (var i = 0; i < frames.length; i++) {
  if (selection[0] == frames[i]) {
    x = i;
    break;
  }
}
for (var i = 0; i < frames.length; i++) {
  if ((Number(frames[i].contents) >= Number(frames[x].contents)) && 
       frames[i] != frames[x]) {
    frames[i].contents = Number(frames[i].contents) + 1;
  }
}

 

 

femkeblanco
Legend
November 28, 2020

Each time this is run, it will increase every number by one. 

 

var doc = app.activeDocument;
var frames = doc.textFrames;
for (var i = 0; i < frames.length; i++) {
  frames[i].contents = Number(frames[i].contents) + 1;
}

 

 

Bill Silbert
Community Expert
Community Expert
November 28, 2020

You might want to try importing the Illustrator art into InDesign and using threaded text frames in that program for the numbers. To learn how to do this see: https://helpx.adobe.com/lu_en/indesign/using/threading-text.html.