Is it possible to use VBscript to browse around existing compositions ?
Or to create a new composition ?
I don't see the composition object in the scripting manual.
Best regards.
Composition > Scripting
-
PhilM
- Mitglied
- Beiträge: 191
- Registriert: Do 28 Mai 2015 18:00
- Wohnort: Belgium
-
Martin Huber
- Entwickler

- Beiträge: 4300
- Registriert: Di 19 Nov 2002 15:49
Re: Composition > Scripting
IPLDocument has two properties regarding layer compositions:PhilM hat geschrieben: Fr 06 Sep 2024 20:35 Is it possible to use VBscript to browse around existing compositions ?
- ActiveLayerComposition: Returns the name of the active layer composition (or an empty string if there is none)
- LayerCompositions: Returns an array of IPLDictionary objects. Each dictionary has two entries:
- "name": The name of the composition.
- "description":The description of the composition
Code: Alles auswählen
Dim pl
Dim doc
Set pl = CreateObject("PhotoLine.Application")
Set doc = pl.ActiveDocument
If Not doc Is Nothing Then
Dim layerComps
pl.Visible = True
layerComps = doc.LayerCompositions
'WScript.Echo "Number of compositions: " & UBound(layerComps)
If (UBound(layerComps) > 1) Then
doc.ActiveLayerComposition = layerComps(1)("name")
End If
End If
There's no way to create a layer composition by script.
The documentation will be added when scripting of layer compositions is added to the official version.PhilM hat geschrieben: Fr 06 Sep 2024 20:35 I don't see the composition object in the scripting manual.
-
PhilM
- Mitglied
- Beiträge: 191
- Registriert: Do 28 Mai 2015 18:00
- Wohnort: Belgium
Re: Composition > Scripting
Thanks !
Is scripting of layer compositions available in the last Beta B18 ?
Is scripting of layer compositions available in the last Beta B18 ?
-
Martin Huber
- Entwickler

- Beiträge: 4300
- Registriert: Di 19 Nov 2002 15:49
Re: Composition > Scripting
Yes.PhilM hat geschrieben: Di 10 Sep 2024 15:07 Is scripting of layer compositions available in the last Beta B18 ?
-
PhilM
- Mitglied
- Beiträge: 191
- Registriert: Do 28 Mai 2015 18:00
- Wohnort: Belgium
Re: Composition > Scripting
Both V24.01 and Beta 18 give me an error on line 11 of the script that the object does not handle the "LayerCompositions" property or method.
Phil
Phil
-
Martin Huber
- Entwickler

- Beiträge: 4300
- Registriert: Di 19 Nov 2002 15:49
Re: Composition > Scripting
24.01 doesn't support scripting of layer compositions.PhilM hat geschrieben: Do 12 Sep 2024 18:16 Both V24.01 and Beta 18 give me an error on line 11 of the script that the object does not handle the "LayerCompositions" property or method.
The script works fine here with B18.
Did you remember to activate scripting for B18?
https://www.pl32.com/forum3/viewtopic.p ... 835#p52835
-
PhilM
- Mitglied
- Beiträge: 191
- Registriert: Do 28 Mai 2015 18:00
- Wohnort: Belgium
Re: Composition > Scripting
Understood ...Martin Huber hat geschrieben: Fr 13 Sep 2024 11:1024.01 doesn't support scripting of layer compositions.PhilM hat geschrieben: Do 12 Sep 2024 18:16 Both V24.01 and Beta 18 give me an error on line 11 of the script that the object does not handle the "LayerCompositions" property or method.
The script works fine here with B18.
Did you remember to activate scripting for B18?
https://www.pl32.com/forum3/viewtopic.p ... 835#p52835
Yes it does work.
Thanks a lot.
-
PhilM
- Mitglied
- Beiträge: 191
- Registriert: Do 28 Mai 2015 18:00
- Wohnort: Belgium
Re: Composition > Scripting
What is the syntax to retrieve the index (0, 1, 2 ...) of the active composition ?
Thanks
Thanks
-
Martin Huber
- Entwickler

- Beiträge: 4300
- Registriert: Di 19 Nov 2002 15:49
Re: Composition > Scripting
There is none. Depending on what you want to to, you can either check the name of the composition or you'll have to find it "manually". The following script activates the next layer composition.PhilM hat geschrieben: So 15 Sep 2024 09:24 What is the syntax to retrieve the index (0, 1, 2 ...) of the active composition ?
Code: Alles auswählen
Dim pl
Dim doc
Set pl = CreateObject("PhotoLine.Application")
Set doc = pl.ActiveDocument
If Not doc Is Nothing Then
Dim comps
comps = doc.LayerCompositions
' Is there more than 1 layer composition?
If (UBound(comps) > 1) Then
Dim activeCompName
' Determine index of active layer composition
activeCompName = doc.ActiveLayerComposition
For i = 0 To UBound(comps)
cmp = StrComp(comps(i)("name"), activeCompName)
If (cmp = 0) Then
Exit For
End If
Next
' Switch to next layer composition
i = i + 1
' If there was no layer composition or the last one is the
' active one, activate the first.
If (i > UBound(comps)) Then
i = 0
End If
doc.ActiveLayerComposition = comps(i)("name")
End If
End If
-
PhilM
- Mitglied
- Beiträge: 191
- Registriert: Do 28 Mai 2015 18:00
- Wohnort: Belgium
Re: Composition > Scripting
Thank you
This does the job
Regards
Phil
This does the job
Regards
Phil