pixel8tor hat geschrieben: Di 09 Jun 2026 22:12Do PS1 scripts run unedited on a Mac with Powershell installed?
No, for two reasons:
- PowerShell on macOS doesn't support scripting applications.
- Even if it would, scripting works differently on macOS than it does on Windows.
pixel8tor hat geschrieben: Di 09 Jun 2026 22:12Also you didn't mention Curve Type. Will that also be fixed so it's part of the dictionary?
$curveMain from my sample script is an IPLCurve, so $curveMain.Type returns the curve type.
pixel8tor hat geschrieben: Di 09 Jun 2026 22:12And I noticed in "Stings.str" that "Bezier 2" and "Spile 2" aren't listed. Do they have separate Type numbers?
Scripting has nothing to do with Strings.str.
pixel8tor hat geschrieben: Di 09 Jun 2026 22:12The documentation, "VBScripting.pdf", doesn't list them anywhere. I need the Type data because if the user changes it to something other than spline the script won't operate as expected. So I hope that it is added to the dictionary. Thanks for looking into this.
Two things:
- Spline 2 and Bezier 2 are slope-limited versions of Spline and Bezier. Both are only available in the beta versions of PhotoLine, not in the release versions.
- IPLCurve's Type returns the type CurveType, that's documented in VBScripting.pdf. But you are right that some modes are missing. I will change that. It will return one of these values: CTBezier = 0, CTSpline = 1, CTLagrange = 2, CTLine = 3, CTByte256 = 4, CTBezierLim = 5, CTSplineLim = 6
pixel8tor hat geschrieben: Di 09 Jun 2026 22:12You show an example of how to set curve points, but no example of setting the curve type. Is that currently possible? If so, how? After all the description of an IPLCurve is an array of point pairs AND the CurveType!
Setting the curve type is quite straightforward: "$curveMain.Type = 1" will set the curve type to Spline.
pixel8tor hat geschrieben: Di 09 Jun 2026 22:12I'm not sure how to append a Single to an Array.
Well, that's more a PowerShell question than a PhotoLine question. In PowerShell regular arrays are not resizable. You'll have to split an array and recombine the parts with the points you want to insert.
I asked an AI for that and it wrote a little helper function.
A modified script that
- adds a new point to the main curve
- sets main curve's type to Spline
looks like that:
Code: Alles auswählen
# Functions have to be defined before the code using them
# Insert-ArrayValues will insert $NewValues in $Array at position $index and return the result
function Insert-ArrayValues {
param(
[object[]] $Array,
[int] $Index,
[object[]] $NewValues
)
$left = if ($Index -gt 0) { $Array[0..($Index - 1)] } else { @() }
$right = if ($Index -lt $Array.Length) { $Array[$Index..($Array.Length - 1)] } else { @() }
return $left + $NewValues + $right
}
############## Main Code ##############
# Variables have to be set before being used.
Set-StrictMode -Version 2
$pl = New-Object -ComObject PhotoLine.Application -Strict
# $pl.Visible = $True
$version = $pl.Version
$doc = $pl.ActiveDocument
# Is there a document?
if ($null -ne $doc)
{
$activeLayer = $doc.ActiveLayer
# Is there an active layer and has the active layer at least one adjustment.
if (($null -ne $activeLayer) -and ($activeLayer.AdjustmentsCount -gt 0))
{
# Fetch the data of the first adjustment.
$adjustmentPara = $activeLayer.Adjustment(0)
# Modify the main curve
# - fetch it
$curveMain = $adjustmentPara["CurveMain"]
if ($null -ne $curveMain)
{
# - Fetch the existing points of the curve. It is a float array.
$points = $curveMain.Points
$pointsCount = $points.Count
# - Are there enough points to edit?
if ($pointsCount -ge 4)
{
# A new point will be inserted between the first and the second point.
# The new point is the average of the first and the second point.
# PowerShell is a bit tricky here. The parantheses around the single
# array elements are important.
$newPoint = @((($points[0] + $points[2]) / 2), (($points[1] + $points[3]) / 2))
$points = Insert-ArrayValues -Array $points -Index 2 -NewValues $newPoint
}
# - Set the curve type to Spline
$curveMain.Type = 1
# - Set the modified points
$curveMain.Points = $points
# - Set the modified points as new curve points in the adjustment.
$adjustmentPara["CurveMain"] = $curveMain
$activeLayer.Adjustment(0) = $adjustmentPara;
}
}
}
Note: This script will only work with the upcoming PhotoLine 25.60B3.
pixel8tor hat geschrieben: Di 09 Jun 2026 22:12Will these changes be in the next beta, or will it take longer to make them?
It will be in the next beta, but I don't know when it will be included in the official release.
pixel8tor hat geschrieben: Di 09 Jun 2026 22:12P.S. This reminds me, since getting the curves data won't work with versions of Photoline earlier than the version you insert those interfaces in, could you add a "Version" property to the "IApplication" object, that would return the version of the currently running PL. That would make it easier for the script to fail gracefully if the running version doesn't support retrieving the curves data. Does that make sense?
There will be a Version property (see the script above) that returns a version string (for example "25.51").
pixel8tor hat geschrieben: Do 11 Jun 2026 19:20Adjustments are a subset of the available operations, that can be applied to images. The parameters of the adjustments are stored in IPLDictionaries. All adjustment dictionaries contain the key “Type” whose value is the name of the operation as string. The other keys and values are the parameters of the operation.
I don't see a "Type" key in any of the available adjustments dictionaries. Am I misunderstanding or have they been accidentally omitted? If they should be there, can you fix that?
The "Type" property works fine here. "$adjustmentPara["Type"]" shows "Curves".
Please note: Even after running a script in PowerShell ISE, you can access your variables and type commands in the console. Typing "$adjustmentPara["Type"]" in the console should show "Curves".