Created
February 26, 2023 13:48
-
-
Save kkhrv/98676034cd3ddbbb07e7e3a82d854e42 to your computer and use it in GitHub Desktop.
Simple script to copy Pixelmator document to clipboard as JPEG
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ObjC.import('AppKit'); | |
$.NSPasteboard.generalPasteboard.clearContents; | |
const app = Application('Pixelmator Pro') | |
const doc = app.document()[0] | |
const fm = $.NSFileManager.defaultManager | |
const exportFormat = 'JPEG' | |
const tempPath = '/var/tmp/export.jpg' | |
const nsUrl = $.NSURL.fileURLWithPath(tempPath); | |
app.export(doc, {to: tempPath, as: exportFormat}) | |
$.NSPasteboard.generalPasteboard.writeObjects([nsUrl.js]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment