Tutorial / Guide Applescript for Numbers 9

Excuse me if this is the wrong place to post this but I am new here. Although I have over 40 years experience with computers and over 20 years with PC's I have recently purchase a MacBook Pro so I have no experience of the Mac or its software.
On my PC I used Excel for all my spreadsheets some of which had macros to automate certain functions. I purchased iWork with the MacBook and gather that the equivalent of macros is applescript. I want to try and recreate some of these macros in applescript and have spent the last few days trying to discover how I use Applescript and Numbers and don't seem to be getting anywhere. Can somebody please point me at a guide, a book or tutorial which covers Applescript and Numbers?

I think what I am after is fairly basic but some of the areas I need to start with are

1. How do you link Applescript with the Spreadsheet.

2. General moving / copying ranges of cells to other cells provided certain conditions are met.

3. Clearing cells or filling with other values.

Any help will be gratefully received

ElBeardo

Posted on Feb 7, 2011 5:29 AM

Reply
3 replies

Feb 7, 2011 9:47 AM in response to El-Beardo

El-Beardo wrote:
Excuse me if this is the wrong place to post this but I am new here. Although I have over 40 years experience with computers and over 20 years with PC's I have recently purchase a MacBook Pro so I have no experience of the Mac or its software.
On my PC I used Excel for all my spreadsheets some of which had macros to automate certain functions. I purchased iWork with the MacBook and gather that the equivalent of macros is applescript. I want to try and recreate some of these macros in applescript and have spent the last few days trying to discover how I use Applescript and Numbers and don't seem to be getting anywhere. Can somebody please point me at a guide, a book or tutorial which covers Applescript and Numbers?

I think what I am after is fairly basic but some of the areas I need to start with are


Questions already asked and responded.

1. How do you link Applescript with the Spreadsheet.


There is no link between AppleScript and Numbers documents.
The user must trigger the script when he need it.

2. General moving / copying ranges of cells to other cells provided certain conditions are met.


Answers to questions 2 & 3 are at work in some of my free scripts.

Go to my iDisk

<http://public.me.com/koenigyvan>

and scan the contents of the folder :

For_iWork:iWork '09:for_Numbers09:

3. Clearing cells or filling with other values.

Any help will be gratefully received


Yvan KOENIG (VALLAURIS, France) lundi 7 février 2011 18:46:40

Feb 8, 2011 11:58 PM in response to El-Beardo

I apologise for taking so long to reply but I have spent the last few days trying to understand Applescript and getting nowhere. What I eventually found was that I was overcomplicating matters, it must be the senility setting in!!
I was tied up on on how I told Applescript which particular spreadsheet I wanted it to work on and was making the assumption that the Tell Application statement would open Numbers. After spending several days banging my head against the brick wall and only getting a headache, this morning I opened my spreadsheet creating some simple Applescript statements it worked, I think I now understand how to proceed

Thanks for the help

ElBeardo

Feb 9, 2011 5:02 AM in response to El-Beardo

Hello

--

tell application "Numbers"
activate
-- the useful code
end tell
--


If Numbers is already running, activate will bring the app to front.
If Numbers isn't running, activate will run it.

In most of my scripts I don't use activate because they rely upon the availability os a selection made in a table which means that Numbers is already running.

If you want to open a specific document in Numbers you may use different syntaxes.
(1)
set my_document to the path_to_a_Numbersdocument as alias
tell application "Finder" to open un_document
tell application "Numbers"
--
end tell

(2)
set my_document to the path_to_a_Numbersdocument as alias
tell application "Numbers"
open un_document
--
end tell

As you see, when I ask Numbers to open a document, I don't coerce the path to an alias even if the dictionary claims that open requires an alias.

It's a common feature with Apple products and as I am lazy, I don't waste time to type 'as alias' … even if I spend much more time to explain that I don't type 'as alias' because I am lazy …

Yvan KOENIG (VALLAURIS, France) mercredi 9 février 2011 14:02:51

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.

Tutorial / Guide Applescript for Numbers 9

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