Chameleon skin |
|||||
| home » Chameleon skin » Tutorials » Console Mode Tutorials Using Console Mode With Chameleon JAlbum can be controlled from the command line (known as Console Mode), and generally accepts the same parameters that you are able to set through the graphical user interface (GUI). There is a lot of Console Mode information readily available on the JAlbum website (see http://jalbum.net/consolemode.jsp , which gives the list of allowed parameters and their defaults) and JAlbum Forum (for examples, see Automatically process sub-Projects and Making a multi-skin album in one pass). Note that the command line and GUI do not exactly mirror each other, and that there are some oddities to be aware of (ie the "Ignore Pattern" is one). User-defined variables are passed as -user.yourVariable "Value", while skin-defined variables have a -skin prefix. The Console Mode is great for automated album generation and updates. Webmasters can even make scripts that call JAlbum regularly to update server albums etc. However, this and following tutorials are primarily aimed at conventional albums created with the Chameleon skin. A convenient and traditional way of using Console Mode is by putting the relevant code in a batch file, a plain text file with the .bat or preferably .cmd extension (the latter runs in native mode which is faster), which is easily created using Notepad, for example. This code executes JAlbum, using the parameters set within the GUI, which are themselves then stored in the relevant project ( .jap ) file. A simple batch file may just call a single, standard .jap project, and running it is the same as executing the project from within JAlbum. All the relevant information required to build the album is contained within the .jap file, ie Image and Output directories, Image Bounds etc. The only batch file code really required to process an album is therefore: java -Xmx400M -jar "C:\Program Files\JAlbum\JAlbum.jar" -projectFile "xxx.jap" The key elements are:
As no other values are specified, all the settings set in the GUI and stored in the associated .jap file are processed. One very important point; use the command line parameter "-appendImages" when you would use "Make Changes", leave it out when you would use "Make All". Moving on from this simple case, and noting that generally command line parameters entered in the .bat/.cmd file take precedence over the .jap file, the full power of batch files can be explored. For instance, a single .jap project can be created and called many times, each with a few tweaks to achieve the overall, desired effect. Thus, to control the Index Page layout for example, one may use: java -Xmx400M -jar "C:\Program Files\JAlbum\JAlbum.jar" -projectFile "xxx.jap" Here, line 1 executes the xxx.jap project file. Line 2 then repeats the process, but this time the parameters -subdirs false -thumbSize 120x120 -cols 6 would ensure that, respectively, subdirectories are not processed, the Image Bounds/Thumbnails are set at 120x120, and the Thumbnail layout/columns is set to 6. Again, one is pointed to http://jalbum.net/consolemode.jsp, which gives the list of allowed parameters and their defaults. It quickly becomes apparent that the possibilities are almost limitless. Some albums may have a number of project files to produce the desired, overall effect; each subfolder, for instance, may use a different sub-style of a particular skin. In this case, create a single .jap file based on the skin and its default sub-style, and use the -skin.subStyle parameter accordingly. There are many other applications which greatly benefit or are only practical by using batch files:
Other Console Mode/batch file advantages that are less obvious include:
Project files are not simply transferable from one location to another, in that the Image and Output directories are effectively hard-coded in. So at home a drive is "D", at work it's "K". Keep 2 copies of a batch files (a simple edit/replace changes the drive letter in one go) and run the appropriate batch file for the relevant drive. (By Mark Worthington) |
|
||||