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

illustrator Scripts

New Here ,
Jun 18, 2020 Jun 18, 2020

Copy link to clipboard

Copied

Hello,

When creating a Script, is it possible to create an Object + Text?

Unfortunately, when I do this action: I draw a line and write text, next to this line to create a caption.

But the text doesn't appear when I launch the script. 

Do you have an advice or a tip to generate text on scripts?

Thank you

TOPICS
Scripting

Views

671

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

correct answers 1 Correct answer

Enthusiast , Jun 21, 2020 Jun 21, 2020

This is script to create a line and frame to a selection object:


//get target doc
var myDoc = app.activeDocument;

//get selection object
var oTarget=myDoc.selection [0];

//get pos of selection object
var x=oTarget.left;
var y=oTarget.top;
var w=oTarget.width;
var h=oTarget.height;

//cal postion of line and frame.
var nextX=x+w ;
var nextY=y - (h/2);
var wLine=50;

// add aline
var myLine = myDoc.pathItems.add();
myLine.stroked = true;
myLine.setEntirePath([[nextX, nextY], [nextX, nextY], [nextX+wLine, nextY], [ne

...

Votes

Translate

Translate
Adobe
Community Expert ,
Jun 18, 2020 Jun 18, 2020

Copy link to clipboard

Copied

Hi,

Please share your script to see what you have achieve till now. From there we can help you.

Best regards

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 ,
Jun 18, 2020 Jun 18, 2020

Copy link to clipboard

Copied

Hello, 

Thanks for your response, 

As you can see on the pictures below, I wanted to use the script tool, to create captions on my work, using a shortcut. (CMd+Maj+F1)

During the process I create a line and text, but when I execute the script, only the line is appearing, i would like both, line and text, is there a method to do it or impossible using scripts?

 

Capture d’écran 2020-06-18 à 14.27.08.png

 

Capture d’écran 2020-06-18 à 14.28.01.png

 

Capture d’écran 2020-06-18 à 14.28.38.png

 

Capture d’écran 2020-06-18 à 14.31.12.png

 

Capture d’écran 2020-06-18 à 14.30.58.png

 

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
Community Expert ,
Jun 18, 2020 Jun 18, 2020

Copy link to clipboard

Copied

Hi,

I am not 100% sure. May be someone else from our team give your better explanation. But I have tried your steps and found that "Textframe" creation is not recorded in the actions. Therefore, when you exceute your action, textframe is not created. May be creating textframe is not recordable. I have tried in latest version of Illustrator.

 

I am not aware if this can be done in some another way using actions. Let's wait till someone else see this post.

Best regards

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
Enthusiast ,
Jun 21, 2020 Jun 21, 2020

Copy link to clipboard

Copied

LATEST

This is script to create a line and frame to a selection object:


//get target doc
var myDoc = app.activeDocument;

//get selection object
var oTarget=myDoc.selection [0];

//get pos of selection object
var x=oTarget.left;
var y=oTarget.top;
var w=oTarget.width;
var h=oTarget.height;

//cal postion of line and frame.
var nextX=x+w ;
var nextY=y - (h/2);
var wLine=50;

// add aline
var myLine = myDoc.pathItems.add();
myLine.stroked = true;
myLine.setEntirePath([[nextX, nextY], [nextX, nextY], [nextX+wLine, nextY], [nextX+wLine, nextY]]);

//add frame
var oFrame=myDoc.textFrames.add();
oFrame.contents="Your comment";
oFrame.top=nextY+10;
oFrame.left=nextX+wLine;

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