indeed, the subject was interesting enough to keep me digging.
It turns out it could be done using vbscript, if you're on a mac try to see if you can addapt the code to apple script
' GET JUSTIFICATION ENUMERATION MEMBERS VIA VBS/JAVASCRIPT
' carlos canto - 9/12/25
' METHOD
' apply justification to text frames via vbs since vbs accepts enum index numbers
' inconrrect or non-existing enum indexes will raise errors that can be ignored
' apply 20 or more to try to cover all members, then remove all error text frames
' then have vbs execute a Javascript script to read the remaining text frames justification properties
' embellish and return the enums as string
' apply the returned javascript string to a text frame as proof of concept to further do something with it
' Create Illustrator application object
Set app = CreateObject("Illustrator.Application.29")
On Error Resume Next
' Add a new document
Set doc = app.documents.Add
app.DoJavaScript("alert(activeDocument.name)") ' just to make sure connection has been established
' Define position and size for the area text frame
Dim left, top, width, height
left = 100
top = doc.height - 100
width = 300
height = 100
' Add area text frame
Set rect = doc.PathItems.Rectangle(top, left, width, height)
Set textFrame = doc.TextFrames.AreaText(rect)
str = "placeholder text"
textFrame.Contents = str
msg = "" ' to hold enums back from javascript
' create new text frames and apply justification one at a time starting with 0
' increase if there are objects with more than 20 members
for i = 0 to 20
set itext = doc.textFrames.Add
itext.contents = str & " " & i & " " & top
itext.left = left
itext.top = top
itext.TextRange.ParagraphAttributes.Justification = i
' out of index enum members will raise errors, skip, clear error and continue
if err.number <> 0 then
itext.contents = err.number & ": " & err.description
'msg = "Error " & err.number & ": " & err.description
'msgbox msg
err.clear
end if
top = top - itext.height
next
' remove error text frames
for a=doc.textFrames.count to 0 step -1
set itext = doc.textFrames(a)
if itext.contents = "-2147220278: Enumerated value expected" then
itext.delete
end if
next
' read enum members via Javascript
msg = app.doJavascript("var idoc = app.activeDocument; var enums = []; var tfs = idoc.textFrames; for (var a=tfs.length-2; a>=0; a--) {var tf = tfs[a]; enums.push(tf.textRange.paragraphAttributes.justification); tf.remove()} ; enums.join('\n');")
textFrame.contents = msg
msgbox msg
WScript.quit
... View more