Skip to main content
Sparth369
Known Participant
December 16, 2015
Question

Script - Create a small circle at the corner of the artboard

  • December 16, 2015
  • 1 reply
  • 6109 views

Can someone help me or guide me to the right direction of how to do this?

Basically, this is what I want the script to do

1. Make artboard the size of my selected artwork + 1" offset

2. Create a circle at each of the corner of the artboard

I figured out the script for #1 but I can't find figure out #2. Could anyone help?

Thanks in advance

This topic has been closed for replies.

1 reply

Silly-V
Legend
December 16, 2015

Wherever you want to put a circle, use the document.pathItems.ellipse() function. Into this function you pass 4 numbers separated by commas, the 1st 2 numbers are the top and the left coordinates, while the next 2 are width and height, respectively.

One such examples is:
var doc = app.activeDocument;

var newCircle = doc.pathItems.ellipse(0,0,10,10);

It creates a 10-diameter circle with the top/left of its bounding box at 0,0

For me it produced the following result:

Sparth369
Sparth369Author
Known Participant
December 16, 2015

‌i just figured out that part but now how do I make it align to top right based on my artboard size?

Sparth369
Sparth369Author
Known Participant
December 17, 2015

That's so uncool!

One of the basic things though which may help to prevent something like this is to wrap all of your scripts in a function closure.


Will - If I run the script constantly for checking errors while coding.

Silly-V - No idea what function closure means but if you could give me an example and I can fix it.