multiple table of contents
Can anyone help?
MacBook Pro and PowerBook G4, Mac OS X (10.5.6)
MacBook Pro and PowerBook G4, Mac OS X (10.5.6)
Creating and Updating a Table of Contents
Each table of contents (TOC) you create using a Word Processing template lists only
the content that follows it, up until the next table of contents. If you want a master
table of contents for the entire document, it must be the only table of contents, and it
must be at the beginning of the document.
I wish to insert multiple table of contents in a Pages '09 document (table of contents, table of figures etc). Each table of contents is separated by a section break.
on run
tell application "Pages" to tell document 1
set ns to count of sections
set mesTables to {}
set imgCnt to 0
set tblCnt to 0
repeat with s from 1 to ns
tell section s
--set imgCnt to 0
--set tblCnt to 0
copy "Section #" & s & return to end of mesTables
set np to count of pages
repeat with p from 1 to np
tell page p
set nbt to count of tables
set nbi to count of images
end tell -- pages
if (nbt + nbi) > 0 then
copy tab & "Page #" & p & return to end of mesTables
if nbt > 0 then
repeat with i from 1 to nbt
set tblCnt to tblCnt + 1
copy tab & tab & "Table #" & tblCnt to end of mesTables
end repeat
end if -- nbt > 0
if nbi > 0 then
repeat with i from 1 to nbi
set imgCnt to imgCnt + 1
copy tab & tab & "Image #" & imgCnt to end of mesTables
end repeat
copy "" to end of mesTables
end if -- nbi > 0
set nbt to 0
set nbi to 0
copy "" to end of mesTables
end if
end repeat
end tell -- sections
end repeat
end tell
set mesTables to my recolle(mesTables, return)
set the clipboard to mesTables
end run
on recolle(l, d)
local t
set AppleScript's text item delimiters to d
set t to l as text
set AppleScript's text item delimiters to ""
return t
end recolle
Gregor Schinke wrote:
sorry for asking such silly questions but this is my second day on a mac and I try to run your script. I got that far that I have a text like
Section #1
Page #1
Image #1
but no page numbers. Do you know what I am doing wrong.
multiple table of contents