Woggledog

Q: Get Row Count with AppleScript in Numbers 2013

Some context: Upgraded from 10.8 and Numbers 09 to 10.9 and Numbers 2013

 

My script has broken. It was this:

 

on rowCountOfTable(sheetName, tableName)
local sheetName, tableName, res
try
      tell
application "Numbers"
          tell document 1
               tell sheet sheetName
                    tell table tableName
                          set res to row count
                    end tell    

                end tell
             end tell
           end tell
      return
res
on error eMsg number eNum
     error "Can't rowCountOfTable: " & eMsg number eNum
end try
end
rowCountOfTable
    

 

It's now been recompiled and is this:

 

tell «class NmSh» sheetName

     tell «class NmTb» tableName

          set res to row count

     end tell

end tell

 

AppleScript now doesn't understand row so have changed this to «class NmRw» (Guessed that bit).

 

Doesn't matter what I do, I can't get the Row Count of a numbers table any more....

 

Any ideas?

MacBook Pro with Retina display, OS X Mountain Lion (10.8.3)

Posted on Dec 6, 2013 4:26 AM

Close

Q: Get Row Count with AppleScript in Numbers 2013

  • All replies
  • Helpful answers

  • by Badunit,Helpful

    Badunit Badunit Dec 6, 2013 5:34 AM in response to Woggledog
    Level 6 (11,705 points)
    iTunes
    Dec 6, 2013 5:34 AM in response to Woggledog

    No Applescript support in Numbers 3. Your script won't work no matter what you do. Supposedly they are going to include some scripting capabilities in an update.

     

    Your script, when compiled, is referring to Numbers '09, not Numbers 3. I changed my old Numbers app so it is named "Numbers 09" and if I compiled your script, it would turn "Tell application "Numbers"" into "Tell application "Number 09""

     

    You might want to update your profile with your new OS version and Numbers version.  With Numbers '08, '09 and 3 all mixed into one forum, sometimes it is hard to tell which version someone is talking about unless they state it outright (as you did).

  • by SGIII,Helpful

    SGIII SGIII Dec 6, 2013 8:06 AM in response to Woggledog
    Level 6 (10,720 points)
    Mac OS X
    Dec 6, 2013 8:06 AM in response to Woggledog

    In Numbers 3 AppleScript support is limited to GUI scripting" for now, but fuller support is supposed to be restored within the next few months.  If you have any input on what form that support should take, you might try your luck with Numbers > Provide Numbers Feedback in your menu.

     

    Meanwhile, if you need the number of rows in a table for use within Numbers (as opposed to another app) you can of course use formulas.

     

    SG

  • by Woggledog,

    Woggledog Woggledog Dec 15, 2013 12:30 PM in response to SGIII
    Level 4 (1,870 points)
    Dec 15, 2013 12:30 PM in response to SGIII

    Thanks to both for the answers. Bit disappointing.... But, as well know, Apple don't have greate support for AppleScript in their apps to begin with!

  • by El-Beardo,

    El-Beardo El-Beardo Dec 24, 2013 7:23 AM in response to Woggledog
    Level 1 (0 points)
    Dec 24, 2013 7:23 AM in response to Woggledog

    What has happened in the last few days I hit this problem several weeks back and found that I could use my apple script so long as I used Numbers 09. This has worked perfectly up until today but today when I try to use my apple script routine with a Numbers 09 application I find all my rows, columns have been changed to class Nm??. Even if I just open my apple script in script editor I get the same problem. Has one of the latest upgrades to Maverick changed something?

     

    I am getting really fed up with Apple software lately nothing seems to work properly

     

    Elbeardo

  • by Woggledog,

    Woggledog Woggledog Jan 24, 2014 1:38 AM in response to Woggledog
    Level 4 (1,870 points)
    Jan 24, 2014 1:38 AM in response to Woggledog

    Well, Numbers was updated overnight, and it looks like AppleScript is back:

     

    MacWorld Article on Numbers and Applescript