Skip to main content
New Participant
April 17, 2018
Question

Create callout box around text with arrows

  • April 17, 2018
  • 2 replies
  • 4477 views

Hi!

i Dont know were to start but i need to create a javascript for cs5 that create a stacked text  with a box and outline from an existing layer text.

therefor the box need to be dynamic in size Due different texts.

colour(box, stroke,text),font, strokewidth,leading and the worst part is it needs an arrow that melts with box colour and stroke on all 4 sides( the idea is to create an rotated box on the middle of each line (box) that surronds the text and then group them.

This topic has been closed for replies.

2 replies

pixxxelschubser
Adobe Expert
April 18, 2018

No script is needed.

You only will need one paragraph style and one grafik style. But I'm not at home in the moment.

pixxxelschubser
Adobe Expert
April 17, 2018

Please show something

New Participant
April 18, 2018

so, the text comes from a simple text in a layer called text,

and this is the graphics I want to make with a script, is it possible?

and more text, wider box, and the arrows or mini boxes is suppose to be in the middle wich I failed with this test.

Disposition_Dev
Brainiac
April 18, 2018

**DISCLAIMER**

This is horrible code. it has lots of room for improvement. But hopefully it will point you in the right direction. If you have any questions at all i'm glad tohelp.

function test()

{

    var valid = true;

    var docRef = app.activeDocument;

    var diamondSize = 10;

    var myTextFrame = docRef.textFrames[0];

    var myRect = docRef.pathItems.rectangle(myTextFrame.top,myTextFrame.left,myTextFrame.width,myTextFrame.height);

    var diamondLeft = docRef.pathItems.rectangle(0,0,diamondSize,diamondSize);

    diamondLeft.rotate(45);

    var diamondTop = docRef.pathItems.rectangle(0,0,diamondSize,diamondSize);

    diamondTop.rotate(45);

    var diamondRight = docRef.pathItems.rectangle(0,0,diamondSize,diamondSize);

    diamondRight.rotate(45);

    var diamondBottom = docRef.pathItems.rectangle(0,0,diamondSize,diamondSize);

    diamondBottom.rotate(45);

    diamondLeft.left = myRect.left - diamondLeft.width/2;

    diamondLeft.top = myRect.top - myRect.height / 2 + diamondLeft.height/2;

    diamondTop.left = myRect.left + myRect.width/2 - diamondTop.width/2;

    diamondTop.top = myRect.top + diamondTop.height/2;

    diamondRight.left = myRect.left + myRect.width - diamondRight.width/2;

    diamondRight.top = myRect.top - myRect.height/2 + diamondRight.height/2;

    diamondBottom.left = myRect.left + myRect.width/2 - diamondBottom.width/2;

    diamondBottom.top = myRect.top - myRect.height + diamondBottom.height/2;

  

}

test();