You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Trigger applescript from within numbers?!?

I've got some spreadsheet applications that I'd really like to move from excel to Numbers. I'm excited that numbers is scriptable, but without a way to trigger the script from inside the Numbers file, it is clumsy and of limited use.

Any thoughts on how to hack this? Unfortunately unlike every other Cocoa Application iWork apps doesn't support file URL links (arg!)

macbook, Mac OS X (10.5.6)

Posted on Jan 22, 2009 1:08 PM

Reply
9 replies

Jan 23, 2009 8:30 AM in response to jaxjason

Hi jason

I didn't understood the question like you.

Of course we may trigger a script from the Script menu.
My guess is that the OP wish a way to trigger them automatically as we are able to do in AppleWorks.

_Go to "Provide Numbers Feedback" in the "Numbers" menu_,
post:
In this old beast named AppleWorks, a formula like this one:

=MACRO(":ƒµƒ:µ CoulCell5.app",2,"boulot",""&COLUMN(C2)&" "&ROW(C2)&" "&C2,A$1..C$6)

triggers the script
<startupVolume>:Applications:AppleWorks 6:AppleWorks Essentials:Scripts:ƒµƒ:µ CoulCell5.app"
when something is modified in the range A$1..C$6.

It's a very powerful tool.
May you insert it in Numbers ?


Then, cross your fingers, and wait _at least_ for iWork'10 😉

Yvan KOENIG (from FRANCE vendredi 23 janvier 2009 17:30:11)

Jan 22, 2009 4:18 PM in response to tamac

You can trigger them from within numbers. You place them in a numbers folder for you script menu to read from. After having to maintain hundreds of xl macros at my current job, menus are the best way to handle it. So also gave you a way to add custom buttons that could trigger macros. Nut with many macros that is just too cumbersome.

Just my 2 cents
Jason

Jan 23, 2009 10:30 AM in response to tamac

Short answer: not yet. If you wish this functionality, please submit a feedback ticket with Apple from the Feedback option unde the Numbers menu.

Just my 2 cents: in our offices (albeit we are on windoze machines), we avoid that kind of thing like the plague. There is very good reason for that, but it would take a few extra paragraphs to explain, and its really more of a XL and VBA discussion. (just the fyi, my group maintains and supports over 450 macros currently in an office of 500+ persons. In 2008, we had almost 80,000 runs of our macros saving, literally years of man hours.)

I am not sure how I would best implement the same thing in Applescript. But I have a feeling it would be similar. I have just been avoiding them completely elsewhere as well, from experience.

Jason

Jan 23, 2009 12:56 PM in response to tamac

At this time I really don't imagine how we would pass the status of checkboxes to a script without running a script by hand.

The only available protocol is:
• if the cells are always the same, code their designation in the script
• if they may be at different locations,
select the cells containing the boxes

When this is done,
run the script to grab the status of the selected cells.
given the status the script will do this, that 1 or that 2

Matter of safety it would be useful to embed the document's name in the script so that it doesn't apply on an other document.

Yvan KOENIG (from FRANCE vendredi 23 janvier 2009 21:56:54)

Jan 23, 2009 4:28 PM in response to jaxjason

Not sure why you avoid macros in excel. But here is my experience. We are a small engineering firm. We've developed a dozen applications in excel that are a mix of VBA and spreadsheet. I've been developing such applications in Numbers lately because Numbers independent tables and layout capabilities make for a way better interface. But of course without scripting, it is very limited: no loops, branching, conditional interface elements, or complex logic.

Now I've got Apps in both XL and Numbers, depending on whether it needs Scripting. I live in the nether-wold between easy good looking interface/layout or scripting... ARG!

What I want: Embeddable, recordable, triggerable applescipt in Numbers

Jan 23, 2009 6:33 PM in response to tamac

I never said I avoid macros. I love them! I avoid tying them to one file and using a graphic or "form" control to run them. My job is to write Macros! My office of just over 500 had close to 80,000 runs of my 450+ macros in 2008 alone.

The way we do it (in windows) is to list the macros into manageable groups, and place these macros into XLA add-in files. The "This workbook" object has "on open" macros that build a custom menu for that particular Add-in. In this add-in we store all the core template files that anyone might need to fill in with data. We have an "Add Sheet" macro (not included in our 450+ count) to create a template file of the correct name and all the sheets necessary for the appropriate macro.

Then they run the "process" macro and it takes all the raw data plugged into the template files and processes it.

By placing them in Add-in groups, they have the ability to load any set of macros that they might use that day. Its very orderly and efficient. We might have one for Legal Operations, Trading and another one for Account maintenance. Each with its own menu at the top of the screen. Easy.

If we went with objects on the screen, we would need a custom excel file with graphic or form control for each macro process. We would have over 400 different excel workbooks to maintain!!!! This way we have 22 Add-ins to maintain. Much easier to handle. Much easier for users to use as well.


I *+definitely agree+* with your statement that the table and layout views in Numbers would be much easier to work with. We have to use all kinds of little tricks to find the "real" end of data in excel. Since excel seems to remember the last row and column that was EVER used on that sheet!!! I have had it tell my programs that the last row was ~ 60,000 when there are only 100 rows of data, all because somebody skipped down and typed something in down there then deleted it.

I was So happy when I heard they added scripting to Numbers. I already have a few written and am playing with more this weekend. (plan on writing one that will eliminate duplicates in a table, at least I;m going to try it, I could do it in about five minutes in VBA, but it will take some getting used to in Numbers and applescript).


anyways, been a pleasure to discuss with you! Most people can't even understand what I do for a living. 🙂

Jason

Jan 24, 2009 12:00 AM in response to jaxjason

Since excel seems to remember the last row and column that was EVER used on that sheet!!! <</div>

In case you don't know (might be something I know that you don't!), you can fix that - at least until someone enters crap again.

You delete all the rows or columns past the true end of the data AND THEN SAVE THE FILE. If you check for the last row and column again, it should be correct. It won't correct itself until you do the save.

At least that's how it works on my Excel 2000.

Jan 24, 2009 6:42 AM in response to dbk9999

Yeah i know that trick, but we cannot force save the file. Many of these templates are never saved to folder anywhere. We are allowed to save the empty template file to change the names of the file. But once personal data of clients is entered we cannot do the save ourselves again. They must do a save as... and rename the file, placing it in a secure location. And we cannot rely upon them to do the save before the macro runs. (No matter how much we try to train them).

So we have had to find other tricks. Like if we have a column that we know will always be filled in, like account numbers for trade correction. Then we can do a

application.worksheetfunction.counta(activesheet.range("A:A"))


That will give us the actual number of entered items in that column.

I really do prefer the simple "Count of rows" in Numbers.

Thanks for the hint though,
Jason

Trigger applescript from within numbers?!?

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