Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

Create adobe illustrator rectangle script?

$
0
0

hi, this is a vba script that works in corel draw. I want it to work in illustrator instead but I don't know how to ammend it into javascript and adobe scripting language! Can anybody help??


what it does:

with an object selected
I run script
it creates
around the selected object a thin rectangle with a margin from the object of 0.05cm
then groups the object and rectangle togeather


thats it


Martin



Sub makeRect()

    Dim s As Shape, sRect As Shape
    Dim x As Double, y#, h#, w#
    Dim dMarg#
    Dim sr As New ShapeRange
  
    dMarg = 0.05
    ActiveDocument.Unit = cdrCentimeter
  
  
  
    Set s = ActiveShape
    If s Is Nothing Then Exit Sub
  
    s.GetBoundingBox x, y, w, h
  
    Set sRect = ActiveLayer.CreateRectangle2(x - dMarg, y - dMarg, w + (dMarg * 2), h + (dMarg * 2))
    sRect.Outline.Width = 0.001
  
  
  
    sRect.CreateSelection

    sr.Add sRect
    sr.Add s
    sr.Group
  
End Sub


Viewing all articles
Browse latest Browse all 12845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>