Applescript Dialog Result As Variable For Repeat Loop in Numbers

I have a dialog prompt asking how many times to click a certain element in the Numbers formatting panel, but it keeps telling me the result is not an integer. I’ve tried explicitly setting it as such but keep getting the same error. Would be nice to also ensure the entry is a number and not a text string, and if the latter to not proceed or tell the user to try again.


tell application "System Events"
	tell application process "Numbers"
		set clickNumber to display dialog "How many clicks?" default answer "" as integer
		tell window 1
			repeat clickNumber times
				click UI element 1 of incrementor 2 of scroll area 3
			end repeat
		end tell
	end tellend tell


Posted on Jul 3, 2023 4:45 PM

Reply
Question marked as Top-ranking reply

Posted on Jul 3, 2023 4:50 PM

Replace the third line with:


set clickNumber to text returned of (display dialog "How many clicks?" default answer "") as integer


(241371)

3 replies

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 Dialog Result As Variable For Repeat Loop in Numbers

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