Previous 1 2 3 4 Next 46 Replies Latest reply: Aug 4, 2014 12:33 AM by fosnola Go to original post
  • fosnola Level 1 (100 points)

    Hello,

    one solution can be to use the LibreOffice command tool line ( see http://blog.vogella.com/2012/02/27/batch-converting-libreoffice-documents-into-p df/ ), ie. to typing in a Terminal's window something like:

    /Applications/LibreOffice.app/Contents/MacOS/soffice --invisible --nologo --convert-to odt *.cwk

    to convert all files *.cwk to odt

     

    Another solution can be to modify mwawOSX ( http://sourceforge.net/projects/libmwaw/files/ ), an AppleScript which called the libmwaw library, ie. the filter that LibreOffice uses...

  • VikingOSX Level 6 (15,868 points)

    On OS X 10.9.2, the LibreOffice 4.2.3.3 command-line (Terminal) syntax for converting a pure AppleWorks 6.2.9 WP document to the following formats:

     

    MS Word .docx

     

    /Applications/LibreOffice.app/Contents/MacOS/soffice --headless --convert-to docx:"MS Word 2007 XML" --outdir ~/Desktop alice_6.2.9_osx.cwk
    

     

    PDF

     

    /Applications/LibreOffice.app/Contents/MacOS/soffice --headless --convert-to pdf:writer_pdf_Export --outdir ~/Desktop alice_6.2.9_osx.cwk
    

     

    A couple of paragraphs of the conversion result shown in Pages v5.2 from the output Word document.

     

    Screen Shot 2014-04-23 at 8.09.55 AM.png

     

    And the following is a .docx from an MS Windows AppleWorks v5 document conversion, changing only the alice cwk with lorem_v5_win.cwk:

     

    Screen Shot 2014-04-23 at 8.19.12 AM.png

    If you have mixed text and graphics, your mileage will vary on the quality of the output.

  • oktan Level 1 (0 points)

    Hi,

     

    Yes this looks good, however after(?) my upgrade to Mavericks a lot (not all) of those AppleWorks Documents have dropped their file extensions, the have a dark grery icon with the word "exec" in it.

    How to convert those if they don't even have a file extension?

     

     

    with best regards,

    Omar K N

    Stockholm, Sweden

  • fosnola Level 1 (100 points)

    Hello Omar,

    you can use the previous command lines even if the file have no extension, ie. just do not add the .cwk extension in the last parameter: the original file name, as in:

    MS Word .docx

     

    /Applications/LibreOffice.app/Contents/MacOS/soffice --headless --convert-to docx:"MS Word 2007 XML" --outdir ~/Desktop alice_6.2.9_osx
    

     

    PDF

     

    /Applications/LibreOffice.app/Contents/MacOS/soffice --headless --convert-to pdf:writer_pdf_Export --outdir ~/Desktop alice_6.2.9_osx
    

     

    Of course, this suppose that you know which files are AppleWorks files...

  • oktan Level 1 (0 points)

    Hi fosnola,

     

    I'm running the line from above:

     

    /Applications/LibreOffice.app/Contents/MacOS/soffice --invisible --nologo --convert-to odt NN-file

     

    to convert the NN-file, which doesn't have an extension, but this doesn't do anything.

    With the .cwk files it worked!

     

    Any idea?

     

     

    with best regards,

    Omar K N

    Stockholm, Sweden

  • fosnola Level 1 (100 points)

    This is odd, ie. I just try with a file without extension:

     

    /Applications/LibreOffice.app/Contents/MacOS/soffice --invisible --nologo --convert-to odt ~/Cours/nisusZip/4.0/Notes4

    convert /Users/XXX/Cours/nisusZip/4.0/Notes4 -> /Users/XXX/tmp/test/Notes4.odt using OpenDocument Text Flat XML

     

    ( and this works ).

     

    Do you check if LibreOffice can read the NN-file file ?

     

    Notes:

    - if the problem is just an extension problem, you can also do something like that:

     

    cp NN-file /tmp/NN-file.cwk

    /Applications/LibreOffice.app/Contents/MacOS/soffice --invisible --nologo --convert-to odt  /tmp/NN-file.cwk

     

    - the command line given by VikingOSX is better than mine...

  • oktan Level 1 (0 points)

    Hi fosnola,

     

    There might be something wrong with LibreOffice itself.

     

    What I found is this - for adding .odt in a given folder:

    [code]

     

    find . -type f -exec mv '{}' '{}'.odt \;

    [/code]

    (Explanation: this recursively finds all files (-type f) starting from the current directory (.) and applies the move command (mv) to each of them. Note also the quotes around {}, so that filenames with spaces (and even newlines...) are properly handled.)

     

    VikingOSX only deals with MS Word .docx not with .odt, his line would have to be adapted, which I could not.

    [code]

    /Applications/LibreOffice.app/Contents/MacOS/soffice --headless --convert-to docx:"MS Word 2007 XML" --outdir ~/Desktop alice_6.2.9_osx.cwk

    [/code]

     

    And the above find ... line works for files without extension.


    /okn

  • fosnola Level 1 (100 points)

    Hello,

    yes, this code will add .odt to each file name,

         find . -type f -exec mv {} {}.odt \;

    in fact, if you use bash, ... , you don't need to add the different '

     

    To update the VikingOSX, you can do:

    /Applications/LibreOffice.app/Contents/MacOS/soffice --headless --convert-to odt --outdir ~/Desktop ~/Cours/nisusZip/4.0/Notes4

     

    ( which tries to convert the file ~/Co.../Notes4 in odt and put the result on the desktop, ie. in ~/Desktop )

  • oktan Level 1 (0 points)

    Thank you.

     

    BTW now doubts came up in my amateur mind as to whether adding an extension such as .odt by itself is equal to a conversion of the file into .odt?

     

    Because

     

    1. those odt-files take a bit long for LibreOffice to open.

     

    2. When searching in those .odt files, the Terminal tells me: "Binary file".

     

    (I was searching with  grep -h foo * )

     

    What do you think?

     

     

    with best regards,

    Omar K N

    Stockholm, Sweden

  • VikingOSX Level 6 (15,868 points)

    You can convert them without a file extension. If you are using the LibreOffice command-line examples in the Terminal, you just specify the extension-less document as the last argument. The converted form may/may not appear with a proper document extension. If it doesn't, just add the correct extension in the Finder or Terminal.

     

    I just opened an AppleWorks WP document without an extension in LibreOffice without issue. As it was an AppleWorks 6 document, it also opened perfectly in Pages ’09 v4.3.

  • fosnola Level 1 (100 points)

    Hello,

    oktan wrote:

     

    BTW now doubts came up in my amateur mind as to whether adding an extension such as .odt by itself is equal to a conversion of the file into .odt?

     

    this only changes the file names, but the files' contents remain the same, ie. the files remain AppleWorks' files...

     

    Note:

    if you want to speed up the conversions, you can download mwawOSX.zip ( in https://sourceforge.net/projects/libmwaw/files/ ) and type something like (on a single line):

    ~/mwawOSX/bin/mwaw2odf ~/Cours/clarisWorks/v6/lesson.plans.digital.S1.cwk ~/Cours/clarisWorks/v6/lesson.plans.digital.S1.odt

    this will call directly the filter used by LibreOffice to convert ~/...lesson.plans.digital.S1.cwk in ~/...lesson.plans.digital.S1.odt ( if this is possible ).

  • oktan Level 1 (0 points)

    Thank you fosnola,

     

    This worked for me - for a specific file.

     

    But when I wanted to convert all cwk files in the folder I got this message:

     

    okns-imac:_MYFOLDER okn$ /Applications/Utilities/mwawOSX/bin/mwaw2odf *.cwk *.odt

    Usage: /Applications/Utilities/mwawOSX/bin/mwaw2odf [OPTION] <Mac Document> [file.odf]

              tries to convert a Mac Document in a odf file.

              If given the result is stored in file.odf,

              if not, the result is sent to stdout.

     

    Options:

              -h:                Shows this help message

              -v:                Output /Applications/Utilities/mwawOSX/bin/mwaw2odf version

              -x:                Only returns the extension type

     

    Note:

              you can find the list of recognized formats at

              http://sourceforge.net/p/libmwaw/wiki/Home/

              (at least the list of formats recognized by the lattest version of libmwaw)

    Any idea how do batch this?

     

     

    with best regards,

    Omar K N

    Stockholm, Sweden

  • oktan Level 1 (0 points)

    …however if batch conversion is not possible in the above case, then this (file by file) is good enough!

     

     

    /okn

  • fosnola Level 1 (100 points)

    Hello,

    yes, batch conversion is not implemented :-~ , but with a shell script, you can call it on each file that need to be converted :-)

  • HartfordDon Level 1 (0 points)

    Did it for me, too!