In Apple Pages I can get the width of the window.
But how can I get the width of the page, or document or document body …? (I am not sure how to call it) I mean the white space inside the Pages window
In Apple Pages I can get the width of the window.
But how can I get the width of the page, or document or document body …? (I am not sure how to call it) I mean the white space inside the Pages window
Given what you wrote you may get the infos with :
tell application "Pages" to activate
tell application "System Events" to tell process "Pages"
set frontmost to true
tell window 1
--class of UI elements--> {splitter group, button, button, button, menu button, toolbar, static text}
tell splitter group 1
--class of UI elements --> {scroll area, static text, button, button, button, button, button, button, splitter, radio group, button, radio group, scroll area}
set {itsPosition, itsSize} to {position, size} of scroll area 1 --> {{438, 91}, {745, 989}}
end tell
end tell
end tell
But I’m not sure that it’s what you really want.
Assuming that the Inspector of Document is active, you may get an other set of infos with:
tell application "Pages" to activate
tell application "System Events" to tell process "Pages"
set frontmost to true
tell window 1
--class of UI elements--> {splitter group, button, button, button, menu button, toolbar, static text}
tell splitter group 1
--class of UI elements --> {scroll area, static text, button, button, button, button, button, button, splitter, radio group, button, radio group, scroll area}
--set {itsPosition, itsSize} to {position, size} of scroll area 1 --> {{438, 91}, {745, 989}}
tell scroll area 2
--class of UI elements --> {static text, pop up button, pop up button, static text, button, button, static text, checkbox, text field, incrementor, static text, checkbox, text field, incrementor, static text, checkbox, static text, text field, incrementor, static text, text field, incrementor, static text, text field, incrementor, static text, text field, incrementor, static text, checkbox, checkbox, checkbox, checkbox, scroll bar}
set pageSize to name of static text 3 --> "21,00 × 29,70 cm"
--help of text fields --> {"Définissez l’espacement entre l’en-tête et le haut de la page.", "Définissez l’espacement entre le pied de page et la fin de la page.", "Définissez la marge supérieure.", "Définissez la marge inférieure.", "Définir la marge gauche.", "Définir la marge droite."}
set {headSpace, footSpace, topMargin, bottomMargin, leftMargin, rightMargin} to value of text fields --> {"1,25 cm", "1,5 cm", "2 cm", "2 cm", "2 cm", "2 cm"}
end tell
end tell
end tell
end tell
With these infos you may calculate the dimensions of the area dedicated to the body text.
Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mardi 22 octobre 2019 19:50:37
@Yvan Koenig. Thank you! This helps a lot