Batch export images and overwriting / preserving the names

Talk about Pixelmator Pro, share tips & tricks, tutorials, and other resources.
User avatar

2022-10-05 12:15:34

So far I'm using this AppleScript:

tell application "Pixelmator Pro"
	set exportLocation to choose folder with prompt "Please select where you'd like export the images:"
	repeat (number of documents) times
		export the front document to file ((exportLocation as text) & (name of the front document) & ".jpg") as JPEG with properties {compression factor:85}
		close the front document without saving
	end repeat
end tell
But instead of overwriting the old images like 1.jpg 2.jpg it does: 1.pxd.jpg 2.pxd.jpg

So how to just overwrite the old images instead of creating new ones with new names?

I also need the "projects" to be closed because when I open Pixelmator again I see all of them still opened and need to close them all manually

Thanks in advance