WebAlbumWizard scripting language 
Quick documentation

	INDEX

		1 - INTRODUCTION
		2 - SKIN FILE STRUCTURE
		3 - SYNTAX
		4 - COMMANDS REFERENCE
			4.1  DECLARE_INT / DECLARE_COLOR / DECLARE_STRING
			4.2  CREATE_FILE
			4.3  WRITE_FILE
			4.4  CLOSE_FILE
			4.5  FOR_EACH_IMAGE / FOR_EACH_MOVIE / FOR_EACH_DIR
			4.6  END_FOR
			4.7  ADD
			4.8  SET
			4.9  IF / ELSE / ENDIF
			4.10 CREATE_DIR
			4.11 COPY_FROM_SKIN

	1 - INTRODUCTION

		This guide will explain you the basics of WebAlbumWizard scripting language. There is a very little set of instruction available, if you need more for your scripts, send me the description of what you need, i may implement it for next releases.

	2 - SKIN FILE STRUCTURE

		WebAlbumWizard scans it's "Skins" folder for folders, each folder is potentialy a skin. You can put all the files you want in your skin folder, but two files are necessary. Main.pgs and MainLoop.pgs are the two script files needed by the skins. First (Main.pgs) is executed once for each album generation, usualy, you can create resources in this script. The second, MainLoop.pgs, will be called for each sub directory found during album generation, and is usualy used for html file creation.
You can also add a file named "Varhelp.rtf" which is a rtf file giving help on the variables declared as public in your script. 

	3 - SYNTAX

		The script parser is rather simple, it expects a command on the begining of a line (you can use spaces and tabs first), then each command uses differents parameters. A command line ends with a return.
To use variable content in an expression, you have to use the variable name between { and }. This behaviour will be explained in all the commands that support it. If you have parameters containing spaces, you have to put it between quotes. 
You can add comments using // in place of the command.
You can insert line break in your commands by using \n
Special characters are :
•	\
•	"
•	{
•	}

If you want to use theses special characters in a command (like WRITE_FILE) you have to use a backslash before. like : WRITE_FILE "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\">\n"  Note how \" is used to make WAW put the " in the file. Please also note the \n at the end of the WRITE_FILE command to insert the line break in the destination file.

Extended use of variable access:
To access the content of a variable named MyVar, you just have to put it between {}. Exemple :
WRITE_FILE "bla bla bla {MyVar} bla bla"
This will write the parameter to the file, replacing {MyVar} with the contents of MyVar. You can add formating parameters to the {} by using this syntax :
WRITE_FILE "bla bla bla {MyVar,<params>} bla bla"
Parameters are :
	For STRING variables : the param specifies how many characters you want from the string.
	For INT / COLOR variables : the parameter is a format string, like in C/C++. Default format for INT is %d (will display content as an integer). Default format for COLOR is %06x (will display content as a 6 characters hexadeciamal number like 5a6f7c).

	4 - COMMANDS REFERENCE

4.1 _________________________________
DECLARE_INT <private|public> <VarName> <default>
DECLARE_COLOR <private|public> <VarName> <default>
DECLARE_STRING <private|public> <VarName> <default>

Description
These commands are used to declare new variables for use in your script. You can create integer variables with DECLARE_INT, color variables with DECLARE_COLOR, and litteral variables with DECLARE_STRING. 

Parameters
<private|public>	: Using public tag will make your varable ajustable by the user in the automatically created variable window.
<VarName>		: Your variable name
<default>		: Default initialization value

Remarks
All the parameters are required. For default initialization, you *CANNOT* use {} to access another variable contents, this may be implemented later.

4.2 _________________________________
CREATE_FILE "<filename>"

Description
This command creates a new file. If the specified file already exists, the existing file is replaced with a new one. You must you the quotes for this command.

Parameters
<filename>	: The desired filename, relative to current directory. For Main.pgs the filename is relative to the root.

Remarks
You can open only one file at once. This may change in the future.
You must you the quotes for this command.

4.3 _________________________________
WRITE_FILE "<data>"

Description
This command is used to write data in the current open file.

Parameters
<data>		: the data you want to write in the file.

Remarks
If no file is opened, this function will fail.

Usage Exemple
WRITE_FILE "font-family: {Font};\n"

4.4 _________________________________
CLOSE_FILE

Description
This command closes the currently opened file.

Parameters
None.

Remarks
If no file is opened, this function will fail.

4.5 _________________________________
FOR_EACH_IMAGE
FOR_EACH_MOVIE
FOR_EACH_DIR

Description
Theses commands are used to process all entries of a specific type. FOR_EACH_IMAGE is used for pictures, FOR_EACH_MOVIE for all movies, and FOR_EACH_DIR for each sub directories. Theses commands must have their corresponding END_FOR. 

Parameters
None.

Remarks
Each commands create it's specific variable to hold current loop informations :
- FOR_EACH_IMAGE creates :
	ImageName			- The name of the picture (filename)
	PrevImageName		- Name of the previous picture in the list (empty if none)
	NextImageName		- Name of the next picture in the list (empty if none)
	ImageComment		- Associated comment with the file.
- FOR_EACH_MOVIE creates :
	MovieName			- The name of the current movie (filename)
	MovieComment		- Associated comment with the file.
- FOR_EACH_DIR creates :
	SubDirectoryName		- Name of subdirectory found.
	SubDirectoryComment		- Associated comment of the directory.
	
Usage Exemple
FOR_EACH_DIR
	WRITE_FILE "{SubDirectoryName}"
END_FOR

4.6 _________________________________
END_FOR

Description
Used to close a FOR_EACH loop.

Parameters
None.

Remarks
If a FOR_EACH isn't opened, this command will fail.

4.7 _________________________________
ADD <VariableName> <Value>

Description
This command adds a value to a variable.

Parameters
<VariableName>	: The destination variable name.
<Value>		: Value to add. Can be the content of another variable using the {} form.

Remarks
You can only add to numeric type variables (INT & COLOR)

Usage Exemple
ADD nImgWidth 6

4.8 _________________________________
SET <VariableName> <Value>

Description
This commands sets the value of a variable.

Parameters
<VariableName>	: The destination variable name.
<Value>		: Value to set. Can be the content of another variable using the {} form.

Remarks
You can only set numeric variables (INT & COLOR)

Usage Exemple
SET nImgWidth {ThumbWidth}

4.9 _________________________________
IF <expression1> <operator> <expression2>
ELSE
ENDIF

Description
Logical test. If expression evaluation is true, the code between IF and ELSE or ENDIF is no matching ELSE is found, is executed. If evaluation is false, the code between ELSE ans ENDIF is executed (if a ELSE section exists).

Parameters
<expression1>		: First expression, can be a variable or a numeric.
<operator>		: Operator, can be one of : 
						< 	true if exp1 is inferior to exp2
						> 	true if exp1 is superior to exp2
						= 	true if exp1 is equals to exp2
						!=	true if exp1 is different from exp2
<expression2>	: Second expression, can be a variable or a numeric.

Remarks
If you try a test on a string with a number, like : 
IF MyString > 0
WAW will use the string size for the test. So the previous line will check that MyString is not empty.

4.10 _________________________________
CREATE_DIR "<directoryName>"

Description
Creates a directory at the specified path. Path is relative to current execution context. If executed within Main.pgs, the path is the root path, otherwise, the path is the current folder path.

Parameters
<directoryName>		: name of directory to create.

Remarks
This command is NOT recursive, it means that it can only create a directory at once. Exemple :
CREATE_DIR "resources\\test"
If the folder resources doesn't exist, the function will fail because it will be unable to create test folder.

4.11 _________________________________
COPY_FROM_SKIN <source> <destination>

Description
Copy a file from the skin directory to specified path.

Parameters
<source>	: Source file name, relative to Skin folder.
<destination>	: Full destination filename, relative to the execution context.

Remarks
COPY_FROM_SKIN does *NOT* create output folder if it doesn't exists. You have to create it using CREATE_DIR.

Exemple
COPY_FROM_SKIN "movie.gif" "resources\\movie.gif"

5 - DEFAULT VARIABLES

This section describes the variables internally created by WebAlbumGenerator engine. You can use theses in your scripts. The two following section describes the general purpose variables, and the EXIF related variables. EXIF variables are only generated if the user enabled it in the project option window.

5.1 _GENERAL VARIABLES____________________

CurrentDirectoryName:	STRING ; Valid within MainLoop.pgs script only. Contains the current directory name.
CurrentDirectoryComment:	STRING ; Valid within MainLoop.pgs script only. Contains the current directory comment.
ImageName:			STRING ; Valid within FOR_EACH_IMAGE only. Contains the current image name (filename with extension), this value is updated by the FOR itself.
PrevImageName:		STRING ; Valid within FOR_EACH_IMAGE only. Contains the previous image name (filename with extension, empty if no previous), this value is updated by the FOR itself.
NextImageName:		STRING ; Valid within FOR_EACH_IMAGE only. Contains the next image name (filename with extension, empty if no next), this value is updated by the FOR itself.
ImageComment:		STRING ; Valid within FOR_EACH_IMAGE only. Contains the current image comment, this value is updated by the FOR itself.
MovieName:			STRING ; Valid within FOR_EACH_MOVIE only. Contains the current movie name, this value is updated by the FOR itself.
MovieComment:		STRING ; Valid within FOR_EACH_MOVIE only. Contains the current movie comment, this value is updated by the FOR itself.
SubDirectoryName:		STRING ; Valid within FOR_EACH_DIR only. Contains the current sub-directory name, this value is updated by the FOR itself.
SubDirectoryComment:	STRING ; Valid within FOR_EACH_DIR only. Contains the current sub-directory comment, this value is updated by the FOR itself.
RootPath:			STRING ; Valid within MainLoop.pgs script only. Contains a relative path to the root folder in the form ../../ 
ThumbWidth:			INT ; Always valid. Indicates the size set by the user for the thumbnail width.
ThumbHeight:		INT ; Always valid. Indicates the size set by the user for the thumbnail height.
DirThumbWidth:		INT ; Always valid. Indicates the size set by the user for the directory thumbnail width (total thumbnail size)
DirThumbHeight:		INT ; Always valid. Indicates the size set by the user for the directory thumbnail height (total thumbnail size)
IntermediateImg:		INT ; Always valid. This variable is different from 0 when user requested Intermediate Images generation.
ParseExif:			INT ; Always valid. This variable is different from 0 when user requested EXIF data.
IsRoot:			INT ; Always valid. This variable is different from 0 when current directory is the root directory.
SrcImagesAvailable:		INT ; Always valid. This variable is different from 0 when sources images are available (when copy sources images is checked when using a destination directory, or when you don't use a destination directory)

5.2 _EXIF VARIABLES____________________

All variables here are STRING form. Some are already type formated, some are probably badly supported, send me an email if you want to enhance some.

Exif_ImageDescription
Exif_Make
Exif_Model
Exif_Orientation
Exif_XResolution
Exif_YResolution
Exif_ResolutionUnit
Exif_Software
Exif_DateTime
Exif_WhitePoint
Exif_PrimaryChromaticies
Exif_YCbRbCoefficients
Exif_YCbRbPositioning
Exif_ReferenceBlackWhite
Exif_Copyright
Exif_ExposureTime
Exif_FNumber
Exif_ExposureProgram
Exif_IsoSpeedRatings
Exif_ExifVersion
Exif_DateTimeOriginal
Exif_DateTimeDigitized
Exif_ComponentsConfiguration
Exif_CompressedBitsPerPixel
Exif_ShutterSpeedValue
Exif_ApertureValue
Exif_BrightnessValue
Exif_ExposureBiasValue
Exif_MaxApertureValue
Exif_SubjectDistance
Exif_MeteringMode
Exif_LightSource
Exif_Flash
Exif_FocalLength
Exif_UserComment
Exif_SubSecTime
Exif_SubSecTimeOriginal
Exif_SubSecTimeDigitized
Exif_FlashPixVersion
Exif_ColorSpace
Exif_ExifImageWidth
Exif_ExifImageHeight
Exif_RelatedSoundFile
Exif_FocalPlaneXResolution
Exif_FocalPlaneYResolution
Exif_FocalPlaneResolutionUnit
Exif_ExposureIndex
Exif_SensingMethod
Exif_FileSource
Exif_SceneType
Exif_CFAPattern
Exif_CustomRendered
Exif_ExposureMode
Exif_WhiteBalance
Exif_DigitalZoomRatio
Exif_FocalLengthIn35mmFilm
Exif_SceneCaptureType
Exif_GainControl
Exif_Contrast
Exif_Saturation
Exif_Sharpness
Exif_DeviceSettingDescription
Exif_SubjectDistanceRange
Exif_ImageUniqueID
Exif_Gamma