// This is the install script. You can edit it while the test window is opened,
// an the test window will be update while you're writing
//
// Create:
// A list of elements shown for setup components
//
// the amount of spaces before the '<element>' will define the left border of
// the '<element>'
//
// available elements:
// -------------------
// check <flag>
//     displays an check element; flag 1 sets bold, flag 2 sets checked;
//     flag 3 (1+2) sets bold AND checked
//
// !!! Not yet working: !!!
// icon <filename>
//     displays a 16x16 icon (must be converted as v6i)
//     the icon does not go to the next line.
//     Use an intended elements to be displayed next to the icon,
//     or use the break command to manually advance
//     use 'setup\icon.v6p' to use the same icon as defined as default setup
//     icon
//
// label [<flag>]
//     flag 1 sets bold font
//
// !!! Still looking like an option element
// option <flag>
//     displays an option element; flag 1 sets bold, flag 2 sets checked;
//     flag 3 (1+2) sets bold AND checked
//
// combo <count>,<default>
//     displayes an dropdown element;
//     the dropdown list will have <count> items;
//     the <default> flag sets the item to be selected on startup
//
// !!! Experimantal / not surely included in all versions
// button <id>,<max>
//     displayes a button;
//     by default, the button width is <totalwidth(*)>
//     by specifing then <id>/<max> value, you define that multiple (<max>)
//       buttons are to be displayed at the current position, and this is the
//       <id> of <max> buttons; <id> can range from 1 to <max>
//       this does not really create multiple buttons, but align/size your
//       button that when using all IDs, your #<max> buttons together fit then
//       <totalwidth(*)> (with spaces, of course). Not using a button-ID, the
//       place will be left empty
//       
//       To simplify code and code size, only creating the button with ID 1 will
//       not jump to the next line. If you don't use the button ID 1, use
//       'break 3' before defining your first used button to manually jump to
//       the next line
//       
//       *: <totalwidth> is the space from the left of your button (button 1) to
//       the right border (minus some space)
// 
// Other commands:
// ---------------
// break <1/2 lines>
//     spaces x/2 lines for next element(s)
// lpos <line>
//     defines new line as x/2 where following elements will be created
// strjump <position>
//     set current string id (starting with 1 by default, automatically
//     increases with each element)

[Create]
// Icon myapp.v6i  // Display an icon (not yet included)
Label 1            // Display a text next to the icon
  Check 2          // Display a checkbox, which is checked
                   // This element gets ID 1
                   // We use the checkbox instead of the option element, because
                   // it fits better than an option (both look currently the
                   // same but in future releases, the option element will look
                   // different) and for demonstation events

// Events:
// -------
// When a user changes components/..., an event occurs:
//   [Event_<ElementID>_<Value>]
// Events occur for option, check and select only
// See the Test component / installation script menu to see which ID your
// element has
// <Values>
//   check elements:
//       0   user has unchecked
//       1   user has checked
//   option elements:
//           the option element has only one event, (1), '<Value>' must not
//           be specified
//   combo elements:
//           the combo element has as many events as items, starting with 1
//   button elements
//           the button element has only one event, (1), '<Value>' must not
//           be specified
//
// Commands within events:
// -----------------------
// Please note that dropdown elements cannot (yet) be modified.
//
// Add    <expression>    selects specified item(s)
// Clear [<expression>]   deselects all items except those specified
// Fill  [<expression>]   selects all items except those specified
// Rem    <expression>    deselects specified item(s)
//    <expression> is a list of element IDs, or a single element ID (for clear/
//    fill command optional)
// Set    <ID>,<Index>    selects the current item in a combobox
//
// Within this short demoscript, we'll have nothing to do, except ensure our
// checkbox cannot be unselected
//

[Event_1_0]  // user unchecks our checkbox
Add 1        // We re-check it
// A standard checkbox element could be unchecked. When this occures, we check
// it again, because the program should always be installed.



// Install script:
// ---------------
// The install script tells which files to install upon the selected items
// {<expression>} defines an logical expression for the following item(s) to be
// processed
// if <expression> 'is' 1, the following item(s) will be installed
//
// --- for 'dummies:' ---
//
//    for checkboxes / options:
//      {val(<ElementID>)}          Installed if item is selected
//      {not val(<ElementID>)}      Installed if item is not selected
//    for combos:
//      {val(<ElementID>)=1}        Installed if combo's first item is selected
//      {not val(<ElementID>)=1}    Installed if any but combo's first item is
//                                 selected
//    mixed:
//      {val(ElementID1) and val(ElementID2)}
//                                 Installed if both elements are selected
//      {val(ElementID1) or val(ElementID2)}
//                                 Installed if one or both elements are
//                                 selected
//      {val(ElementID1) and not val(ElementID2)}
//                                 Installed if first element is selected and
//                                 second element is not selected
//    you can use following keywords:
//      val(<ElementID>), or, and, xor, eqv, not, >=, <=, =, <>, |
//    see the following 'for hardcore-coders' section for hierarchy notes, or
//    simple use any number or ():
//      {(val(ElementID1)) and (not (val(ElementID2)))}
//    to check your results (depending on currently selected items), click the
//    'Install'-button on the 'test script' window
//
// --- for hardcore-coders: ---
//
//    expression can use:
//       val(<ElementID>), or, and, xor, eqv, not, >=, <=, =, <>, |
//       (please note that the 'or, and, xor, equ, not' keywords will work with
//       0/1 only; e.g. 'not 2', or '1 and 2' will not be processed, means the
//       interpretation of the term will be aborted; in that case, following
//       components will not be installed)
//       All keywords use hierarchy, except the '>=, <=, = <>, |" keywords which
//       are interpreted as they come (so ALWAYS use () if required, e.g.
//       '(val(1) > val(2)) > (val(3) < val(4))', so there should be no need
//       within this installation scripts)
//       You can use any number of ()s;)
//       So the engine can handle terms (calculated values) as <ElementID>,
//       due missing +-/* operators you won't be able to really use it (Yeah,
//       you can still use some expression like '{val(not val(13))}' :)).
//       The setup uses just a simplified/optimized version of my ctCalc engine.
//    Val(<ElementID>) returns the value of an element;
//      returns 0/1 for options/checkboxes
//      returns 1... for dropdown-combos (or 0 if combo is empty)
//      buttons do not support the val() command (returns 0)
//      for not existing elements, ... returns 0
//    examples:
//      {0}
//        not installed
//      {1}
//        installed (actually, this means the components are always instaled)
//
//      any other end result will also skip installation of the following
//      components
//
//      {val(<ElementID>)}
//        designed for checkboxes / options; val returns 0/1
//          (installed if the element is checked / selected)
//        using for buttons will always result in 0 (not installed)
//        using for combos will only install if the first element is selected;
//          if e.g. item 2 is selected, val(13) will return 2 (not installed)
//
//      {val(<ElementID>)=2}
//        = compares both values and returns 1, if identical, or 0; as neither
//        designed for combos; val returns the selected item of the combo;
//          when val(<ElementID>) is identical with the number given (2), it
//          returns 1, else 0
//          (means the following components are installed if the second item of
//          your combo is selected)
//        using for checkboxes/options (return 0/1), results here in '0=2', or
//          '1=2'; 0 = 2 nor 1 = 2 this will always result in 0 (not installed)
//        'val(<ElementID>)=0' or 'val(<ElementID>)=1' would 
//      {not val(<ElementID>)=2}
//        almost the same; the 'val(<ElementID>)=2' expression returns 0/1,
//        depending on the combo's current item.
//        'not' will inverse the term, making 0 to 1 / 1 to 0;
//          (means the following components are not (!) installed if the second
//          item of your combo is selected)
//        
//    to check your results (depending on currently selected items), click the
//    'Install'-button on the 'test script' window
//
// --- for all users: ---
//
//
//
//
// <Command> [<InternalFileName>],<BaseDir>,[<SubDir>],<FileName>[,<ShortCuts>,<(Reserved)>,<FileVersion>,<CommandLineOptions>
// <Command>s:
//    VerCheck
//        VerCheck ,<BaseDir>,[<SubDir>],<FileName>[,,,<FileVersion>
//            Will not install if the specified file allready exists and is equal or newer then <FileVersion>
//            In that case, the user will be prompted to install to another directory
//            File version is define as Major.Minor.Majorbuild.Minorbuid
//              e.g. file properties show 1.00.0036, use 1.00.00.36
//    Copy
//        Copy [<InternalFileName>],<BaseDir>,[<SubDir>],<FileName>[,<ShortCuts>,<(Reserved)>,<FileVersion>,<CommandLineOptions>
//            Will not copy if the specified file allready exists and is equal or newer then <FileVersion>
//        Copy ,<BaseDir>,[<SubDir>]
//            Will create the specified directory, but not (yet) copy any file
//            Use this if your program depends on a directory which does not contain any files
//    Del
//        Del ,<BaseDir>,[<SubDir>],<FileName>[[[,<ShortCuts>]]]
//            Deletes a given file (currently only working for files in the choosen <'program'> folder)
//            <ShortCuts> will remove existing shortcuts
//    Link    Creates additional shortcut
//        Link ,<BaseDir>,[<SubDir>],<FileName>,<ShortCuts>,<(Reserved)>,,<CommandLineOptions>
//    Reg
//        Reg <RegFile>
//            <RegFile> must be a .reg file imported with the 'import reg' feature, getting .reg.convert extension.
//            Must be a compatible regestry file, plus allowes following extras
//              [-HKEY_...] Deletes entire key and all subkeys / values (Regedit compatible)
//                You need do create it again using [HKEY...] for writting values, if required.
//              [&HKEY_...] Opens a key without creating.
//                If the key does not exist, further values are not written
//              [*HKEY_...] Deletes all subkeys of the specified key, and all values in the subkeys.
//                Does not delete values in the key itself; The key is left open for writting values
//              [?HKEY_...] Deletes all values in the specified key.
//                Does not delete any subkeys or values within the subkeys. The key is left open for writting values
//            Use the following within the data (value) block to be replaced with the matching absolute path:
//              <Reg2exe>             Installation directory
//              <Reg2exeWinPath>      Windows directory
//              <Reg2exeSysPath>      Windows system / system32 directory
//              <Reg2exeTempPath>     Windows temp directory
//              <Reg2exeProgsPath>    Programs directory
//    UnDel
//        UnDel ,<BaseDir>,[<SubDir>],<FileName>[[[,<ShortCuts>]]]
//            Deletes a given file on uninstall (currently only working for files in the choosen <'program'> folder)
//            <ShortCuts> will remove existing shortcuts
//    UnReg
//        UnReg <RegFile>
//            Similar to "Reg", this defines the regestry file(s) to import on uninstallation.
//
// <BaseDir>: 1   The program path (the user chooses)
//            2   Windows system path
//            3   Windows path
// <SubDir>:      Relative (sub)directory
//
// <SortCuts>: A -> Program to be launched after setup
//             D -> Desktop
//             E -> Execute
//             H -> Execute hidden
//             Q -> QuickLaunch (Not yet working)
//             S -> Startmenu
//             U -> Add to uninstall
//             W -> Execute and wait

[Install]
{1} // Always
VerCheck ,1,,MyApp.exe,,,1.0
Del ,1,,MyApp.log,U         // Delete old logfile
Copy MyApp.exe,1,,MyApp.exe,ADQSU 4
