Reorder Pixelmator Layers with AppleScript

Hello, I’m new to scripting and currently using a combination of shortcuts and AppleScript for my automations. Currently I’m stuck on how to use AppleScript to select a couple layers in Pixelmator and move them to an existing group. Help would be greatly appreciated. Thanks!

Hi!
I downloaded the trial version of Pixelmator Pro 3.3.12. In its scripting dictionary there is an example of how to move layers around:

tell application "Pixelmator Pro Trial"
	tell the front document
		set newGroup to make new group layer at the front of layers
		move the last layer to the front of layers of newGroup
	end tell
end tell

Your use case is slightly different, but the following moves a layer called “Flower” into a group called “Moon Group”:

tell application "Pixelmator Pro Trial"
	activate
	tell front document
		move layer "Flower" to front of layers of group layer "Moon Group"
		end tell	
end tell

And if you have a layer selected you can refer to it as current layer and apply commands to it.

You don’t need to select the layers in the script. That’s how humans do it…

Thank you so much ya’ll! That worked!!