Re: Looping through Numbers (iWork) sheet problem
Re: Looping through Numbers (iWork) sheet problem
- Subject: Re: Looping through Numbers (iWork) sheet problem
- From: KOENIG Yvan <email@hidden>
- Date: Mon, 20 Jun 2011 10:15:25 +0200
Le 20 juin 2011 à 08:01, Gert van Oss a écrit :
> 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
You got the answer in the Numbers forum.
There is no way to select a sheet except GUI scripting and you were given the required code !
I hope that this will change with the next version but at this time we must live with it … or leave it !
Yvan KOENIG (VALLAURIS, France) lundi 20 juin 2011 10:15:19
_______________________________________________
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