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 "xad", {InstallAdapter = True} |
If you activate the plugin in this way, it will become globally available and all ensuing commands that deal with files will support the opening of files from XAD archive sources. For example, you could do something like this then:
LoadBrush(1, "test.rar/testpicture.jpg") |
If you only need to open very few files from XAD 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 xad.hwp plugin. Here is an example:
LoadBrush(1, "test.rar/testpicture.jpg", {Adapter = "xad"}) |
By using the Adapter
tag, LoadBrush()
is told to open the specified file using
the specified adapter, which is "xad" 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 XAD plugin has been activated, it is possible to do things like the following:
OpenDirectory(1, "test.rar") |
You could then iterate over all files and directories in test.rar
. If you haven't
activated a global adapter for xad.hwp, then just use the Adapter
like above, e.g.
OpenDirectory(1, "test.rar", {Adapter = "xad"}) |
See the next chapter for more details on treating archives supported by the XAD system as directories.