Re: Numbers '08
Re: Numbers '08
- Subject: Re: Numbers '08
- From: KOENIG Yvan <email@hidden>
- Date: Mon, 12 Jan 2009 10:47:20 +0100
Here is the way I uses the workaround:
--[SCRIPT]{code}
set {selName, dName, sName, tName} to my getSelection()
if selName is missing value then error "No selected cells"
set twoNames to my decoupe(selName, ":")
set {colNum1, rowNum1} to my decipher(item 1 of twoNames)
if item 2 of twoNames = item 1 of twoNames then
set {colNum2, rowNum2} to {colNum1, rowNum1}
else
set {colNum2, rowNum2} to my decipher(item 2 of twoNames)
end if
display dialog "first cell : column " & colNum1 & " of row " &
rowNum1 & return & "last cell : column " & colNum2 & " of row " &
rowNum2
--=====
on getSelection()
local sr, s, t, d
tell application "Numbers"
set d to name of document 1
tell document 1
repeat with s in every sheet
set sn to name of s
tell s
repeat with t in every table
set tn to name of t
tell t
if selection range exists then return {get name of selection
range, d, sn, tn}
end tell -- table
end repeat
end tell -- sheet
end repeat
end tell -- document
end tell -- application
return {missing value, d, sn, tn}
end getSelection
--=====
on decipher(n)
local colNum, rowNum
if (character 2 of n) as text > "9" then
set colNum to ((ASCII number of (character 1 of n)) - 64) * 64 +
(ASCII number of (character 2 of n)) - 64
set rowNum to (text 3 thru -1 of n) as integer
else
set colNum to ((ASCII number of (character 1 of n)) - 64)
set rowNum to (text 2 thru -1 of n) as integer
end if
return {colNum, rowNum}
end decipher
--=====
on decoupe(t, d)
local l
set AppleScript's text item delimiters to d
set l to text items of t
set AppleScript's text item delimiters to ""
return l
end decoupe
--=====
--[/SCRIPT]{code}
Yvan KOENIG (from FRANCE lundi 12 janvier 2009 10:47:12)
_______________________________________________
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