Ceating 8 labels on a page
The intent of the script is to create labels using a text file as source.
My script produces inconsistent results.
The first line of the label should be left aligned
The second line right aligned.
Here is a simplified script that should make 8 identical labels.
The result is that all labels are not identical.
The result is different at each script run.
Strange !
'Etiquettes
Dim pl, doc, pg, lyr
Dim ligne1, ligne2
Set pl = CreateObject("PhotoLine.Application")
pl.Visible = True
Set doc = pl.ActiveDocument
'Set pg = CreateObject("PhotoLine.Page")
Set pg = doc.ActivePage
Set lyr = doc.RootLayer.Last
ligne1 = "First line"
ligne2 = "Second LINE"
Dim range(1), range1(1), range2(1), fontDict, paragraphDict, textLayer, i, espace
'Formats du texte
Set fontDict = CreateObject("PhotoLine.Dictionary")
fontDict.Add "FamilyName", "Arial", "Size", 60
Set paragraphDict1 = CreateObject("PhotoLine.Dictionary")
paragraphDict1.Add "Alignment", 0, "After", 12
Set paragraphDict2 = CreateObject("PhotoLine.Dictionary")
paragraphDict2.Add "Alignment", 1, "After", 12
espace = 390 'Labels spacing
' Créer un groupe
Set grp = CreateObject("PhotoLine.Layer")
doc.RootLayer.Insert grp, -1
grp.Name = "Etiquettes"
Set lyr = doc.RootLayer.Last
For i = 1 to 8
' ligne1 = f.readline
' ligne2 = f.readline
range(0) = 0
range(1) = len(ligne1) + len(ligne2) + 2
range1(0) = 0
range1(1) = len(ligne1)
range2(0) = len(ligne1)
range2(1) = range(1)
Set textLayer = CreateObject("PhotoLine.Text")
textLayer.Origin = Array(120, i * espace)
textLayer.Size = Array(1300, 165)
textLayer.Text = ligne1 & VBCrLf & ligne2
textLayer.SetAttribute range, "Font", fontDict
textLayer.SetAttribute range1, "Paragraph", paragraphDict1 'Left align
textLayer.SetAttribute range2, "Paragraph", paragraphDict2 'Right align
textLayer.SetAttribute range, "Color", Array(0, 0, 0)
lyr.Insert textLayer, -1 'Insert text
Next
Du hast keine ausreichende Berechtigung, um die Dateianhänge dieses Beitrags anzusehen.