Set a new name for selected layers at once, optionally with appended counter (1, 2, 3...).
use scripting additions
tell application "Pixelmator Pro"
activate
tell its front document
set new_name to text returned of ¬
(display dialog "New layer name:" default answer "" buttons {"Cancel", "OK"} default button "OK")
set use_counter to the button returned of (display dialog "Append 1, 2, 3...?" buttons {"Cancel", "No", "Yes"})
set selected_layers to selected layers
set counter to 1 as integer
repeat with l in selected_layers
set name of l to new_name
if use_counter = "Yes" then set name of l to new_name & " " & (counter) as string
set counter to (counter + 1) as integer
end repeat
end tell
end tell