I had a few free minutes so I was able to write this small script.
--
--[SCRIPT center_title]
(*
Enregistrer le script en tant que Script : center_title.scpt
déplacer le fichier ainsi créé dans le dossier
<VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:Applications:Pages:
Il vous faudra peut-être créer le dossier Pages et peut-être même le dossier Applications.
Sélectionner le document Pages ouvert.
aller au menu Scripts , choisir Pages puis choisir center_title
Le script extrait diverses informations lui permettant de centrer le titre de la première page (s'il se limite à une ligne).
--=====
L'aide du Finder explique:
L'Utilitaire AppleScript permet d'activer le Menu des scripts :
Ouvrez l'Utilitaire AppleScript situé dans le dossier Applications:AppleScript.
Cochez la case "Afficher le menu des scripts dans la barre de menus".
Sous 10.6.x,
aller dans le panneau "Général" du dialogue Préférences de l'Éditeur Applescript
puis cocher la case "Afficher le menu des scripts dans la barre des menus".
--=====
Save the script as a Script: center_title.scpt
Move the newly created file into the folder:
<startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Pages:
Maybe you would have to create the folder Pages and even the folder Applications by yourself.
Select the open Pages document.
go to the Scripts Menu, choose Pages, then choose "center_title"
The script extract some values allowing it to center the title in the first page (assuming that it's a single line one).
--=====
The Finder's Help explains:
To make the Script menu appear:
Open the AppleScript utility located in Applications:AppleScript.
Select the "Show Script Menu in menu bar" checkbox.
Under 10.6.x,
go to the General panel of AppleScript Editor’s Preferences dialog box
and check the “Show Script menu in menu bar” option.
--=====
Yvan KOENIG (VALLAURIS, France)
2010/08/01
*)
--=====
property theApp : "Pages"
--=====
on run
local page_width, page_height, above_header, header_height, footer_height
local below_header, heightofparagraph1, heightofparagraph2
(*
CAUTION : we can't use the printer margins available in page attributes.
They aren't defining the position of header and footer
So, we must extract them thru GUI scripting
*)
tell application "Pages" to tell document 1
set {leftofpage, topofpage, page_width, page_height, leftofheader, topofheader, header_width, header_height, leftoffooter, topoffooter, footer_width, footer_height} to my getPage_Header_FooterMeasures(name)
(*
space before apply only if there is a true paragraph before the one to which we want to apply this property
*)
if (count of (get every paragraph whose page number of containing page is 1)) = 1 then make new paragraph at the beginning
set heightofparagraph1 to 1
set properties of paragraph 1 to {font name:"Helvetica", font size:heightofparagraph1}
set heightofparagraph2 to (font size of paragraph 2) / 2
set properties of paragraph 2 to {alignment:center, space before:(page_height / 2) - (topofheader - topofpage) - header_height - (heightofparagraph1 + heightofparagraph2) * 1.2}
end tell -- Pages…
end run
--=====
on getPage_Header_Footer_Measures(thewindow)
local theleft_ofpage, thetop_ofpage, thepagewidth, thepageheight
local theleft_ofheader, thetop_ofheader, theheaderwidth, theheaderheight
local theleft_offooter, thetop_offooter, thefooterwidth, thefooterheight
tell application theApp to activate
tell application "System Events" to tell (first application process whose title is theApp)
tell window the_window to tell first group of first UI element of last scroll area of first splitter group
set {theleft_ofpage, thetop_ofpage} to position
set {thepagewidth, thepageheight} to size
tell (get second text area)
get properties
set {theleft_ofheader, thetop_ofheader} to position
set {theheaderwidth, theheaderheight} to size
end tell
tell (get third text area)
set {theleft_offooter, thetop_offooter} to position
set {thefooterwidth, thefooterheight} to size
end tell
end tell -- window…
end tell -- System Events
return {theleft_ofpage, thetop_ofpage, thepagewidth, thepageheight, theleft_ofheader, thetop_ofheader, theheaderwidth, theheaderheight, theleft_offooter, thetop_offooter, thefooterwidth, thefooterheight}
end getPage_Header_FooterMeasures
--=====
--[/SCRIPT]
--
It's a quick way to center a one line title in the first page.
Yvan KOENIG (VALLAURIS, France) dimanche 1 août 2010 18:55:27