3.1 Activating the plugin

There are two ways of using this plugin: You can either activate the plugin globally by setting the InstallAdapter tag to True when @REQUIRE-ing it. To do this, simply put the following preprocessor command at the top of your script:

 
@REQUIRE "zip", {InstallAdapter = True}

If you activate the plugin via @REQUIRE, it will become globally available and all ensuing commands that deal with files will support the opening of files from zip archive sources. For example, you could do something like this then:

 
LoadBrush(1, "test.zip/testpicture.jpg")

If you only need to open very few files from zip archive sources, you can also choose to not activate the plugin globally by omitting the InstallAdapter tag on @REQUIRE and simply use the Adapter tag offered by most Hollywood commands to tell the respective Hollywood command to open the file using the zip.hwp plugin. Here is an example:

 
LoadBrush(1, "test.zip/testpicture.jpg", {Adapter = "zip"})

By using the Adapter tag, LoadBrush() is told to open the specified file using the specified adapter, which is "zip" in our case. Thus, the Adapter tag allows you to use this plugin even without having installed a global file adapter for it first.

The same is true for Hollywood functions dealing with directories. Once the zip plugin has been activated by setting InstallAdapter to True, it is possible to do things like the following:

 
OpenDirectory(1, "test.zip")

You could then iterate over all files and directories in test.zip. If you haven't activated the global adapter for zip.hwp, then just use the local Adapter like above, e.g.

 
OpenDirectory(1, "test.zip", {Adapter = "zip"})

See the next chapter for more details on treating zip archives as directories.


Show TOC