Skip to main content
Known Participant
August 1, 2019
Question

app.activeDocument.distribute is not a function

  • August 1, 2019
  • 2 replies
  • 853 views

Every align/distribute script seems to use this function, but if I run it, I just get "app.activeDocument.distribute is not a function"

the script has already selected the items and then it fails on this distribute line. 

What am I doing wrong?

the offending line (though I've tried variations from other scripts)

app.activeDocument.distribute(app.activeDocument.selection, DistributeOptions.HORIZONTAL_SPACE, AlignDistributeBounds.ITEM_BOUNDS, false);

Thanks in advance!

This topic has been closed for replies.

2 replies

Silly-V
Legend
August 1, 2019

Those are InDesign scripts, but in Illustrator for now we have to manually do any distribution by translating various art objects using functions like pageItem.translate(dX, dY), etc and using manual maths for those dX and dY values.

InDesign has much more scripting power than Illustrator, so it isn't uncommon for someone to mistake an InDesign script for an Illustrator script, or to assume that the scripting commands are going to be the same for both the programs.

Lumenn
Inspiring
August 1, 2019

I don't think, that there is distribute function in Illustrator, it looks like inDesign function.

You will have to write the code for distribiution, or use actions.