zip/unzip jar archive or add/remove file using a Basic macro?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

zip/unzip jar archive or add/remove file using a Basic macro?

Regina Henschel
Hi all,

I want to write a Basic macro to preview an .xhp file while editing it.
Viewing such file works fine with LoadComponentFromUrl with protocol
"vnd.sun.star.help", if the file is inside a .jar container.

But how can I modify or create or zip/unzip the content of such
container using a Basic macro? A SimpleFileAccess sees it only as file,
not as folder.

Kind regards
Regina

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: zip/unzip jar archive or add/remove file using a Basic macro?

Jörg Schmidt-2
Hello Regina,

> From: Regina Henschel [mailto:[hidden email]]

> I want to write a Basic macro to preview an .xhp file while
> editing it.
> Viewing such file works fine with LoadComponentFromUrl with protocol
> "vnd.sun.star.help", if the file is inside a .jar container.
>
> But how can I modify or create or zip/unzip the content of such
> container using a Basic macro? A SimpleFileAccess sees it
> only as file,
> not as folder.

You mean sure the error occurs at line "ooo_zipper.initialize(args())" in the sample code:

'...
ooo_zipper = createUnoService("com.sun.star.packages.Package")
Dim args(0) As Variant
args(0) = ConvertToURL("D:\sample.jar")
ooo_zipper.initialize(args())
'...

In this case, I know no solution. I would use a command line tool, which you can also put together with your Basic macro in an extension if necessary. for example http://www.info-zip.org/Info-ZIP.html

Ok, this solution is operating system dependent, but I know no better.



Greetings,
Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: zip/unzip jar archive or add/remove file using a Basic macro?

Bernard Marcelly
In reply to this post by Regina Henschel
Hi Regina,

You have to use the service com.sun.star.packages.Package

Examples
Reading a text file from a zip :
   <https://forum.openoffice.org/en/forum/viewtopic.php?f=45&t=9574#p45086>
Writing a zip file :
   in BasicAddonBuilder, see Basic module "zip"

Regards
   Bernard

Regina Henschel a écrit le 2015-10-11 20:31 :

> Hi all,
>
> I want to write a Basic macro to preview an .xhp file while editing it. Viewing
> such file works fine with LoadComponentFromUrl with protocol
> "vnd.sun.star.help", if the file is inside a .jar container.
>
> But how can I modify or create or zip/unzip the content of such container using
> a Basic macro? A SimpleFileAccess sees it only as file, not as folder.
>
> Kind regards
> Regina
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: zip/unzip jar archive or add/remove file using a Basic macro?

Regina Henschel
Hi Bernard,

thank you for the hint to the BasicAddonBuilder. My first tries with
service com.sun.star.packages.Package failed. I will try it again with
using the macros in BasicAddonBuilder as template.

Kind regards
Regina

Bernard Marcelly schrieb:

> Hi Regina,
>
> You have to use the service com.sun.star.packages.Package
>
> Examples
> Reading a text file from a zip :
>    <https://forum.openoffice.org/en/forum/viewtopic.php?f=45&t=9574#p45086>
> Writing a zip file :
>    in BasicAddonBuilder, see Basic module "zip"
>
> Regards
>    Bernard
>
> Regina Henschel a écrit le 2015-10-11 20:31 :
>> Hi all,
>>
>> I want to write a Basic macro to preview an .xhp file while editing
>> it. Viewing
>> such file works fine with LoadComponentFromUrl with protocol
>> "vnd.sun.star.help", if the file is inside a .jar container.
>>
>> But how can I modify or create or zip/unzip the content of such
>> container using
>> a Basic macro? A SimpleFileAccess sees it only as file, not as folder.
>>
>> Kind regards
>> Regina
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: zip/unzip jar archive or add/remove file using a Basic macro?

Regina Henschel
Hi all,

with all your hints I make some steps forward. You will find adaptions
from the BasicAddonBuilder :)  I have put the resulting macro as
attachment to https://bugs.documentfoundation.org/show_bug.cgi?id=95064

The macro is not directly usable with AOO but only with LibreOffice. It
is not only that the help folder is named "en" in AOO and "en-US" in
LibreOffice. There seems to be different locking rules in addition.

In LibreOffice some efforts were made to get the helpauthoring-tool work
again, to make generating and editing of help-files easier. The goal of
the macro is to get a preview of the current help file, while editing
the file. If someone knows a very different way for this goal, please
tell me.

The macro shows the .xhp file which is currently edited as preview in
Writer/Web or help window.
I have made the preview by putting the .xhp-document in a container
temp.jar in the installed help folder en-US. Then a call with
"vnd.sun.star.help://temp/" will apply the transformation to HTML and
show the result in Writer/Web.

But a major problem is, that this view cannot be updated until
LibreOffice is totally closed. The file temp.jar is someway locked after
the first use. Only after closing LibreOffice totally and restarting,
the file can be used again.

If anyone has an idea what locks the file and how I can unlock it while
LibreOffice (or AOO) is running, or at least how to make the help aware,
that the file in the container was updated, then please tell me.

Unfortunately the macro is still not ready for productive use in its
current state. So I need further help.

Kind regards
Regina



Regina Henschel schrieb:

> Hi Bernard,
>
> thank you for the hint to the BasicAddonBuilder. My first tries with
> service com.sun.star.packages.Package failed. I will try it again with
> using the macros in BasicAddonBuilder as template.
>
> Kind regards
> Regina
>
> Bernard Marcelly schrieb:
>> Hi Regina,
>>
>> You have to use the service com.sun.star.packages.Package
>>
>> Examples
>> Reading a text file from a zip :
>>
>> <https://forum.openoffice.org/en/forum/viewtopic.php?f=45&t=9574#p45086>
>> Writing a zip file :
>>    in BasicAddonBuilder, see Basic module "zip"
>>
>> Regards
>>    Bernard
>>
>> Regina Henschel a écrit le 2015-10-11 20:31 :
>>> Hi all,
>>>
>>> I want to write a Basic macro to preview an .xhp file while editing
>>> it. Viewing
>>> such file works fine with LoadComponentFromUrl with protocol
>>> "vnd.sun.star.help", if the file is inside a .jar container.
>>>
>>> But how can I modify or create or zip/unzip the content of such
>>> container using
>>> a Basic macro? A SimpleFileAccess sees it only as file, not as folder.
>>>
>>> Kind regards
>>> Regina
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]