• 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: Numbers'09 make new table doesn't apply to designed sheet.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Numbers'09 make new table doesn't apply to designed sheet.


  • Subject: Re: Numbers'09 make new table doesn't apply to designed sheet.
  • From: KOENIG Yvan <email@hidden>
  • Date: Thu, 15 Jan 2009 14:45:09 +0100

I sent a complementary report

I sent this complementary report:

I was fooled by the oddity in the make new table function.

Look at this script:

tell application "Numbers"
activate
tell document 1
set nn to (get name of sheets)
set nameOfSheet1 to get name of sheet 1
tell sheet 1 to make new table
end tell
end tell
 



Run it with a document containing two sheets.

If you select sheet 1, the table is created in this sheet and the name of sheet 1 is "Feuille 1" as displayed in the log below:

tell application "Numbers"
activate
get name of every sheet of document 1
{"Feuille 1", "Feuille 2"}
get name of sheet 1 of document 1
"Feuille 1"
make new table
table "Tableau 5" of sheet "Feuille 1" of document "Sans titre"
end tell



but
if you select sheet 2 before running the script, the table is created in sheet 2 but name of sheet 1 is always "Feuille 1" as displayed in the log below:

tell application "Numbers"
activate
get name of every sheet of document 1
{"Feuille 1", "Feuille 2"}
get name of sheet 1 of document 1
"Feuille 1"
make new table
table "Tableau 5" of sheet "Feuille 2" of document "Sans titre"
end tell



a reference to sheet 1 has different meanings given the running instruction
It's perfectly odd.


The only interesting feature of this oddity is that it gave me a way to grab the name of the current sheet:

--[SCRIPT]

display dialog my grabCurrentSheetName()

 

on grabCurrentSheetName()
tell application "Numbers"
tell document 1 to tell sheet 1
set tName to "temporary_yraropmet"
set newTable to make new table with properties {name:tName}
try
newTable as text
on error errMsg number errNum
set sheetName to item 4 of my decoupe(errMsg, quote)
end try
delete newTable
end tell
end tell
return sheetName
end grabCurrentSheetName

 

--=====

 

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]

Yvan KOENIG (from FRANCE jeudi 15 janvier 2009 14:45:05)

 _______________________________________________
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: 
 >Rep: Numbers '08 (Selection range) (From: KOENIG Yvan <email@hidden>)

  • Prev by Date: Four scripts for Finder and Terminal
  • Next by Date: Using Applescript Droplet as Default Application? (10.4.11)
  • Previous by thread: Rep: Numbers '08 (Selection range)
  • Next by thread: Folder items to trash
  • Index(es):
    • Date
    • Thread