AppleScript suddenly not working - insert jpg to numbers, export numbers to pdf

Hello,


my apple script was working 7 days ago, now it stopped working. The following code-lines are affected:


tell newDoc

export to pdfPath as PDF

end tell


now throws this error: Numbers got an error: The document “Tabelle.numbers” could not be exported as “List”. Your most recent changes might be lost.


Furthermore this line:

set thisImage to make new image with properties {file:imagePath, width:100}


throws this error: Numbers got an error: Unsupported item.


What is going on? Can anybody help? It is most appreciated.

MacBook Pro (M4)

Posted on Apr 14, 2025 2:33 AM

Reply

Similar questions

2 replies
Sort By: 

Apr 14, 2025 10:19 AM in response to Jujogaba

Completely impossible to answer your question directly since the scripts are incomplete and missing critical information.


For example:


		tell newDoc
			export to pdfPath as PDF
		end tell


Depends a lot on what newDoc is (presumably a reference to a newly created document, but there's nothing to confirm/deny that. It also depends on what 'pdfPath' is - Numbers requires POSIX-style paths, but we can't see what your pdfPath is.


I can tell you this code works, but can't tell you how it relates to your code:


tell application "Numbers"
	set newDoc to make new document
	tell newDoc
		export as PDF to (POSIX path of (path to desktop) & "my.pdf")
	end tell
end tell


Likewise:


set thisImage to make new image with properties {file:imagePath, width:100}


depends on a) what imagePath is, and b) where you're targeting this.


Images are elements of sheets, not documents, therefore this needs to target a sheet in the current document. Are you doing that?


Here's an example showing it working, based off my earlier script:


set myfile to choose file of type "public.image"

tell application "Numbers"
	set newDoc to make new document
	tell newDoc
		tell sheet 1 to set thisImage to make new image with properties {file:myfile, width:100}
		export as PDF to (POSIX path of (path to desktop) & "my.pdf")
	end tell
end tell


Note how the image targets a sheet, not the document.

Reply

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

AppleScript suddenly not working - insert jpg to numbers, export numbers to pdf

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.