Selection range not returning results when I select multiple cells on Numbers version 11.2

Hi there, I've beeb using an applescript workflow to pull data from cells. And it works perfectly on version 11.1. In version 11.2, my applescript workflow stopped working. And this is the error prompt.


The action “Run AppleScript” encountered an error: “Numbers got an error: Can’t make {} into type range.”


It seems like the new version 11.2 is returning empty with selection range.

Is it a bug in version 11.2?


Pls help.

Thanks!


Posted on Oct 6, 2021 3:06 AM

Reply
Question marked as Top-ranking reply

Posted on Oct 6, 2021 4:10 AM

Hi, it's a change, but I don't know if it's a bug or deliberate.


I think if you change the third line to:


set myRange to name of selection range


And then change the line that was giving the error to:


set selection range to range myRange


Then it should fix it.


Hope it helps!


H


9 replies
Question marked as Top-ranking reply

Oct 6, 2021 4:10 AM in response to xiu_hong_toh

Hi, it's a change, but I don't know if it's a bug or deliberate.


I think if you change the third line to:


set myRange to name of selection range


And then change the line that was giving the error to:


set selection range to range myRange


Then it should fix it.


Hope it helps!


H


Oct 6, 2021 5:41 AM in response to xiu_hong_toh

I think it's a bug, and a particularly bad one. All scripts that access selection range are now broken, which in my case means that over 90% of useful scripts are now useless.


It would help if you could post a bug report by going in your menu to Numbers > Provide Numbers Feedback.


Bug Report is one of the options in the dropdown.



SG

Oct 6, 2021 3:26 AM in response to xiu_hong_toh

How are you defining myRange? It's not easy to debug without seeing the precise details of what you want to achieve and how you're trying to achieve it.



In the meantime you could try


select myRange


But as I say, without knowing how you're defining myRange it's hard to say.


Maybe a screen shot of your workflow?



FWIW I think something has changed in the way AppleScript handles selections in Numbers 11.2 (and other iWork apps). Not sure it's a bug.)

Oct 6, 2021 3:42 AM in response to HD

Here's the workflow


-- table
			set the myTable to (the first table whose class of selection range is range)
			tell myTable
				
				set myRange to the selection range
				set myNum to the count of cells of myRange
				set myFolder to choose folder with prompt "Boss, where your screen matrix folder huh?"
				set myFolderPath to quoted form of the POSIX path of myFolder
				set myTargetPath to myTargetFolder as alias
				set myTargetPath to quoted form of the POSIX path of myTargetPath
				
				-- repeat with all cells
				repeat with i from 1 to myNum
					
					-- if it's the even cell
					if i mod 2 is 0 then
						
						-- if it's not empty cell
						set myValue to the value of cell i of myRange
						if (myValue is not equal to missing value) then
							
							set myFlag to false
							
							-- copy & paste files to ali
							my CopyPasteFiles()
							
							-- if no new files are copied
							if myFlag is false then
								
								-- did the file existed before
								set checkFile to my SetupFile((myTargetFolder as string) & myValue)
								if (my FileExists(checkFile) is equal to true) then
									
									set the font size of cell (i - 1) of myRange to 17
									set the text color of cell (i - 1) of myRange to {65535, 65535, 65535}
									set the value of cell (i - 1) of myRange to "USE XXX"
									set the background color of cell (i - 1) of myRange to {65535, 0, 0}
									
								else
									
									-- it didn't so mark red
									set myMissing to myMissing + 1
									tell application "Numbers"
										set the background color of cell i of myRange to {65535, 0, 0}
									end tell
									
								end if
								-- did the file existed before
								
							else
								
								-- select cell
								set the font size of cell (i - 1) of myRange to 16
								
							end if
							-- if new files are copied
							
						end if
						-- if it's not empty cell
						
					end if
					-- if it's the even cell
					
				end repeat
				-- repeat with all cells
				
				-- select back the initial cells
				set selection range to myRange
				
			end tell
			-- table


Thanks.

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.

Selection range not returning results when I select multiple cells on Numbers version 11.2

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