En las primeras versiones de Corel, el lenguaje preferido era CorelScript.
A partir de la versión 12 (quizás antes), el lenguaje preferido pasó a ser VBScript con la librería VBA Corel. Para programar en VBScript es necesario conocer el Corel Object Model. Info en el mismo site que arriba, y en: http://apps.corel.com/partners_developers/csp/resources/dvba_pg.pdf
Dim var1$
ChDir "C:\Documents and Settings\Usuario\Mis documentos\casamiento diseño gráfico\libro firmas\preparación"
Open "orden de las paginas.txt" For Input Access Read As #256
Dim i As Integer
i = 1
Dim p As New Collection
Do While Not EOF(256)
Line Input #256, var1$
p.Add var1$
Loop
Close #256
Dim docNum As Integer
Dim upfit As Integer
upfit = (4 - p.Count Mod 4) Mod 4 + p.Count
docNum = 1
UserForm1.Label1.Caption = "0%"
UserForm1.show vbModeless
For i = 1 To upfit / 2
If i Mod 10 = 1 Then
ChDir "C:\Documents and Settings\Usuario\Mis documentos\casamiento diseño gráfico\libro firmas\preparación"
FileCopy "plantilla.cdr", "copy preparación " + CStr(docNum) + ".cdr"
Application.OpenDocument "copy preparación " + CStr(docNum) + ".cdr"
ActiveDocument.ReferencePoint = cdrBottomLeft
docNum = docNum + 1
Else
ActiveDocument.AddPages 1
End If
Dim even, odd As Integer
If i Mod 2 = 0 Then
even = i
odd = upfit + 1 - i
Else
even = upfit + 1 - i
odd = i
End If
ActiveDocument.ActivePage.Name = "[" + CStr(even) + ", " + CStr(odd) + "]"
' inserto 1
ActiveDocument.ActivePage.ActiveLayer.Import p.Item(odd)
ActiveDocument.Selection.SizeHeight = 210 / 25.4
ActiveDocument.Selection.SizeWidth = 210 / 25.4
ActiveDocument.Selection.PositionX = 240 / 25.4
ActiveDocument.Selection.PositionY = 55 / 25.4
' inserto 2
If even > p.Count Then GoTo NUMERAR
ActiveDocument.ActivePage.ActiveLayer.Import p.Item(even)
ActiveDocument.Selection.SizeHeight = 210 / 25.4
ActiveDocument.Selection.SizeWidth = 210 / 25.4
ActiveDocument.Selection.PositionX = 20 / 25.4
ActiveDocument.Selection.PositionY = 55 / 25.4
NUMERAR:
' numero 1
ActiveDocument.ActivePage.ActiveLayer.CreateArtisticText 335 / 25.4, 48 / 25.4, "PÁGINA " & CStr(odd), , , "Arial", 12
' numero 2
ActiveDocument.ActivePage.ActiveLayer.CreateArtisticText 115 / 25.4, 48 / 25.4, "PÁGINA " & CStr(even), , , "Arial", 12
If i Mod 10 = 0 Then
ActiveDocument.Save
ActiveDocument.Close
End If
UserForm1.Label1.Caption = CStr(i * 200 / upfit) & "%"
DoEvents
Next i
' cierra documentos abiertos
If i Mod 10 <> 1 Then ' si el último loop no cerró el archivo por cambio 20-páginas
ActiveDocument.Save
ActiveDocument.Close
End If
End Sub
No hay comentarios:
Publicar un comentario