Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

default template for text files

Hi there,

I open a lot of externally created text files in my business and the default Pages template does not suit - I need a non proportional font.

I understand about creating Templates but these do not apply to opening "foreign" text files.

I understand there is no easy way to do this from within Pages - is there a Terminal instruction that will change the default text template?

Thanks

Simon Bowler

imac

Posted on Jun 15, 2011 4:59 PM

Reply
12 replies

Jun 15, 2011 11:36 PM in response to simondbowler

Be aware that imported documents will have whatever font & design was saved with those. You will need to change the styles directly in those, a template is used for building a new document not for changing existing documents.


Just create your own template, using the fonts you want and save them as the default styles in:


Menu > View > Show Styles Drawer


eg click on some Body text > change to the font you want > click on the red triangle next to Body in the Styles Drawer > Redefine style from selection


When you open that template again it will have the fonts set the way you like them, along with everything else you would like to be part of the template.


Peter

Jun 16, 2011 8:20 AM in response to simondbowler

My two cents :


Double click one of your "foreign" document to open it in Pages.

Select All

Apply your preferred non proportional font.


If you must do that often, I may write a script automatizing the process.

Knowing the wanted font would be useful 😉


Yvan KOENIG (VALLAURIS, France) jeudi 16 juin 2011 17:19:48

iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.7

Please : Search for questions similar to your own before submitting them to the community


To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

Jun 16, 2011 9:09 AM in response to KOENIG Yvan

Here is my script :


--{code}

--[SCRIPT to_monospaced]

(*

Enregistrer le script en tant qu'application : to_monospaced.app

déplacer le fichier ainsi créé sur le bureau.


Glisser-déposer un ou plusieurs documents à importer dans Pages sur l'icône to_monospaced.app

Le script ouvrira ceux-ci dans Pages et appliquera la police non-proportionnelle définie dans le script.


--=====


Save the script as a application: to_monospaced.app


Move the newly created file on the Desktop.

Drag and drop one or several documents to import in Pages on the icon to_monospaced.app

The script will open the documents and apply the monospaced font defined in its code.


--=====


Yvan KOENIG (VALLAURIS, France)

2011/06/16

*)

--=====


on open sel

copy sel to les_documents

repeat with un_fichier in les_documents

my traite(un_fichier as text)

end repeat

end open


--=====


on traite(le_fichier)

try

tell application "Pages"


openfilele_fichier

tell document 1 to tell body text

(*

I coded for 17 monospaced fonts available on my machine,

if you want to use an other one, edit the active instruction to fit your needs.

*)


--set font name to "AndaleMono"


--set font name to "Chicago"


--set font name to "Courier"


--set font name to "CourierFinalDraft-Bold"


--set font name to "CourierNewPS-BoldMT"


--set font name to "CourierStd-Bold"


--set font name to "DejaVuSansMono-Bold"


--set font name to "DroidSansMono"


--set font name to "FreeMono"

set font name to "LMMono10-Regular"


--set font name to "LeftistMonoSerif"


--set font name to "LiberationMono"


--set font name to "Menlo-Italic"


--set font name to "Monofur"


--set font name to "Monoxil"


--set font name to "TeXGyreCursor-Regular"


--set font name to "VerilySerifMono"

end tell -- document…

end tell -- Pages

end try

end traite

--[/SCRIPT]

--{code}


Yvan KOENIG (VALLAURIS, France) jeudi 16 juin 2011 18:09:37

iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.7

Please : Search for questions similar to your own before submitting them to the community


To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

Jun 19, 2011 3:54 AM in response to fruhulda

Thanks to all for the replies.


Each morning I open about 30 text files which are foreign in the sense that they are created in a non Mac environment (PIT files)


Pages opens them easily but does so with a proportional font which is too large.


MS Word opens them as courier 10 point but in its latest iteration requires an extra step of selecting the codex. And who wants to use Word anyway.


So I was hoping I could "get under the hood" of Pages and alter the default Template to open these files (say with Courier 10 point).


This is different to having a Template which is opened at the start of a new Pages document


Many thanks for the script Yvan - very useful - and I guess that may be the only way (I use scripts extensively in this process earlier in the workflow).


But no-one knows of any way to modify Pages to set a different default template for opening previously created .txt files?


I wondered if there might be a method using Terminal?


Simon Bowler

Jun 19, 2011 5:31 AM in response to simondbowler

As far as I know, there is no interface available between Pages and the Terminal.


As your late message gave your exact settings : Courier 10

I changed a bit my script.

Now it apply automatically your own settings.

To make it easy to customize, I defined the font name and the font size in properties.


--{code}

--[SCRIPT to_monospaced]

(*

Enregistrer le script en tant qu'application : to_monospaced.app

déplacer le fichier ainsi créé sur le bureau.


Glisser-déposer un ou plusieurs documents à importer dans Pages sur l'icône to_monospaced.app

Le script ouvrira ceux-ci dans Pages et appliquera la police non-proportionnelle définie dans le script.


--=====


Save the script as a application: to_monospaced.app


Move the newly created file on the Desktop.

Drag and drop one or several documents to import in Pages on the icon to_monospaced.app

The script will open the documents and apply the monospaced font defined in its code.


--=====


Yvan KOENIG (VALLAURIS, France)

2011/06/16

2011/06/19 apply Courier 10

*)

--=====

(*

Here is a list of 17 monospaced fonts available on my machine.


"AndaleMono"

"Chicago"

"Courier"

"CourierFinalDraft-Bold"

"CourierNewPS-BoldMT"

"CourierStd-Bold"

"DejaVuSansMono-Bold"

"DroidSansMono"

"FreeMono"

"LMMono10-Regular"

"LeftistMonoSerif"

"LiberationMono"

"Menlo-Italic"

"Monofur"

"Monoxil"

"TeXGyreCursor-Regular"

"VerilySerifMono"


Of course, you may edit the two properties to fit your needs.

*)

property la_police : "Courier"

property le_corps : 10.0


--=====


on open sel

copy sel to les_documents

repeat with un_fichier in les_documents

my traite(un_fichier as text)

end repeat

end open


--=====


on traite(le_fichier)


(*

require the properties la_police and le_corps

*)

tell application "Pages"

try


openfilele_fichier

tell document 1 to tell body text

set properties to {font name:la_police, font size:le_corps}

end tell -- document…

end try

end tell -- Pages

end traite


--=====

--[/SCRIPT]

--{code}


As you may see, I'm systematically using handlers which are easy to test and reuse.

If you really want to spare some 1/1000 seconds you may use this more compact version :


--{code}

--[SCRIPT to_monospaced]

(*

Enregistrer le script en tant qu'application : to_monospaced.app

déplacer le fichier ainsi créé sur le bureau.


Glisser-déposer un ou plusieurs documents à importer dans Pages sur l'icône to_monospaced.app

Le script ouvrira ceux-ci dans Pages et appliquera la police non-proportionnelle définie dans le script.


--=====


Save the script as a application: to_monospaced.app


Move the newly created file on the Desktop.

Drag and drop one or several documents to import in Pages on the icon to_monospaced.app

The script will open the documents and apply the monospaced font defined in its code.


--=====


Yvan KOENIG (VALLAURIS, France)

2011/06/16

2011/06/19 apply Courier 10

*)

--=====

(*

Here is a list of 17 monospaced fonts available on my machine.


"AndaleMono"

"Chicago"

"Courier"

"CourierFinalDraft-Bold"

"CourierNewPS-BoldMT"

"CourierStd-Bold"

"DejaVuSansMono-Bold"

"DroidSansMono"

"FreeMono"

"LMMono10-Regular"

"LeftistMonoSerif"

"LiberationMono"

"Menlo-Italic"

"Monofur"

"Monoxil"

"TeXGyreCursor-Regular"

"VerilySerifMono"


Of course, you may edit the two properties to fit your needs.

*)

property la_police : "Courier"

property le_corps : 10.0


--=====


on open sel

tell application "Pages"

repeat with un_fichier in sel

try

open file (un_fichier as text)

tell document 1 to tell body text

set properties to {font name:la_police, font size:le_corps}

end tell -- document…

end try

end repeat

end tell -- Pages

end open


--=====

--[/SCRIPT]

--{code}


Yvan KOENIG (VALLAURIS, France) dimanche 19 juin 2011 14:31:11

iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.7

Please : Search for questions similar to your own before submitting them to the community


To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

Jun 19, 2011 7:57 AM in response to simondbowler

Simon, what font are used in those documents? If you have the font it will open with that font. If you don't have the font it will substitute the font which you can change when you get an warning message that there are some warnings when opening the document. Click on the font and replace it some one you have


If it is only the font size that is the problem Select the whole content of the document and change the font. By using the short key for making the font size smaller one or two points you do that while everything is still selected. Short key is Cmd + -


Or use styles. You can import styles from other Pages or Word documents.

Jun 19, 2011 8:13 AM in response to fruhulda

Hello fruhulda.

It seems that you misunderstood the problem.

The source file is a kind of raw text file.

When it open it, Pages apply a default font.

Try to save a piece of text as TEXT file from TextEdit.

The used font would be Monaco.

Open it in Pages.

The text will be automatically Helvetica 12.

We can't change this behavior.

Before writing the script, I tried to change the default font used in the Blank template.

The result was that when I created a new document, it was using Courier but opening a text file continued to use Helvetica.


As I'm pig-headed I continue to search where is defined the font used when opening a text file but at this time I don't know.


Yvan KOENIG (VALLAURIS, France) dimanche 19 juin 2011 17:13:27

iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.7

Please : Search for questions similar to your own before submitting them to the community


To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

Jun 19, 2011 9:48 AM in response to fruhulda

fruhulda wrote:


(1) No, I didn't misunderstand. I know that we can't change the Pages behavior.

(2) I also know that the font Helvetica will be used if the font in the opened document isn't on the computer.

(3) I am not opposing your script. It is great that you can supply them. I was just giving suggestion hoe to easy change the overall font or font size.

Hello


(1) OK

(2) It's not this feature which apply here. In my example, the imported file use Monaco which is available but the design of the app is done so that importing a text file always apply Helvetica 12.

(3) Your scheme is perfect when we have only one file to treat. When like the OP we have 30 ones, asking a script to do the job if more efficient.


(4) I'm bored because I thought that I had discovered the used resource. I edited it but nada, the imported text was in Helvetica 12.

I will no longer work on that because, re-examining the late keynote, I paused when Pages was on screen and it's clear that Phil Schiller's demo was made with a new version of Pages using Lion's features. Now I assume that we will have to wait no more than one month.


Yvan KOENIG (VALLAURIS, France) dimanche 19 juin 2011 18:44:09

iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.7

Please : Search for questions similar to your own before submitting them to the community


To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

Jun 20, 2011 2:14 PM in response to simondbowler

Those which know the future version signed a Non Disclosure Agreement so they will not respond.

As I'm not a beta tester I don't know it.

I just doubt that it will offer such feature.

Maybe the applied font would be defined in an editable resource, what I wasted a lot of time to search but hope for this kind of change seems very very low.

Honestly, the use of a script seems to be an efficient scheme.


Of course I would be glad if we get defined entry points to customize a bit the app but this kind of entries are also an open door for malware so I am balancing.


Yvan KOENIG (VALLAURIS, France) lundi 20 juin 2011 23:14:27

iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.7

Please : Search for questions similar to your own before submitting them to the community


To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

default template for text files

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.