• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: limits of GUI scripting in numbers?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: limits of GUI scripting in numbers?


  • Subject: Re: limits of GUI scripting in numbers?
  • From: KOENIG Yvan <email@hidden>
  • Date: Sun, 05 Feb 2012 09:29:13 +0100

Le 5 févr. 2012 à 06:57, Yuma Decaux a écrit :

>
> Hi List,
>
> I have successfully created a lengthy and complex script with many variables and layers of repeat loops and it all works seriously fine except for one annoying issue in iwork numbers.
>
> I've created interactions with various cells of columns to come up with an action that places the following formula in every ascending cell
>
> =100-100/(1+((((SUM(E17:E30)/14)*13)+G16)/14)/((((SUM(E17:E30)/14)*13)+G16)/14))
>
>
> The formula is a concatenation of several variables taking information of names of cells etc and incrementing cel values via other nested loops.
>
> It all works great.
>
> The formula also works fine, but it just doesn't appear as a result when the script is run.
>
> I have to option enter each cell, where the formula is in fact residing, then press enter for the result to appear.
>
> Is there anything like a refresh or other method to get these results to appear without having to manually look into the forumla and press enter? Or if that's the only solution, is there a way to point the selection to a cell and do the manual option enter then enter?
>
> I suppose the gui scripting would go like:
>
> Tell application "System Events"
> Tell process "Numbers:
> Tell table 1 of sheet 1 of front document
> Keycode 36 using (option down)
> Keycode 36
> End tell
> End tell
> End tell
> And create a repeat to loop throughout the range of cells i want, but that's like sticking an adhesive to a key on the keyboard to have my ultima online avatar to mine and gain xp while i'm off eating noodles.
>
> Any more elegant solution as the rest of the script has elegance in mind?
>
> Thanks for any advise
>
> Yuma

What are you hoping to get ?
There is no link between the application and the script so it does its duty only when we trigger it.
What need for GUI scripting to insert your formula is a cell ?

tell application "Numbers"
tell document dName
tell sheet sName
tell table tName
tell column colNum1
repeat with r from rowNum1 to rowNum2
set theFormula to build_the_formula_here
set value of cell r to theFormula
end repeat
end tell -- column
end tell -- table
end tell -- sheet
end tell -- document
end tell -- Numbers.

If the table is at front and if the formula may resist to the Fill Down treatment
you may use :

tell application "Numbers"
tell document dName
tell sheet sName
tell table tName
set theFormula to build_the_formula_here
set value of cell rowNum1 of column colNum1 to theFormula
set selection range to range (name of cell rowNum1 of column colNum1 &":"&name of cell rowNum2 of column colNum1)
my selectSubMenu("Numbers",5,10,2) -- Edit > Fill > Fill Down
end tell -- table
end tell -- sheet
end tell -- document
end tell -- Numbers.

--=====
(*
my selectSubMenu("Pages",6, 4, 26)
==== Uses GUIscripting ====
*)
on selectSubMenu(theApp, mt, mi, ms)
	activate application theApp
	tell application "System Events" to tell application process theApp to tell menu bar 1 to ¬
		tell menu bar item mt to tell menu 1 to tell menu item mi to tell menu 1 to click menu item ms
end selectSubMenu

--=====

Yvan KOENIG (VALLAURIS, France) dimanche 5 février 2012 09:29:07


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden


  • Follow-Ups:
    • Re: limits of GUI scripting in numbers?
      • From: Yuma Decaux <email@hidden>
References: 
 >limits of GUI scripting in numbers? (From: Yuma Decaux <email@hidden>)

  • Prev by Date: Re: limits of GUI scripting in numbers?
  • Next by Date: Re: limits of GUI scripting in numbers?
  • Previous by thread: Re: limits of GUI scripting in numbers?
  • Next by thread: Re: limits of GUI scripting in numbers?
  • Index(es):
    • Date
    • Thread