5.2 Win32

<..win32 openoffice..>
 <oo>
 %%% openoffice                                                     %
 .4oo if exist sxw-%%0.dir rmdir /Q /S sxw-%%0.dir
 .4oo mkdir sxw-%%0.dir
 .4os mkdir sxw-%%0.dir\Pictures
 .4os move  %%1.4os                  sxw-%%0.dir\settings.xml
 .4oo move  %%0.4oo                  sxw-%%0.dir\content.xml
 %
 .4om mkdir sxw-%%0.dir\%%1
 .4om move  %%1.4om                  sxw-%%0.dir\%%1\content.xml
 .4om copy  sxw-%%0.dir\settings.xml sxw-%%0.dir\%%1\settings.xml
 %
 .4of mkdir sxw-%%0.dir\META-INF
 .4of move  %%1.4of sxw-%%0.dir\META-INF\manifest.xml
 %
 .4ot move  %%1.4ot    sxw-%%0.dir\meta.xml
 .4oy move  %%1.4oy    sxw-%%0.dir\styles.xml
 .4og copy  %%1        sxw-%%0.dir\Pictures\%%1
 .4od cd    sxw-%%0.dir & zip -r -m  %%0.zip * & cd ..
 % .4od cd    sxw-%%0.dir & 7za a -y  %%0.zip * & cd ..
 .4od move sxw-%%0.dir\%%0.zip %%0.odt
 %
 .4od del %%1.4od
 .4od if exist sxw-%%0.dir rmdir /Q /S sxw-%%0.dir
 %%% end openoffice
 </oo>
 -_-_-

7za: http://sourceforge.net/projects/sevenzip/

Windows uses ampersand character ’&’ as command separator. There are also conditional separators ’&&’ (execute if previous command successful) and ’||’ (execute if previous command failed). It was added in NT so it’s not portable to win95(98).

<..win32 openoffice-DELETE..>
 %%% openoffice                                                     %
 .4oo mkdir sxw-%%0.dir
 .4os mkdir sxw-%%0.dir\Pictures
 .4os move  %%1.4os                  sxw-%%0.dir\settings.xml
 .4oo move  %%0.4oo                  sxw-%%0.dir\content.xml
 %
 .4om mkdir sxw-%%0.dir\%%1
 .4om move  %%1.4om                  sxw-%%0.dir\%%1\content.xml
 .4om copy  sxw-%%0.dir\settings.xml sxw-%%0.dir\%%1\settings.xml
 %
 .4of mkdir sxw-%%0.dir\META-INF
 .4of move  %%1.4of sxw-%%0.dir\META-INF\manifest.xml
 %
 .4ot move  %%1.4ot    sxw-%%0.dir\meta.xml
 .4oy move  %%1.4oy    sxw-%%0.dir\styles.xml
 .4og copy  %%1        sxw-%%0.dir\Pictures\%%1
 %-- sxw --
 .4ox cd    sxw-%%0.dir\
 .4ox cd    sxw-%%0.dir\META-INF
 .4ox zip   sxw-%%0.dir\%%0.sxw        sxw-%%0.dir\META-INF\*.*
 .4ox cd    ..
 .4ox cd    sxw-%%0.dir\Pictures
 .4ox zip   sxw-%%0.dir\%%0.sxw        sxw-%%0.dir\Pictures
 .4ox cd ..
 .4ox zip -j sxw-%%0.dir\%%0.sxw       sxw-%%0.dir\*
 .4ox cd ..
 %
 .4ox move sxw-%%0.dir\%%0.sxw .
 %
 .4ox del %%1.4ox
 .4ox echo y | del sxw-%%0.dir\Pictures\*.*
 .4ox rd sxw-%%0.dir\Pictures
 .4ox echo y | del sxw-%%0.dir\META-INF\*.*
 .4ox rd sxw-%%0.dir\META-INF
 .4ox echo y | del sxw-%%0.dir\*.*
 .4ox rd /S sxw-%%0.dir
 %-- odt --
 .4od cd    sxw-%%0.dir\
 .4od cd    sxw-%%0.dir\META-INF
 .4od zip   sxw-%%0.dir\%%0.odt        sxw-%%0.dir\META-INF\*.*
 .4od cd    ..
 .4od cd    sxw-%%0.dir\Pictures
 .4od zip   sxw-%%0.dir\%%0.odt        sxw-%%0.dir\Pictures
 .4od cd ..
 .4od zip -j sxw-%%0.dir\%%0.odt       sxw-%%0.dir\*
 .4od cd ..
 %
 .4od move sxw-%%0.dir\%%0.odt .
 %
 .4od del %%1.4od
 .4od echo y | del sxw-%%0.dir\Pictures\*.*
 .4od rd sxw-%%0.dir\Pictures
 .4od echo y | del sxw-%%0.dir\META-INF\*.*
 .4od rd sxw-%%0.dir\META-INF
 .4od echo y | del sxw-%%0.dir\*.*
 .4od rd sxw-%%0.dir
 % (1) if  ’echo y | del ...’  does not work try  ’del /Q ...’  instead
 % (2) if rd fails to do the job, try replacing ’rd’ with ’rd /s /q’
 %%% end openoffice                                                  %
 </oo>
 -_-_-

t.m.trzeciak (Tolmek):

’rd’ won’t remove non-empty directory. It should be:  
rd /s /q sxw-test-tex4ht.dir

Contributed by Hans-Peter Kohler:

<..win32 openofficeDELETE..>
 %
 % Activate the following non-concurent sub script, if the previous
 % one does not work. That is, interchange <oo> with <oo-alt>
 % and </oo> with </oo-alt>.
 %
 <oo-alt>
 %%% openoffice                                                     %
 .4os mkdir Pictures
 .4os move  %%1.4os settings.xml
 .4oo move  %%0.4oo content.xml
 %
 .4om mkdir %%1
 .4om move  %%1.4om      %%1\content.xml
 .4om copy  settings.xml %%1\settings.xml
 %
 .4of mkdir META-INF
 .4of move  %%1.4of META-INF\manifest.xml
 %
 .4ot move  %%1.4ot    meta.xml
 .4oy move  %%1.4oy    styles.xml
 .4og copy  %%1        Pictures\%%1
 %-- sxw ---
 .4ox zip -m %%0.sxw Pictures
 .4ox zip -m %%0.sxw settings.xml
 .4ox zip -m %%0.sxw content.xml
 .4ox zip -m -r %%0.sxw %%0-m*
 .4ox zip -m -r %%0.sxw META-INF
 .4ox zip -m %%0.sxw meta.xml
 .4ox zip -m %%0.sxw styles.xml
 .4ox zip -m -r %%0.sxw Pictures/*
 %-- odt ---
 .4od zip -m %%0.odt Pictures
 .4od zip -m %%0.odt settings.xml
 .4od zip -m %%0.odt content.xml
 .4od zip -m -r %%0.odt %%0-m*
 .4od zip -m -r %%0.odt META-INF
 .4od zip -m %%0.odt meta.xml
 .4od zip -m %%0.odt styles.xml
 .4od zip -m -r %%0.odt Pictures/*
 %%% end openoffice                                                  %
 </oo-alt>
 -_-_-

Contributed: Andrzej Orowski-Skoczyk; Modified: Wilfried Hennings:

<..win32 openofficeDELETE..>+
 <oo-alt-2>
 %%% openoffice                                                     %
 .4os mkdir sxw-%%0.dir
 .4os mkdir Pictures
 .4os move  %%1.4os                  sxw-%%0.dir\settings.xml
 .4os move  %%0.4oo                  sxw-%%0.dir\content.xml
 %
 .4om mkdir %%1
 .4om move  %%1.4om                  %%1\content.xml
 .4om copy  sxw-%%0.dir\settings.xml %%1\settings.xml
 .4om zip  %%0.zip       %%1\*
 .4om del /Q %%1\*
 .4om rmdir %%1
 %
 .4of mkdir META-INF
 .4of move  %%1.4of META-INF\manifest.xml
 %
 .4ot move  %%1.4ot    sxw-%%0.dir\meta.xml
 .4oy move  %%1.4oy    sxw-%%0.dir\styles.xml
 .4og copy  %%1        Pictures\%%1
 %-- sxw --
 .4ox move %%0.zip %%0.sxw
 .4ox zip   %%0.sxw        META-INF\*.*
 .4ox zip   %%0.sxw        Pictures
 .4ox zip -j %%0.sxw       sxw-%%0.dir\*
 %
 .4ox del %%1.4ox
 .4ox del /Q Pictures\*.*
 .4ox rd Pictures
 .4ox del /Q META-INF\*.*
 .4ox rd META-INF
 .4ox del /Q sxw-%%0.dir\*.*
 .4ox rd /S sxw-%%0.dir
 .4ox del /Q *.tmp
 %-- odt --
 .4od move %%0.zip %%0.odt
 .4od zip %%0.odt       META-INF\*.*
 .4od zip %%0.odt       Pictures
 .4od zip -j %%0.odt    sxw-%%0.dir\*
 %
 .4od del %%1.4od
 .4od del /Q Pictures\*.*
 .4od rd Pictures
 .4od del /Q META-INF\*.*
 .4od rd META-INF
 .4od del /Q sxw-%%0.dir\*.*
 .4od rd sxw-%%0.dir
 .4od del /Q *.tmp
 % if rd fails to do the job, try replacing ’rd’ with ’rd /s /q’
 %%% end openoffice
 </oo-alt-2>
 -_-_-

<..win32 openoffice-AndrzejDELETE..>
 <oo-alt-2>
 %%% openoffice                                                     %
 .4os mkdir sxw-%%0.dir
 .4os mkdir Pictures
 .4os move  %%1.4os                  sxw-%%0.dir\settings.xml
 .4os move  %%0.4oo                  sxw-%%0.dir\content.xml
 %
 .4om mkdir %%1
 .4om move  %%1.4om                  %%1\content.xml
 .4om copy  sxw-%%0.dir\settings.xml %%1\settings.xml
 %
 .4of mkdir META-INF
 .4of move  %%1.4of META-INF\manifest.xml
 %
 .4ot move  %%1.4ot    sxw-%%0.dir\meta.xml
 .4oy move  %%1.4oy    sxw-%%0.dir\styles.xml
 .4og copy  %%1        Pictures\%%1
 %-- sxw --
 .4ox zip   %%0.sxw        META-INF\*.*
 .4ox zip   %%0.sxw        Pictures
 .4ox zip -j %%0.sxw       sxw-%%0.dir\*
 %
 .4ox del %%1.4ox
 .4ox del /Q Pictures\*.*
 .4ox rd Pictures
 .4ox del /Q META-INF\*.*
 .4ox rd META-INF
 .4ox del /Q sxw-%%0.dir\*.*
 .4ox rd /S sxw-%%0.dir
 %-- odt --
 .4od zip %%0.odt       META-INF\*.*
 .4od zip %%0.odt       Pictures
 .4od zip -j %%0.odt    sxw-%%0.dir\*
 %
 .4od del %%1.4od
 .4od del /Q Pictures\*.*
 .4od rd Pictures
 .4od del /Q META-INF\*.*
 .4od rd META-INF
 .4od del /Q sxw-%%0.dir\*.*
 .4od rd sxw-%%0.dir
 % if rd fails to do the job, try replacing ’rd’ with ’rd /s /q’
 %%% end openoffice
 </oo-alt-2>
 -_-_-

Contributed by Andreas Gobel:

<..win32 openoffice..>+
 %
 % Platforms (e.g.,  cygwin) with cp and mv utilities of
 % http://www.mingw.org/msys.shtml may use the following script.
 % It is capable of moving pictures from subdirectories required,
 % for instance, by \includegraphics{bitmaps/test.eps}
 %
 <oo-msys>
 %%% openoffice                                                     %
 .4os mkdir Pictures
 .4os mv  %%1.4os settings.xml
 .4oo mv  %%0.4oo content.xml
 %
 .4om mkdir %%1
 .4om mv  %%1.4om      %%1\content.xml
 .4om cp  settings.xml %%1\settings.xml
 %
 .4of mkdir META-INF
 .4of mv  %%1.4of META-INF\manifest.xml
 %
 .4ot mv  %%1.4ot    meta.xml
 .4oy mv  %%1.4oy    styles.xml
 .4og cp  --parents %%1        Pictures
 %-- sxw --
 .4ox zip  %%0.sxw Pictures
 .4ox zip  %%0.sxw settings.xml
 .4ox zip  %%0.sxw content.xml
 .4ox zip  -r %%0.sxw %%0-m*
 .4ox zip  -r %%0.sxw META-INF
 .4ox zip  %%0.sxw meta.xml
 .4ox zip  %%0.sxw styles.xml
 .4ox zip  -r %%0.sxw Pictures/*
 %-- odt --
 .4od zip  %%0.odt Pictures
 .4od zip  %%0.odt settings.xml
 .4od zip  %%0.odt content.xml
 .4od zip  -r %%0.odt %%0-m*
 .4od zip  -r %%0.odt META-INF
 .4od zip  %%0.odt meta.xml
 .4od zip  %%0.odt styles.xml
 .4od zip  -r %%0.odt Pictures/*
 %
 %%% end openoffice                                          %
 </oo-msys>
 -_-_-