Skip to content

Commit

Permalink
new script
Browse files Browse the repository at this point in the history
  • Loading branch information
saniainf committed Jan 18, 2018
1 parent 42bc9f2 commit 0a7a972
Showing 1 changed file with 87 additions and 0 deletions.
87 changes: 87 additions & 0 deletions allFilesPlaceToPW.bas
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
Attribute VB_Name = "allFilesPlaceToPW"
Sub SaveAndClose()
Dim doc As Document
Dim aPage As Page
For Each doc In Application.Documents
doc.Save
doc.Close
Next doc
End Sub

Sub PlaceToPW()
Application.Optimization = True

Dim doc As Document
Dim aPage As Page
For Each doc In Application.Documents
doc.Activate
doc.Unit = cdrMillimeter
For Each aPage In doc.Pages
aPage.Activate
PlaceAllToPowerClip aPage
Next aPage
Next doc

Application.Optimization = False
ActiveWindow.Refresh
Application.Refresh
End Sub

Sub ChangePageSize()
Dim height As Integer
Dim width As Integer

Set height = 127
Set width = 47

Application.Optimization = True

Dim doc As Document
Dim aPage As Page
For Each doc In Application.Documents
doc.Activate
doc.Unit = cdrMillimeter
For Each aPage In doc.Pages
aPage.Activate
aPage.SizeHeight = height
aPage.SizeWidth = width
Next aPage
Next doc

Application.Optimization = False
ActiveWindow.Refresh
Application.Refresh
End Sub


Sub PlaceAllToPowerClip(aPage As Page)
Dim aSel As ShapeRange
Dim shPowerClip As Shape
Dim sL As Integer
Dim sT As Integer
Dim sR As Integer
Dim sB As Integer
Dim aLayer As Layer
Dim guideL As Boolean
guideL = False
If aPage.GuidesLayer.Editable Then
guideL = True
aPage.GuidesLayer.Editable = False
aPage.GuidesLayer.Printable = False
End If
sL = aPage.BoundingBox.Left
sT = aPage.BoundingBox.Top
sR = aPage.BoundingBox.Right
sB = aPage.BoundingBox.Bottom
For Each aLayer In aPage.Layers
If aLayer.Editable Then
If aLayer.Shapes.All.Count > 0 Then
Set aSel = aLayer.Shapes.All
Set shPowerClip = aLayer.CreateRectangle(sL, sT, sR, sB)
shPowerClip.Outline.SetNoOutline
aSel.AddToPowerClip shPowerClip, cdrFalse
End If
End If
Next aLayer
aPage.GuidesLayer.Editable = guideL
End Sub

0 comments on commit 0a7a972

Please sign in to comment.