Pages - save document

  • Hi folks,
    I'm trying to save document into .doc format using scripting bridge
    and get a crash which I can't resolve.

    pages = (PagesApplication*)[SBApplication
    applicationWithBundleIdentifier:@"com.apple.iWork.Pages"];
    NSLog(@"Pages are running");

    NSArray *docs = [NSArray arrayWithArray:(SBElementArray*)[pages
    documents]];
    NSLog([docs description]);

    NSEnumerator *e = [docs objectEnumerator];
    PagesDocument *temp;

    while (temp = [e nextObject])
    {
    [temp saveAs:@".doc" in:[NSURL URLWithString:@"/tmp/test.doc"]];
    }

    The crash details:
    2007-11-05 16:44:57.973 c[12113:813] An uncaught exception was raised
    2007-11-05 16:44:57.974 c[12113:813] Apple event returned an error.
    Event = 'core'\'save'{ '----':'obj '{ 'want':'docu', 'from':'null'(),
    'form':'indx', 'seld':1 }, 'fltp':'utxt'(".doc"), 'kfil':'utxt'("/tmp/
    test.doc") }
    Error info = {
        ErrorNumber = -50;
        ErrorString = "The document cannot be exported to the \".doc\"
    format.";
    }

    Thanks
    Robert
  • On Nov 5, 2007, at 9:50 AM, Robert Cerny wrote:

    > Hi folks,
    > I'm trying to save document into .doc format using scripting bridge
    > and get a crash which I can't resolve.
    >

    It appears to export a Word document, in AppleScript you'd just say

    save first document in POSIX file "/tmp/test.doc"

    If you try the "as" parameter you get an error.  So I'm guessing the
    command would be:

    [temp saveIn:[NSURL URLWithString:@"/tmp/test.doc"]]

    (Or whatever the script bridge generates for the save method without
    the "as" part)

    Glenn Andreas                      <gandreas...>
      <http://www.gandreas.com/> wicked fun!
    quadrium | prime : build, mutate, evolve, animate : the next
    generation of fractal art
  • On 5.11.2007, at 17:04, glenn andreas wrote:

    >
    > On Nov 5, 2007, at 9:50 AM, Robert Cerny wrote:
    >
    >> Hi folks,
    >> I'm trying to save document into .doc format using scripting bridge
    >> and get a crash which I can't resolve.
    >>
    >
    > It appears to export a Word document, in AppleScript you'd just say
    >
    > save first document in POSIX file "/tmp/test.doc"
    >
    > If you try the "as" parameter you get an error.  So I'm guessing the
    > command would be:
    >
    > [temp saveIn:[NSURL URLWithString:@"/tmp/test.doc"]]
    >
    > (Or whatever the script bridge generates for the save method without
    > the "as" part)
    >
    >
    >
    > Glenn Andreas                      <gandreas...>
    Hi,
    thanks for your reply. I'm not sure I understand you well, but the
    method description is:

    - (void) saveAs:(NSString *)as in:(NSURL *)in_;  // Save an object.

    Robert
previous month november 2007 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today