Copy link to clipboard
Copied
Hi!
i need to create a Indesign script to create "bubbles" inside a document like OMR forms (http://www.oocities.org/mingwai_lucky/images/OMR.jpg).
In my document ther is a lot of circles with a letter inside and each circle should be at an exact distance between each. I do this manually, but I want to know how to make a script for InDesign to generate this "bubbles" and do my job easy.
I appreciate any help you can give me
Copy link to clipboard
Copied
Hi,
You could do:
1. Create object style with width, rule width, color, etc.,
2. Script starting with simple dialog getting information like: where the first bubble should start, horizontal and vertical space between bubbles, how many bubbles you want horizontally and vertically
3. We those information we could running simple loop to create a matrix like bubbles
But for me, we can just go manually, create a first row of bubbles, group it, copy&paste (or ctrl+shift++alt down arrow with modified doc preferences).
Cheers
Shiv
Copy link to clipboard
Copied
Something like this should get you started:
var document = app.documents.add();
var nrOfCircles = 100;
var nrOfColumns = 10;
var top = 40;
var left = 40;
var width = 20;
var height = 20;
var space = 5;
for (var index = 0; index < nrOfCircles; index++)
{
if(index > 0 && index % nrOfColumns == 0)
{
// Reset left
left = 40;
// Start new row
top += height + 5;
}
addCircle(index + 1, left, top, left + width, top + height);
left+= width + space;
}
function addCircle(number, left, top, right, bottom)
{
var circle = document.ovals.add();
var textFrame = circle.textFrames.add();
var text = textFrame.texts.firstItem();
circle.geometricBounds = [top, left, bottom, right];
circle.strokeColor = document.swatches.itemByName("Black");
circle.strokeWeight = 2;
textFrame.geometricBounds = [top, left, bottom, right];
text.pointSize = 12;
text.justification = Justification.CENTER_ALIGN;
textFrame.textFramePreferences.verticalJustification = VerticalJustification.CENTER_ALIGN;
textFrame.contents = String(number);
}
Copy link to clipboard
Copied
You got it, cool
Copy link to clipboard
Copied
HI Elias,
I have one idea to share with you, if you like do this way is very very simple.
This is the easy way to you achieve your circle placement.
Steps to be followed:
I hope you expect i full fill.
thx
csm_phil