• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
export Pages document to rtfd
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

export Pages document to rtfd


  • Subject: export Pages document to rtfd
  • From: KOENIG Yvan <email@hidden>
  • Date: Tue, 1 Feb 2011 20:23:17 +0100

Hello

I’m trying to drive Pages to export documents as Rtf or Rtfd ones.
When the documents aren’t embedding graphic objects they are exported as xx.rtf but when graphic objects are embedded, I can’t find the required syntax.

Here is a quick and dirty script which I use to make tests.

--[SCRIPT]
set p2d to "" & (path to desktop folder)

set chemin_de_Pages to p2d & "text_and_table.pages"
my export_to_rtf(chemin_de_Pages)

set chemin_de_Pages to p2d & "with_graphics.pages"
my export_to_rtf(chemin_de_Pages)


on export_to_rtf(chemin_de_Pages)
if chemin_de_Pages ends with ":" then
set off7 to 2
else
set off7 to 1
end if
tell application "Pages"
open chemin_de_Pages as alias
tell document 1
set nbg to count of every graphic
set nbt to count of every table
end tell
if (nbg - nbt) > 0 then
set xType to "SLDocumentTypeRichTextBundle"
set p_xport to (text 1 thru -off7 of chemin_de_Pages) & ".rtfd"
else
set xType to "SLDocumentTypeRichText"
set p_xport to (text 1 thru -off7 of chemin_de_Pages) & ".rtf"
end if
try
save front document as xType in p_xport
on error errMsg number errNbr
display dialog errMsg & return & "number #" & errNbr
end try
close front document saving no
end tell -- Pages
end export_to_rtf
--[/SCRIPT]

When the doc embed graphics, the export to rtfd fails with the error :

error "The document cannot be exported to the \"Document RTF avec pièces jointes (RTFD)\" format." number -50

At this time, I am forced to use GUIscripting to achieve the goal.

Yvan KOENIG (VALLAURIS, France) mardi 1 février 2011 20:22:44


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Next by Date: Launching scripts or applets via remote desktop
  • Next by thread: Launching scripts or applets via remote desktop
  • Index(es):
    • Date
    • Thread