Template for AppleSkript - Keyboard Maestro works fine - but PMP saves the current values in the template

Discuss and share Pixelmator Pro resources such as templates, mockups, and tutorials.
User avatar

2022-04-05 20:58:39

Hi, great Product PMP. I am new to Apple Script, the script is not beauty.

My Goal is to produce Pictures from KeyboardMaestro to PMP, my fist script works fine. In the next step i bring the KM variables in the Script, not ready here.

I want use a template ZweiBilder.pxd and replace Text and Images then export the file to PNG and saves the Document without saving. It put this in the script, but PMP save the new Text and Images to the Template, i thought "close the front document without saving" would prevent that.

What can i do?

I can set the Values back in the after the export, but this would be not an elegant solution.

Thanks for helping.




tell application "Pixelmator Pro"
	
	activate
	open POSIX file "/Users/holgergelhausen/Desktop/ZweiBilder.pxd" as alias
	
end tell

tell application "Pixelmator Pro"
	
	replace image the first layer of the front document with "Macintosh HD:Users:holgergelhausen:Desktop:ia_100000014339.jpeg"
	
	tell the front document
		replace text "text1" with "Holger222"
	end tell
	
	
end tell

tell application "Pixelmator Pro"
	
	set imageBaseName to "Macintosh HD:Users:holgergelhausen:Desktop:huhuhu222333"
	
	export the front document to file (imageBaseName & ".png") as PNG with properties {compression factor:100}
	
	close the front document without saving
	
end tell