• 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
Looping through Numbers (iWork) sheet problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Looping through Numbers (iWork) sheet problem


  • Subject: Looping through Numbers (iWork) sheet problem
  • From: Gert van Oss <email@hidden>
  • Date: Mon, 20 Jun 2011 08:01:31 +0200

hi,
first tried posting on the Numbers list but to my idea this is more an AppleScript mistake I'm making.

I have a Numbers document with some sheets and tables. I'm trying to have all x amount of tables from the various sheets written to x amount of PDF documents. With the code below I'm successful in getting PDF documents of the first sheet. Looping through the second sheet fails. Can anybody explain me what I'm doing wrong?

Is it true that I can only move/activate a different sheet via GUI-scripting?

Thanks,
Gert  

tell application "Numbers"
activate
tell document 1
activate
repeat with i from 1 to count of sheets
tell sheet i
activate
end tell
set nameSheet to name of sheet i
tell sheet i
repeat with j from 1 to count of tables
tell table j
activate
end tell
set nameTable to name of table j
tell table j
set lastCell to name of last cell
set selection range to range ("A1 : " & lastCell)
try
tell application "System Events" to keystroke "a" using {command down}
tell application "System Events" to keystroke "c" using {command down}
set myPath to (path to desktop folder as text) & nameTable & ".pdf"
set myFile to (open for access myPath with write permission)
set eof myFile to 0
write (the clipboard as («class PDF »)) to myFile
close access myFile
end try
end tell -- table j
end repeat --j is count of tables
end tell --tell sheet i
end repeat --i is count of sheets
end tell --doc 1
end tell --app Numbers
 _______________________________________________
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: Looping through Numbers (iWork) sheet problem
      • From: KOENIG Yvan <email@hidden>
  • Prev by Date: Re: address book entries by date created
  • Next by Date: Re: Looping through Numbers (iWork) sheet problem
  • Previous by thread: Re: address book entries by date created
  • Next by thread: Re: Looping through Numbers (iWork) sheet problem
  • Index(es):
    • Date
    • Thread