2 page numbers for each two-column page
MacBook Pro 13" 2.4 GHz Intel Core 2 Duo, Mac OS X (10.6.3)
MacBook Pro 13" 2.4 GHz Intel Core 2 Duo, Mac OS X (10.6.3)
If you are OK to insert a two cells table at the bottom of every page, I guess that you will accept to *_insert a text block masking the footer area._*
I think that I will be able to insert the pages numbers in such boxes.
It would be more complicated than putting them in footers because it will be necessary to locate the text box which is the lower one in the page (I guess that you may have other ones).
tell application "Pages" to tell document 1
set nb_sections to count sections
set nb_pages to count pages
if nb_sections is not nb_pages then
set missing to nb_pages - nb_sections
error "" & missing & " section breaks between pages are missing !"
end if
set ma_chaine to "page #"
repeat with ns from 1 to nb_sections
set le_pied to ma_chaine & (ns * 2) - 1 & tab & ma_chaine & (ns * 2)
tell section ns
if ns > 1 then set reuse headers and footers to false
if ns div 2 = 0 then
set even footer to le_pied
else
set odd footer to le_pied
end if
end tell
end repeat
end tell
--
KOENIG Yvan wrote:
The problem isn't really the one described by peterbreis.
It's that a table has no way to extract the page_number of the page in which it is stored.
--[SCRIPT inserttwo_pages_numbers_perpage]
(*
Yvan KOENIG (VALLAURIS, France)
2010/10/14
*)
on run
local ma_chaine, nb_pages, num_pages, lesblocstexte, le_bloc, le_bas, un_bloc, un_bas, le_pied
set ma_chaine to "page #"
tell application "Pages" to tell document 1
set nb_pages to count of pages
repeat with num_page from 1 to nb_pages
(*
Extract the text boxes of one page *)
set lesblocstexte to (every text box whose page number of containing page is num_page)
(*
Init two variables *)
set {le_bloc, le_bas} to {"", 0}
if lesblocstexte is not {} then
(*
Extracts the lower text box in the page *)
repeat with un_bloc in lesblocstexte
set un_bas to (vertical position of un_bloc) + (height of un_bloc)
if un_bas > le_bas then
set le_bas to un_bas
set le_bloc to un_bloc
end if
end repeat
end if
if (le_bloc is "") or vertical position of le_bloc < 540 then
(*
Issue an error if there is no text box or if the lower one isn't sufficiently low to be used *)
error "There is no text box for page numbers in page #" & num_page
else
(*
Builds the contents of the text box and insert it in the box *)
set le_pied to ma_chaine & (num_page * 2) - 1 & tab & ma_chaine & (num_page * 2)
set object text of le_bloc to le_pied
end if
end repeat
end tell
end run
--[/SCRIPT]
--
2 page numbers for each two-column page