help: indesign - select text, set baseline randomly

hello,

after looking for a plugin to do this, i opted to try developing an applescript instead.
what i want to do is this: i select some text in InDesign CS2 (a word or short sentence) and run a script that will set the baseline shift to a random value between min/max values (say 6 pt and -6 pt).

machine specs: indesign cs2, osx 10.4.9

i kind of figured how to get the selection and set the baseline shift but i’m not sure about the creating the range then looping through each character, selecting a random range value and assigning it to the character.

i’ve spent some time searching this forum and reading/comparing scripts that do random functions but most are limited to selecting files or folders, not choosing values in a range.
is this script difficult? is doesn’t seem like it should be but i’m not much of a programmer/scripter so any help or advice (or referring me to an existing plugin) would be appreciated.

thanks

Professor: A random value in a range is as easy as…
set myVariable to (random number from minimumValue to maximumValue). You can optionally add “as integer” if you don’t want decimal values.


set myVariable to (random number from -6 to 6) as integer

I don’t have ID here but syntactically it should be roughly somewhere around:


repeat with thisCharacter in (characters of text frame 1) -- or whatever text frame you have specified
set baseline of thischaracter to ((random number from -6 to 6) as integer)
end repeat

The particulars may not be correct (baseline?) but the method is what I would try.

Have fun,
Jim Neumann
BLUEFROG

thanks, that helps with the range and loop, i’ll add those to the get selection and baseline bits. hopefully i can cobble together something that will work.