I need a script that takes 1 selected layer, and selects all layers with same property (e.g. same fill color). However I am unable to simply select any layers from "array" (or "list"). I'm probably missing some syntax.
Here is my attempt:
tell application "Pixelmator Pro"
activate
tell its front document
if not (count selected layers) = 1 then
display alert "Make sure a single text layer is selected."
return
end if
-- set scope to ¬
-- (choose from list {"fill", "stroke"} with prompt "Select all layers with the same:" default items {"fill"}) as text
set all_layers to every layer whose visible is true
set selected_layer to current layer
repeat with l in all_layers
-- if (scope = "fill" and fill color of selected_layer = fill color of l) then
set selected of l to true
-- end if
end repeat
end tell
end tell
Another reason could be that "select" command does not accept lists. E.g. this works:select (every layer)
but this does not:set all_layers to every layer
select (all_layers)
Is there no hope?