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
-
- Mitglied
- Posts: 184
- Joined: Thu 28 May 2015 18:00
- Location: Belgium
-
- Entwickler
- Posts: 4208
- Joined: Tue 19 Nov 2002 15:49
Re: Composition > Scripting
IPLDocument has two properties regarding layer 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: Select all
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.
-
- Mitglied
- Posts: 184
- Joined: Thu 28 May 2015 18:00
- Location: 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 ?
-
- Entwickler
- Posts: 4208
- Joined: Tue 19 Nov 2002 15:49
-
- Mitglied
- Posts: 184
- Joined: Thu 28 May 2015 18:00
- Location: 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
-
- Entwickler
- Posts: 4208
- Joined: Tue 19 Nov 2002 15:49
Re: Composition > Scripting
24.01 doesn't support scripting of layer compositions.
The script works fine here with B18.
Did you remember to activate scripting for B18?
https://www.pl32.com/forum3/viewtopic.p ... 835#p52835
-
- Mitglied
- Posts: 184
- Joined: Thu 28 May 2015 18:00
- Location: Belgium
Re: Composition > Scripting
Understood ...Martin Huber wrote: ↑Fri 13 Sep 2024 11:1024.01 doesn't support scripting of layer compositions.
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.
-
- Mitglied
- Posts: 184
- Joined: Thu 28 May 2015 18:00
- Location: Belgium
Re: Composition > Scripting
What is the syntax to retrieve the index (0, 1, 2 ...) of the active composition ?
Thanks
Thanks
-
- Entwickler
- Posts: 4208
- Joined: Tue 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.
Code: Select all
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
-
- Mitglied
- Posts: 184
- Joined: Thu 28 May 2015 18:00
- Location: Belgium
Re: Composition > Scripting
Thank you
This does the job
Regards
Phil
This does the job
Regards
Phil