FORUMS: list search recent posts

# Alpha numeric count expression

FAQ   •   VIEW ALL
 Alpha numeric count expression on May 30, 2013 at 4:09:37 am

Hey Guys,

I'm trying to find/create an alphanumeric count expression that I can customise. I'm looking at counting through a catalog sequence (from right to left through all combinations) like;

1AA1AA;
1AA1AB;
1AA1AC-1AA1AZ;
1AA1BA-1AA1ZZ;
1AA2AA-1AA9ZZ;
1AB1AA etc

(there is no numeral 0 in the catalog only A-Z and 1-9)

Obviously I can set this up manually but I'm fearing the thought of keyframing that. Any ideas on where to start from the brains at the Cow would be awesome.

Cheers,
Corey

 Re: Alpha numeric count expressionon May 30, 2013 at 5:21:43 am

Try this:

n = Math.floor(effect("Slider Control")("Slider"));
d1 = Math.floor(n/(26*26*9*26*26));
d2 = Math.floor(n%(26*26*9*26*26)/(26*9*26*26));
d3 = Math.floor(n%(26*9*26*26)/(9*26*26));
d4 = Math.floor(n%(9*26*26)/(26*26));
d5 = Math.floor(n%(26*26)/(26));
d6 = Math.floor(n%26);
String.fromCharCode(49+d1) +
String.fromCharCode(65+d2) +
String.fromCharCode(65+d3) +
String.fromCharCode(49+d4) +
String.fromCharCode(65+d5) +
String.fromCharCode(65+d6)

Connect n to your count. When n = 0, the result should be 1AA1AA, when n = 1, result = 1AA1AB, etc.

Dan

 Re: Alpha numeric count expressionon May 30, 2013 at 11:28:47 am

Thanks Dan,

That works a treat. Is there any way to format the text style? (i.e. tracking, leading, spacing etc) Does this have to be included into the string?

 Re: Alpha numeric count expressionon May 30, 2013 at 4:30:30 pm

If I understand what you're asking, you're pretty much limited to what you can do with the Animators and Selectors. Any per-character formatting you do to the text itself will be ignored (except for that applied to the first character, which gets applied to everything).

Dan