E.g.: the 'undefined' error comes up if you have the 'LogInstallation' flag in 'useroptions.js' disabled
and choose only one menu entry containing the %reboot% command:
CODE
config.js
...
pn=1;
prog[pn]=['APP 1 - Reboot'];
ordr[pn]=[101];
desc[pn]=['Test APP 1'];
uid[pn]=['APP1'];
dflt[pn]=['yes'];
cat[pn]=['System'];
forc[pn]=['no'];
cmd1[pn]=['"%wpipath%\\Install\\APP_1.cmd" %wpipath%\\'];
cmd2[pn]=['%reboot% 10'];
pn++;
prog[pn]=['APP 2'];
ordr[pn]=[102];
desc[pn]=['Test APP 2'];
uid[pn]=['APP2'];
dflt[pn]=['yes'];
cat[pn]=['System'];
forc[pn]=['no'];
cmd1[pn]=['"%wpipath%\\Install\\APP_2.cmd" %wpipath%\\'];
pn++;
...
...
pn=1;
prog[pn]=['APP 1 - Reboot'];
ordr[pn]=[101];
desc[pn]=['Test APP 1'];
uid[pn]=['APP1'];
dflt[pn]=['yes'];
cat[pn]=['System'];
forc[pn]=['no'];
cmd1[pn]=['"%wpipath%\\Install\\APP_1.cmd" %wpipath%\\'];
cmd2[pn]=['%reboot% 10'];
pn++;
prog[pn]=['APP 2'];
ordr[pn]=[102];
desc[pn]=['Test APP 2'];
uid[pn]=['APP2'];
dflt[pn]=['yes'];
cat[pn]=['System'];
forc[pn]=['no'];
cmd1[pn]=['"%wpipath%\\Install\\APP_2.cmd" %wpipath%\\'];
pn++;
...
The machine reboots and then 'Installer.hta' throws an 'undefined' error and
terminates:
CODE
Installer.hta
...
// Check for ResumeInstall registry entries
try
{
CurrentInstall=WshShell.regRead("HKEY_CURRENT_USER\\Software\\WPI\\CurrentInstall");
LastExec=WshShell.regRead("HKEY_CURRENT_USER\\Software\\WPI\\LastExec");
LastTopLine=WshShell.regRead("HKEY_CURRENT_USER\\Software\\WPI\\LastTopLine");
Language=WshShell.regRead("HKEY_CURRENT_USER\\Software\\WPI\\Language");
// ===>
LogPath[0]=WshShell.regRead("HKEY_CURRENT_USER\\Software\\WPI\\LogPath");
// ===> this line throws 'undefined' if the REG entry does not exist !!!
// ===> then WPI exits
numCommands=WshShell.regRead("HKEY_CURRENT_USER\\Software\\WPI\\numCommands");
curCommand=WshShell.regRead("HKEY_CURRENT_USER\\Software\\WPI\\curCommand");
}
catch (ex)
{
alert(getText(UnableToResumeInstall));
try
{
WshShell.regWrite("HKEY_CURRENT_USER\\Software\\WPI\\ResumeInstall",0,"REG_DWORD");
}
catch (ex)
{;}
ExitWPI();
}
...
...
// Check for ResumeInstall registry entries
try
{
CurrentInstall=WshShell.regRead("HKEY_CURRENT_USER\\Software\\WPI\\CurrentInstall");
LastExec=WshShell.regRead("HKEY_CURRENT_USER\\Software\\WPI\\LastExec");
LastTopLine=WshShell.regRead("HKEY_CURRENT_USER\\Software\\WPI\\LastTopLine");
Language=WshShell.regRead("HKEY_CURRENT_USER\\Software\\WPI\\Language");
// ===>
LogPath[0]=WshShell.regRead("HKEY_CURRENT_USER\\Software\\WPI\\LogPath");
// ===> this line throws 'undefined' if the REG entry does not exist !!!
// ===> then WPI exits
numCommands=WshShell.regRead("HKEY_CURRENT_USER\\Software\\WPI\\numCommands");
curCommand=WshShell.regRead("HKEY_CURRENT_USER\\Software\\WPI\\curCommand");
}
catch (ex)
{
alert(getText(UnableToResumeInstall));
try
{
WshShell.regWrite("HKEY_CURRENT_USER\\Software\\WPI\\ResumeInstall",0,"REG_DWORD");
}
catch (ex)
{;}
ExitWPI();
}
...
The solutions is quite simple: writing the REG 'LogPath' entry by default:
CODE
WPI.hta
...
<script type="text/javascript">
try
{
WshShell.regWrite("HKEY_CURRENT_USER\\Software\\WPI\\Theme",Theme,"REG_SZ");
WshShell.regWrite("HKEY_CURRENT_USER\\Software\\WPI\\Language",Language,"REG_SZ");
WshShell.regWrite("HKEY_CURRENT_USER\\Software\\WPI\\PlayAudioInInstaller",PlayAudioInInstaller,"REG_SZ");
WshShell.regWrite("HKEY_CURRENT_USER\\Software\\WPI\\AudioVolume",Volume,"REG_SZ");
// ===> insert the following line
// ===> to fix
WshShell.regWrite("HKEY_CURRENT_USER\\Software\\WPI\\LogPath",LogPath,"REG_SZ");
// ===>
}
catch (ex)
{;}
</script>
...
...
<script type="text/javascript">
try
{
WshShell.regWrite("HKEY_CURRENT_USER\\Software\\WPI\\Theme",Theme,"REG_SZ");
WshShell.regWrite("HKEY_CURRENT_USER\\Software\\WPI\\Language",Language,"REG_SZ");
WshShell.regWrite("HKEY_CURRENT_USER\\Software\\WPI\\PlayAudioInInstaller",PlayAudioInInstaller,"REG_SZ");
WshShell.regWrite("HKEY_CURRENT_USER\\Software\\WPI\\AudioVolume",Volume,"REG_SZ");
// ===> insert the following line
// ===> to fix
WshShell.regWrite("HKEY_CURRENT_USER\\Software\\WPI\\LogPath",LogPath,"REG_SZ");
// ===>
}
catch (ex)
{;}
</script>
...
Also the 'undefinied' message - when installing Office2003 - is gone...
That's it - I hope you like it
