Programming in Numbers?

Hi everyone,

Do you guys know if we can write programs in Numbers?... much like Excel where you can program in VBA. I hear something about using automator... but is there a way to do it so the program is embedded in the spreadsheet and hidden from the user?

Thanks,

Alex

MacBook Pro, Mac OS X (10.4.10)

Posted on Sep 5, 2007 5:27 PM

Reply
11 replies

Nov 26, 2007 1:50 PM in response to KOENIG Yvan

Yvan, I think what your doing in applescript is great, but copying to the cipboard then run a script then paste back in only gives a very limited scope of applications.

What us programmers want is what we can do in XL using VBA. I can manipulate cells directly by "talking" directly to them, or to a range of cells. I can pull data from somewhere else and process it, placing the results inside the tables I want. I want to dynamically create sheets based upon data placed in a source table on sheet1. Creating the appropriate tables according to other data somewhere else, changing the formatting and all properties that you could do by hand, but automate it.

BTW, if you use gui scripting, couldn't the person copy the data, place the cursor in the location they want to paste, run your script, and your applescript would perform the paste for them? Just a thought. Applescipts "English" type language doesn't make a lot of sense to me coming from twenty years of programming basic/java/pascal style. It's syntax seems so backwards to me. I'm glad we have you to help write these things for us.

Thanks for all the help you give on here Yvan, I know you don't get thanked often enough.
Jason

Nov 28, 2007 9:08 AM in response to bassollini

I attempted to use the new automators "record" to see how well it handled starting numbers, or opening a file in numbers from the file menu, I was going to automate the Copy, run Yvan's applescript, then activate numbers againa nd paste back in.

It completely failed. Utterly useless.

Even using the dock to start a program failed horribly. The recorder apparently tried to remember not What I did but Where the mouse went. I saw my mouse cursor moving all over the screen, but nothing ever happened. It did show the proper commands in the list of things it "remembered". But other than that, running those steps did absolutely nothing but lock up my machine as it apparently got stuck trying to find stuff.

Anyone know where to submit bugs for things like automator, parts of the system? I looked on the apple menu for submit feedback, but didn't see it there.

Thanks,
Jason

Nov 24, 2007 7:30 AM in response to bassollini

Hello

Like I did, go to "Provide Numbers Feedback" in the "Numbers" menu and ask for a clone of the MACRO() function which gives us, in AppleWorks, the ability to execute an applescript from the inside of a sheet .
With the Package structure of every Numbers documents, with such a function we would be able to store the scripts in the "Contents:Resource" folder embedded in the sheet's package.

Yvan KOENIG (from FRANCE samedi 24 novembre 2007 16:30:15)

Nov 27, 2007 10:35 AM in response to jaxjason

Hello

Don't worry with the "thank you".

GUI scripting is not powerful enough to move the cursor in a defined cell.

As nothing is described about Numbers works, as far as I know, we may only move the cursor with its coordinates which are not a safe way in a table.

I'm able to code complementary instructions so that the script paste by itself but it's not safe.

For the Transpose script for instance, it works exactly as the AppleWorks transpose tool does.
We copy the cells into the clipboard
we call the tool
we paste where we want.

Yvan KOENIG (from FRANCE mardi 27 novembre 2007 19:34:45)

Nov 27, 2007 11:06 AM in response to jaxjason

jaxjason wrote:
Applescipts "English" type language doesn't make a lot of sense to me coming from twenty years of programming basic/java/pascal style.


Rumour has it that the natural language of Applescript was supposed to be a temporary thing. The underlying scripting language had an architecture so they easily could put any kind of language on top, and they released the natural language of Applescript as a demo just for fun. Unfortunately, they ran out of money, or they realised that it worked well enough, so no other language has been provided.

Nov 27, 2007 11:48 AM in response to SermoDaturCunctis

Other language front ends where/are available for generating AppleEvents. Apple's OSA (Open Scripting Architecture) allows for third-party scripting products such as QuicKeys and UserLand Frontier front ends (these, though, may have faded away with the introduction of MacOS X). There is (was?) also a JavaScript OSA component. Many other scripting languages like Ruby and Python, while not OSA components, provide means of generating and manipulating AppleEvents.

Nov 28, 2007 6:59 AM in response to SermoDaturCunctis

Hello

Right and Wrong

At the beginning of AppleScript the app was able to deal with "dialects".
The main one was English, I used the French one and there where others.
Alas working with non-english dialect was really cumbersome.

When a script was written on a french system using french dialect it was supposed to be OK to run on an English machine using english dialect.
It didn't.
Same thing in the reverse way.
So, soon, Apple dropped the dialects and delivered only the English one which from my point of view is not a problem.
But maybe it's easier for me (french user) than for englisf users which must take care to the "not truly current syntax" required by this "english like" tool.
For me, true English or "AppleScript English" are foreign languages 😉

I'm aware of other tools able do drive Apple Events but at this time, AppleEvents specific to Numbers are not documented so, I guess that it's not time to try to drive Numbers with them.

Yvan KOENIG (from FRANCE mercredi 28 novembre 2007 15:59:49)

Nov 28, 2007 8:33 AM in response to KOENIG Yvan

KOENIG Yvan wrote:
...
I'm aware of other tools able do drive Apple Events but at this time, AppleEvents specific to Numbers are not documented so, I guess that it's not time to try to drive Numbers with them.


That's right... none of this discussion matters since Numbers does not currently support or does not expose an AppleEvent interface and associated object model. My previous comments were just directed at an earlier poster's statement regarding a rumor about AppleScript and it being the only language.

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.

Programming in Numbers?

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