Friday, November 22, 2019

#1 2019-10-22 10:29:48 am

NMG
Member
Registered: 2019-09-29
Posts: 32

Hot to get the width of the page in Pages

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


Filed under: Apple Pages

Offline

 

#2 2019-10-22 11:53:30 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 3635

Re: Hot to get the width of the page in Pages

Given what you wrote you may get the infos with :

Applescript:

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:

Applescript:

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

Offline

 

#3 2019-10-23 02:29:55 am

NMG
Member
Registered: 2019-09-29
Posts: 32

Re: Hot to get the width of the page in Pages

@Yvan Koenig. Thank you! This helps a lot

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)