• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Script to create circles

Guest
Jul 31, 2011 Jul 31, 2011

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

TOPICS
Scripting

Views

2.8K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 31, 2011 Jul 31, 2011

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 31, 2011 Jul 31, 2011

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);
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 01, 2011 Aug 01, 2011

Copy link to clipboard

Copied

You got it, cool

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Aug 01, 2011 Aug 01, 2011

Copy link to clipboard

Copied

LATEST

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:

  1. First you can create the one circle in the inline anchored position with circle properties of color stroke width height and also applied the Object style are you create the object style just.
  2. Next you cut the inline anchored circle.
  3. Use the Find Grep Options to this (10|\b\d\b) this grep only find the 1-10 digits range only.
  4. Change options $1~c.
  5. Please refer the attached snapshot.
  6. After just adjust manually in the circled as you want your position, next you update the redfine style in the Object style.

Picture 2.png

I hope you expect i full fill.

thx

csm_phil

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines