Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

12ibookg4

macrumors regular
Original poster
Dec 22, 2003
199
0
I've got quite a few .pages documents and would like them converted into MS word .doc format. I know I can open each file and choose export->MS word, but is there an easier way using AppleScipt or Automator so that I can convert a whole bunch of them at once?
Thanks for your help.
 
Pages To Word Pages2Word with Mail send

(* This is a Script for to convert a single open Pagesdocument in a Word.doc and send it with Mail.app it does not Work if there are more Pages Dokuments open at the same time. if you have a solition of this problem please Mail to gabriel@feiner.at
2008-01-14 Als Pages Skript:
jf Pages nach Word konvertieren und dann eMail mit Attachment erstellen
(Achtung, wenn *.doc schon existiert, dann wird es einfach überschrieben)
Probleme mit "bösen" Workaround gelöst:
Sprachabhängig:
-- E: "Pages Publication"
-- D: "Pages-Dokument"
darum funktionieren Abfragen auf "kind of" nur auf Deutsch
auch checkboxen und buttons heissen in D und auf E anders
Probleme unglelöst: (aber jetzt egal, weil Attachment
einfach fix "Anhang.doc" heisst und im /tmp Verzeichnis liegt! )
Tastaturlayoutabhängig
(z.B.: mit keystroke wird "z" statt "y" getippt):
-- aus "word-export copy.doc" wird "word-export copz.doc"
(umlaute und unterstrich etc. gehen auch nicht:
-- aus "test_üöäöund€.pages" wird "test?uoaound.doc"
*)
set intoDir to "/tmp/"
set fileNameWithoutSuffix to "Anhang" -- wird als "Anhang.doc" im Verzeichnis "/tmp" landen!

tell application "System Events"
tell process "Pages"
activate
set frontmost to true
-- File / Export anklicken
if exists menu bar item "File" of menu bar 1 then
click menu item "Export…" of menu 1 of menu bar item "File" of menu bar 1
end if
if exists menu bar item "Ablage" of menu bar 1 then
click menu item "Exportieren …" of menu 1 of menu bar item "Ablage" of menu bar 1
end if
-- Export als "Word-Dokument" auswählen (hier: auf D und E gleich "Word")
click checkbox "Word" of radio group 1 of sheet 1 of window 1
if exists button "Next..." of sheet 1 of window 1 then
click button "Next..." of sheet 1 of window 1
end if
if exists button "Weiter …" of sheet 1 of window 1 then

click button "Weiter …" of sheet 1 of window 1
end if

-- ins passende ausgangsverzeichnis wechseln:
keystroke intoDir
if exists button "Go" of sheet 1 of sheet 1 of window 1 then
click button "Go" of sheet 1 of sheet 1 of window 1
end if
if exists button "Start" of sheet 1 of sheet 1 of window 1 then
click button "Start" of sheet 1 of sheet 1 of window 1
end if
--Name zum Abspeichern eingeben: ERROR: statt y steht plötzlich z => falsches keyboard layout...
select text field 1 of sheet 1 of window 1
keystroke fileNameWithoutSuffix

-- Alles passend eingestellt: also jetzt "exportieren"
if exists button "Export" of sheet 1 of window 1 then
click button "Export" of sheet 1 of window 1
end if
if exists button "Exportieren" of sheet 1 of window 1 then
click button "Exportieren" of sheet 1 of window 1
end if
-- soll: nur wenn name schon vorhanden war, dann ersetzen!
if exists button "Replace" of sheet 1 of sheet 1 of window 1 then
click button "Replace" of sheet 1 of sheet 1 of window 1
end if
if exists button "Ersetzen" of sheet 1 of sheet 1 of window 1 then
click button "Ersetzen" of sheet 1 of sheet 1 of window 1
end if
end tell
end tell


set attach_file to intoDir & fileNameWithoutSuffix & ".doc"
(*ein paar Voreinstellungen zur Mail: *)
set message_text to "Anbei das Word-Dokument." & return & " MfG Mein Name" & return & ""

set message_subject to "<Bitte Betreff einfügen>"
set recipient_name to "Mein Name"
set recipient_address to "mein@name.at"

-- und jetzt wird das Mail vorbereitet:
tell application "Mail"
activate
set this_message to make new outgoing message with properties {subject:message_subject}
tell this_message
make new to recipient at beginning of to recipients with properties {name:recipient_name, address:recipient_address}
set content to the message_text
tell content
make new attachment ¬
with properties {file name:attach_file} ¬
at after the last paragraph
end tell
set visible of this_message to true
end tell
(* die zwei stricherl weggeben, wenn das mailen gleich automatisch passieren soll... *)
-- send this_message
end tell
--end composeEMail
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.