What has Changed with Applescript?

I am not an expert on Applescript, in fact I wrote my one script with help from people on here about 2 years ago and haven’t written any since. I had problems with it at the end of last year when I found out that Numbers 3 did not support Applescript, but reverting back to Numbers09 solved the problem until today. Now when I run the script against my Numbers09 files I get the following message

error “Numbers09 got an error: Can’t set sheet "Account" of document 1 to "".” number -10006 from sheet “Account” of document 1

and the line

set value of cell rowcount of column colcount to “”

is highlighted.

This has worked fine up until now has something changed or am I missing something?

ElBeardo

global termind
set termind to 0

run ReconPart1
run ReconPart2

if termind is equal to 0 then
run ReconPart3
run ReconPart4
end if

script ReconPart1

-- Routine Clears Reconciliation Table and Sets Up Opening Balances

tell application "Numbers09"
	tell document 1
		tell table "AccountTable" of sheet "Account"
			set rowcount1 to 4 --Account Table Opening Balance Row
			set rowcount2 to 4 -- Reconciliation Table Opening Balance Row
			set colida to 1 --"A"
			set colide to 5 --"E"
			set colidf to 6 --"F"
			set colidg to 7 --"G"
			set colidj to 10 --"J"
			set colidn to 14 --"N"
			set colido to 15 --"O"
			set colidp to 16 --"P"		
			set firstrow1 to 5 -- First Transaction Row Account Table 
			set lastrow1 to 50 -- Last Transaction Row Account Table 
			set firstrow2 to 5 -- First Transaction Row Reconciliation Table 	
			set lastrow2 to 50 -- Last Transaction Row Reconciliation Table	
			
			-- Clear Reconciliation Table
			--Set all cells J5:O50 to Null
			--Column P contains Formula
			
			
			
			repeat with rowcount from firstrow2 to lastrow2
				repeat with colcount from colidj to colido
					set value of cell rowcount of column colcount to ""
				end repeat
			end repeat
						-- From Account Table Pick Up Opening Balances
			
			
			set Balance1 to value of cell rowcount1 of column colide
			set Balance2 to value of cell rowcount1 of column colidg
			
			-- Set Up Opening Balances in Reconciliation Table	
			
			
			set value of cell rowcount2 of column colidn to Balance1
			set value of cell rowcount2 of column colidp to Balance2
		end tell -- AccountTable of Account
	end tell -- Document 1
end tell -- Numbers09

end script

I’m accustomed to Numbers 09.

To get the described error message I was forced to edit an instruction in a very foolish way :

I replaced
tell table “AccountTable” of sheet “Account”
by
tell table "AccountTable"to tell sheet “Account”

But, I didn’t completely waste my time.
I had the idea to make a test :

I replaced
set value of cell rowcount of column colcount to “”
by
set value of cell rowcount of column colcount to missing value

It works flawlessly and this way the cells are really blank so that
=ISBLANK(“M10”)
returns true
which it doesn’t when the cell is cleaned with “”.

I wish also to add that your loop cleaning the cells may be replaced efficiently by :

set value of cells of range “J5:O50” to “”
or of course by
set value of cells of range “J5:O50” to missing value

Yvan KOENIG (VALLAURIS, France) mardi 25 mars 2014 20:55:09

It may be useful to add that Numbers 3.1 has a decent support of AppleScript, quite equivalent to what is available in Numbers 2.3, far better than what is available in Pages 5.1.

Thank you Yvan I will have a look at that, I did however find that part of the problem was me. I hadn’t noticed but when I opened Applescript it opened a second copy Numbers09. Making sure that there was only one version of Numbers09 open and that only one file open in that version my script ran the same as it always has.

I will have a look at your suggestions as I think I need to revisit this script as some things don’t work as well as they used to. I will also look at testing it with Numbers 3 as last time I tried it, not only did it not work, but it also corrupted the script.

Again thanks for the help

ElBeardo