• 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: Very slow Applescript operation in iWork Numbers 09
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Very slow Applescript operation in iWork Numbers 09


  • Subject: Re: Very slow Applescript operation in iWork Numbers 09
  • From: Mads Fog Albrechtslund <email@hidden>
  • Date: Thu, 26 Nov 2009 10:52:44 +0100

Hey Yvan

I do not completely understand your solutions,
but it got my thinking and here is my own working solution:

tell application "Numbers"
tell document 1 to tell sheet 1 to tell table 1
set value of cell "A1" to 7654
set selection range to range "A1"
tell application "System Events"
tell process "Numbers"
set frontmost to true
keystroke "c" using {command down}
end tell
end tell
set theCellCount to count of every cell of column 1
set theRange to "A1:A" & theCellCount
set selection range to range theRange
tell application "System Events"
tell process "Numbers"
set frontmost to true
keystroke "v" using {command down}
end tell
end tell
end tell
end tell

Mads Fog Albrechtslund
Technical consultant
Artwork-Systems Nordic A/S
Denmark

On 26/11/2009, at 07.09, Yvan KOENIG wrote:


Le 25 nov. 2009 à 21:52, Mads Fog Albrechtslund a écrit :

Hey Yvan

Thanks for your input, and script.

But I am not sure what you mean with the a, d, k and t in the part below?

I am thinking that a is a reference to the application, in this case Numbers??
But what are the others references to?

Would you explain a little more?

Mads Fog Albrechtslund
Technical consultant
Artwork-Systems Nordic A/S
Denmark

On 25/11/2009, at 21.22, Yvan KOENIG wrote:

on shortcut(a, t, d)
local k
tell application a to activate
tell application "System Events" to tell application process a
try
t * 1
if d is "c" then
key code t using {command down}
else if d is in {"ac", "ca"} then
key code t using {command down, option down}
else if d is in {"sc", "cs"} then
key code t using {command down, shift down}
else if d is in {"kc", "ck"} then
key code t using {command down, control down}
else if (d contains "c") and (d contains "s") and d contains "k" then
key code t using {command down, shift down, control down}
end if
on error
repeat with k in t
if d is "c" then
keystroke (k as text) using {command down}
else if d is in {"ac", "ca"} then
keystroke (k as text) using {command down, option down}
else if d is in {"sc", "cs"} then
keystroke (k as text) using {command down, shift down}
else if d is in {"kc", "ck"} then
keystroke (k as text) using {command down, control down}
else if (d contains "c") and (d contains "s") and d contains "k" then
keystroke (k as text) using {command down, shift down, control down}
end if
end repeat
end try
end tell
end shortcut



Hello

right , a is the name of the triggered application

t is the command to execute.
It may be a string ("v" to call cmd V via keystroke)
or a number (125 to call cmd alt down arrow vias key code)

d is a string defining the key modifier required by the shortcut.
it may be "c" for shortcuts using the cmd key
"ac" or "ca" for shoertcuts using cmd and option keys (option is named alt on European keyboards)
"sc" or "cs" for shortcuts using cmd and shift
"kc" or "ck" for shortcuts using cmd and ctrl
"kcs" and variants for shortcuts using cmd and shift and ctrl.

I use this general handler but, when a single shortcut is used we may prefer a shorter one:

on fillDown()
tell application "Numbers" to activate
tell application "System Events" to tell application process "Numbers"
key code 125 using {command down, option down}
end tell
end fillDown

Yvan KOENIG (VALLAURIS, France) jeudi 26 novembre 2009 07:04:13

 _______________________________________________
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

References: 
 >Very slow Applescript operation in iWork Numbers 09 (From: Mads Fog Albrechtslund <email@hidden>)
 >Re: Very slow Applescript operation in iWork Numbers 09 (From: Yvan KOENIG <email@hidden>)
 >Re: Very slow Applescript operation in iWork Numbers 09 (From: Yvan KOENIG <email@hidden>)

  • Prev by Date: Re: Very slow Applescript operation in iWork Numbers 09
  • Next by Date: 10.6 Address Book no longer loads Birth Day additions?!?
  • Previous by thread: Re: Very slow Applescript operation in iWork Numbers 09
  • Next by thread: Re: Graphs in AppleScript?
  • Index(es):
    • Date
    • Thread