Hi all, im trying to get artboards number ranges depending on length of a dynamic set length. Im using different logo types (max 4 in length) to get all the artboard numbers of that set. Each set starts with the logo type as name and has more data in the artboardname. for example i use 3 logo types; logo, logotype, logomark. Each set has 6 artboards with a total of 8. I can of course make 4 different function according to the logotype and then make the ranges. But is it possible to do this all dynamic in a short function? So in this example the artboards are like this example of 3 logotypes with a total of 18 artboards Ive found a piece of code on stackexchange to divide that into 3 ranges. Which is like this, changed it to work in illustrator var logtypesLen = logotypes.length;
// https://math.stackexchange.com/questions/385514/algorithm-to-separate-an-array-of-numbers-into-low-medium-and-high-ranges
// list.sort();
// part1 = list[0 : n/3];
// part2 = list[n/3 : 2*n/3];
// part3 = list[2*n/3 : n];
var abs = docRef.artboards;
var n = abs.length;
// var part1 = abs[0] +" "+abs[n/3-1];
// var part2 = abs[n/3] +" "+abs[2*n/3-1];
// var part3 = abs[2*n/3] +" "+abs[n-1];
var part1 = (0) +" "+(n/3-1);
var part2 = (n/3)+" "+(2*n/3-1);
var part3 = (2*n/3) +" "+(n-1); I could make this so it would work in logo types set of 4, but i feel that uses more code than needed. Since i also need to have function for a set of 1 and a set of 2. Here is example of how it now works. I made this logo packer CEP panel. When i change the margins and have logotypes set to all, all work nice. The small logo info imprint gets placed neatly around all artboards. But when i use a single artboard, it gets misplaced. This is because im not getting the proper range of artboards. Ps dont mind the alerts, this is to check my example code i pasted The imprint basically says per row logotype and then per each row has either; full color, inverted, black, white & possible extra colors. This info is placed as the small imprint in fuchia. If i can get the correct artboard range. Than when i edit a single artboard, i only need address that row of imprint data. I was also thinking of just updating everything no matter what. Perhaps that is a better choice without making it to complicated. Im trying to explain my need as best as possible. Hope you understand
... View more