Can I open a .txt file in WORD using a specific Template?

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Q. Is it possible open a .txt text file (unicode) in WORD using a specific WORD template?

I have a "Headed Paper" Word document template (includes a logo). I regularly need to email the full contents of various text files as a PDF using this template.

My Current workflow:

1/ Open text file in BBEDIT
2/ Ctrl A to select all
3/ Copy
4/ Open Word with the required template
5/ Paste into the New Document
6/ Save the Word Document (to allow later edits if necessary)
7/ Email the Word Document as a PDF

I've got the emailing bit sorted, but it occurs to me there must be a way to script the creation of a Word document using a specific template and insert the text (always the complete text file)

Having done a little research people typically create a new document using a template & script a paste from the clipboard into it. That doesn't seem a reliable solution if emailing automatically, as the contents of the clipboard could get changed by other processes.

Any ideas?

Thanks.
MacOCD
 
Posts: 44
Joined: Fri Sep 26, 2014 11:02 am

This sounds like something for AppleScript.
Mr_Noodle
Site Admin
 
Posts: 11236
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

I assume any solution will be AppleScript or Bash script based, when I try to open the text file in Word with AppleScript I get an import screen with options to select. I’m trying to insert the text into a word document based on a specified template.
MacOCD
 
Posts: 44
Joined: Fri Sep 26, 2014 11:02 am

That's a bit outside of the support I can give. I suggest checking out some AppleScript sites for help on how to do this.
Mr_Noodle
Site Admin
 
Posts: 11236
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support