mritter, on Apr 29 2006, 12:17 PM, said:
If I remember right, that had to deal with the audio player. The path was set wrong. If you can post the actual line of code and what version to refresh my memory I will be able to give a better answer.
Hi,
and today appear another error but with timer.js at Line:48 "null" is not object always in %path%wpa.hta
you can found the code under the gnerate's code, thank you very much.
I use 4.3.8, i think the latest version on the official site, with an italian translation by myself
Best regards,
Anacleto
generate.js
var WshShell = new ActiveXObject("wscript.shell");
var fso = new ActiveXObject("Scripting.FileSystemObject");
var WshEnv = WshShell.Environment("PROCESS");
var cddrv = new String(); cddrv="";
var foundCDdrv = false;
var audioshell = new ActiveXObject("WScript.shell");
var runaudio = "";
var runaudioprogram = "";
runaudio=1;
function SetScriptWaitTimeout(timeout) // max is 4294967295
{
position="generate.js";
var val=0;
var KeyBase = "HKCU\\Software\\Microsoft\\Internet Explorer\\Styles\\MaxScriptStatements";
try
{
if (timeout<0)
{
WshShell.regDelete(KeyBase);
return;
}
try
{
val = WshShell.regRead(KeyBase);
}
catch (exc)
{
if (timeout==0 || !timeout) timeout = 0x7fffffff;
WshShell.regWrite(KeyBase, timeout, "REG_DWORD");
}
} catch (ex2) {}
}
function FileExists(filespec)
{
position = "generate.js";
return fso.FileExists(filespec);
}
function GetCDRomDriveLetters()
{
position = "generate.js";
var li, en;
li = new Array();
en = new Enumerator(fso.Drives);
for (; !en.atEnd(); en.moveNext())
{
ite = en.item();
if (ite.DriveType == 4) {
li[li.length++]=(ite.DriveLetter + ":");
}
}
return li;
}
function FindCDRom()
{
position = "generate.js";
var i, li;
if (LaunchFromCD=="yes")
FindFile="WIN51";
else
FindFile="WPI.ICO";
if (foundCDdrv) return cddrv;
li = GetCDRomDriveLetters();
for (i=0; i<li.length; i++)
{
if (FileExists(li[i]+'\\'+FindFile))
{
cddrv = li[i];
debug("Found CDROM as drive " + cddrv,1,2);
}
}
if (cddrv=="")
{
a = fso.GetAbsolutePathName(".");
while (a.length>=3)
{
//debug("Trying ... " + a, 1);
if (FileExists(a+'\\'+FindFile))
{
cddrv=a;
debug("Found CDROM as folder " + cddrv,1,2);
break;
}
if (a.length==3) break;
a = a + "\\..";
a = fso.GetAbsolutePathName(a);
}
}
if (cddrv=="")
{
cddrv = WshShell.RegRead("HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Setup\\SourcePath") + "\\";
cddrv = cddrv.substr(0,3);
debug("Found CDROM as from registry " + cddrv,1,2);
}
foundCDdrv = true;
return cddrv;
}
function replpath(u) {
position = "generate.js";
cddrv = FindCDRom();
sysdrv = WshEnv("SYSTEMDRIVE") + "\\";
windir = WshEnv("WINDIR") + "\\";
programfiles = WshEnv("PROGRAMFILES") + "\\";
temp = WshEnv("TEMP") + "\\";
sysdir = WshEnv("WINDIR") + "\\system32\\";
allusersprofile = WshEnv("ALLUSERSPROFILE") + "\\";
userprofile = WshEnv("USERPROFILE") + "\\";
appdata = WshEnv("APPDATA") + "\\";
commonprogramfiles = WshEnv("CommonProgramFiles") + "\\";
rs = new String();
rs = u;
rs = rs.replace(/%cdrom%/gi, cddrv);
rs = rs.replace(/%systemdrive%/gi,sysdrv);
rs = rs.replace(/%windir%/gi, windir);
rs = rs.replace(/%programfiles%/gi,programfiles);
rs = rs.replace(/%sysdir%/gi, sysdir);
rs = rs.replace(/%temp%/gi, temp);
rs = rs.replace(/%allusersprofile%/gi, allusersprofile);
rs = rs.replace(/%userprofile%/gi,userprofile);
rs = rs.replace(/%appdata%/gi, appdata);
rs = rs.replace(/%commonprogramfiles%/gi, commonprogramfiles);
return rs;
}
function path(u) {
position = "generate.js";
if((u[0] == "systemdrive") ||(u[0] == "programfiles") ||(u[0] == "windir") ||(u[0] == "cdrom") ||(u[0] == "")) {
pth = new String(); pth = u[0]; u[0] = pth.toLowerCase();
if(u[0] == "systemdrive") return WshEnv("SYSTEMDRIVE") + "\\" + u[1]
if(u[0] == "programfiles") return WshEnv("PROGRAMFILES") + "\\" + u[1]
if(u[0] == "temp") return WshEnv("TEMP") + "\\" + u[1]
if(u[0] == "windir") return WshEnv("WINDIR") + "\\" + u[1]
if(u[0] == "cdrom"){
TempSource = new String();
TempSource = WshShell.RegRead("HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Setup\\SourcePath");
TempSource = TempSource + "\\";
if (discPath == 'root'){
TempSource = TempSource.substr(0,3) + u[1]; // return the drive letter of the CD/DVD drive. eg. D:\ | E:\ | F:\ etc.
}
else{
TempSource = TempSource + u[1];
}
TempSource.replace("\\\\","\\");
return TempSource
}
if(u[0] == "") return u[1]
}
else
{
if (u[1]==null || u[1]=="")
return replpath(u[0]);
else
alert("Drive not found.");
}
return "";
}
function CreateFile(arg) {
position = "generate.js";
var KeyBase = "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx";
var j = 0;
var msg;
var programs = new Array();
if (arg==null || arg) window.alert(getText(msgStartInstall));
if (arg=='exit'){ // when pressing exit button, removes default checked checkboxes
remChecks();
}
for ( i = 1; prog[i]!=null; i++ )
{
if (forc[i]!=null && forc[i] == "yes"){ // check the checkbox for an app if it is forced
setChecked(i);
}
if (document.getElementById("chkbox"+i) && document.getElementById("chkbox"+i).checked)
{
programs[programs.length++] = new program(i);
debug("Selecting: " + programs[programs.length-1].prog + " - " + programs[programs.length-1].ordr,1);
}
}
if (sorting)
{
debug("Sort",1);
if (installByCategory) programs.sort(SortByCat);
else programs.sort(SortByOrdr);
}
for ( i = 0; i<programs.length && programs[i]!=null; i++ )
debug(i+1 + ".: " +programs[i].ordr + " - " + programs[i].prog,1);
debug("Installing...",1);
for ( i = 0; i<programs.length && programs[i]!=null; i++ )
{
j++;
if (sorting && !installByCategory) e = programs[i].ordr;
else { e = '0' + i; while (e.length<4) e = "0" + e; }
WshShell.regWrite(KeyBase + "\\"+e+"\\", programs[i].prog, "REG_SZ");
if (true) { // set to false, if you want just the display but no real installs
if ((programs[i].regb != null)&&(path(programs[i].regb) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\1","REGEDIT /S "+path(programs[i].regb), "REG_SZ");
if ((programs[i].cmd1 != null)&&(path(programs[i].cmd1) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\2",substituteCommand(programs[i].cmd1), "REG_SZ");
if ((programs[i].cmd2 != null)&&(path(programs[i].cmd2) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\3",substituteCommand(programs[i].cmd2), "REG_SZ");
if ((programs[i].cmd3 != null)&&(path(programs[i].cmd3) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\4",substituteCommand(programs[i].cmd3), "REG_SZ");
if ((programs[i].cmd4 != null)&&(path(programs[i].cmd4) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\5",substituteCommand(programs[i].cmd4), "REG_SZ");
if ((programs[i].cmd5 != null)&&(path(programs[i].cmd5) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\6",substituteCommand(programs[i].cmd5), "REG_SZ");
if ((programs[i].cmd6 != null)&&(path(programs[i].cmd6) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\7",substituteCommand(programs[i].cmd6), "REG_SZ");
if ((programs[i].rega != null)&&(path(programs[i].rega) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\8","REGEDIT /S "+path(programs[i].rega), "REG_SZ");
}
if (runaudio==1){
runaudio=0;
if (showmpINSBtn == 1) {
runaudioprogram = ".\\audio.exe"
audioshell.run(runaudioprogram, 1, true);
}
}
if (j==appsPerInstallWindow) // call RunOnceEx every 15 apps, so that the window doesn't grow too big
{
WshShell.regWrite(KeyBase + "\\TITLE", getText(txtRunOnceExTitle), "REG_SZ");
window.moveTo(10000,10000);
if (!debugOn)
WshShell.Run("rundll32.exe iernonce.dll,RunOnceExProcess", 10, true);
j=0;
}
}
//Launch the last RunOnceEx process we just wrote keys for and exit
WshShell.regWrite(KeyBase + "\\TITLE", getText(txtRunOnceExTitle), "REG_SZ");
window.moveTo(10000,10000);
if (!debugOn)
WshShell.Run("rundll32.exe iernonce.dll,RunOnceExProcess", 10, true);
window.moveTo(0,0);
SetScriptWaitTimeout(-1);
audioshell.run(".\\Audio\\CloseAudio.exe", 1, true);
if (!debugOn) window.close();
programs = null;
}
function substituteCommand(cmd)
{
var prog = path(cmd);
var firstToken = prog.substr(0,prog.indexOf(" "));
switch (firstToken.toUpperCase())
{
case 'FILECOPY': prog = ("CMD /C " + prog.replace(/FILECOPY/gi,'copy')); break;
case 'DIRCOPY': prog = ("CMD /C " + prog.replace(/DIRCOPY/gi,'xcopy') + "/I /E /Y"); break;
case 'RENAME': prog = ("CMD /C " + prog.replace(/RENAME/gi,'ren')); break;
}
return prog;
}
timer.js
var WshShell = new ActiveXObject("wscript.shell");
var fso = new ActiveXObject("Scripting.FileSystemObject");
var WshEnv = WshShell.Environment("PROCESS");
var cddrv = new String(); cddrv="";
var foundCDdrv = false;
var audioshell = new ActiveXObject("WScript.shell");
var runaudio = "";
var runaudioprogram = "";
runaudio=1;
function SetScriptWaitTimeout(timeout) // max is 4294967295
{
position="generate.js";
var val=0;
var KeyBase = "HKCU\\Software\\Microsoft\\Internet Explorer\\Styles\\MaxScriptStatements";
try
{
if (timeout<0)
{
WshShell.regDelete(KeyBase);
return;
}
try
{
val = WshShell.regRead(KeyBase);
}
catch (exc)
{
if (timeout==0 || !timeout) timeout = 0x7fffffff;
WshShell.regWrite(KeyBase, timeout, "REG_DWORD");
}
} catch (ex2) {}
}
function FileExists(filespec)
{
position = "generate.js";
return fso.FileExists(filespec);
}
function GetCDRomDriveLetters()
{
position = "generate.js";
var li, en;
li = new Array();
en = new Enumerator(fso.Drives);
for (; !en.atEnd(); en.moveNext())
{
ite = en.item();
if (ite.DriveType == 4) {
li[li.length++]=(ite.DriveLetter + ":");
}
}
return li;
}
function FindCDRom()
{
position = "generate.js";
var i, li;
if (LaunchFromCD=="yes")
FindFile="WIN51";
else
FindFile="WPI.ICO";
if (foundCDdrv) return cddrv;
li = GetCDRomDriveLetters();
for (i=0; i<li.length; i++)
{
if (FileExists(li[i]+'\\'+FindFile))
{
cddrv = li[i];
debug("Found CDROM as drive " + cddrv,1,2);
}
}
if (cddrv=="")
{
a = fso.GetAbsolutePathName(".");
while (a.length>=3)
{
//debug("Trying ... " + a, 1);
if (FileExists(a+'\\'+FindFile))
{
cddrv=a;
debug("Found CDROM as folder " + cddrv,1,2);
break;
}
if (a.length==3) break;
a = a + "\\..";
a = fso.GetAbsolutePathName(a);
}
}
if (cddrv=="")
{
cddrv = WshShell.RegRead("HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Setup\\SourcePath") + "\\";
cddrv = cddrv.substr(0,3);
debug("Found CDROM as from registry " + cddrv,1,2);
}
foundCDdrv = true;
return cddrv;
}
function replpath(u) {
position = "generate.js";
cddrv = FindCDRom();
sysdrv = WshEnv("SYSTEMDRIVE") + "\\";
windir = WshEnv("WINDIR") + "\\";
programfiles = WshEnv("PROGRAMFILES") + "\\";
temp = WshEnv("TEMP") + "\\";
sysdir = WshEnv("WINDIR") + "\\system32\\";
allusersprofile = WshEnv("ALLUSERSPROFILE") + "\\";
userprofile = WshEnv("USERPROFILE") + "\\";
appdata = WshEnv("APPDATA") + "\\";
commonprogramfiles = WshEnv("CommonProgramFiles") + "\\";
rs = new String();
rs = u;
rs = rs.replace(/%cdrom%/gi, cddrv);
rs = rs.replace(/%systemdrive%/gi,sysdrv);
rs = rs.replace(/%windir%/gi, windir);
rs = rs.replace(/%programfiles%/gi,programfiles);
rs = rs.replace(/%sysdir%/gi, sysdir);
rs = rs.replace(/%temp%/gi, temp);
rs = rs.replace(/%allusersprofile%/gi, allusersprofile);
rs = rs.replace(/%userprofile%/gi,userprofile);
rs = rs.replace(/%appdata%/gi, appdata);
rs = rs.replace(/%commonprogramfiles%/gi, commonprogramfiles);
return rs;
}
function path(u) {
position = "generate.js";
if((u[0] == "systemdrive") ||(u[0] == "programfiles") ||(u[0] == "windir") ||(u[0] == "cdrom") ||(u[0] == "")) {
pth = new String(); pth = u[0]; u[0] = pth.toLowerCase();
if(u[0] == "systemdrive") return WshEnv("SYSTEMDRIVE") + "\\" + u[1]
if(u[0] == "programfiles") return WshEnv("PROGRAMFILES") + "\\" + u[1]
if(u[0] == "temp") return WshEnv("TEMP") + "\\" + u[1]
if(u[0] == "windir") return WshEnv("WINDIR") + "\\" + u[1]
if(u[0] == "cdrom"){
TempSource = new String();
TempSource = WshShell.RegRead("HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Setup\\SourcePath");
TempSource = TempSource + "\\";
if (discPath == 'root'){
TempSource = TempSource.substr(0,3) + u[1]; // return the drive letter of the CD/DVD drive. eg. D:\ | E:\ | F:\ etc.
}
else{
TempSource = TempSource + u[1];
}
TempSource.replace("\\\\","\\");
return TempSource
}
if(u[0] == "") return u[1]
}
else
{
if (u[1]==null || u[1]=="")
return replpath(u[0]);
else
alert("Drive not found.");
}
return "";
}
function CreateFile(arg) {
position = "generate.js";
var KeyBase = "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx";
var j = 0;
var msg;
var programs = new Array();
if (arg==null || arg) window.alert(getText(msgStartInstall));
if (arg=='exit'){ // when pressing exit button, removes default checked checkboxes
remChecks();
}
for ( i = 1; prog[i]!=null; i++ )
{
if (forc[i]!=null && forc[i] == "yes"){ // check the checkbox for an app if it is forced
setChecked(i);
}
if (document.getElementById("chkbox"+i) && document.getElementById("chkbox"+i).checked)
{
programs[programs.length++] = new program(i);
debug("Selecting: " + programs[programs.length-1].prog + " - " + programs[programs.length-1].ordr,1);
}
}
if (sorting)
{
debug("Sort",1);
if (installByCategory) programs.sort(SortByCat);
else programs.sort(SortByOrdr);
}
for ( i = 0; i<programs.length && programs[i]!=null; i++ )
debug(i+1 + ".: " +programs[i].ordr + " - " + programs[i].prog,1);
debug("Installing...",1);
for ( i = 0; i<programs.length && programs[i]!=null; i++ )
{
j++;
if (sorting && !installByCategory) e = programs[i].ordr;
else { e = '0' + i; while (e.length<4) e = "0" + e; }
WshShell.regWrite(KeyBase + "\\"+e+"\\", programs[i].prog, "REG_SZ");
if (true) { // set to false, if you want just the display but no real installs
if ((programs[i].regb != null)&&(path(programs[i].regb) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\1","REGEDIT /S "+path(programs[i].regb), "REG_SZ");
if ((programs[i].cmd1 != null)&&(path(programs[i].cmd1) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\2",substituteCommand(programs[i].cmd1), "REG_SZ");
if ((programs[i].cmd2 != null)&&(path(programs[i].cmd2) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\3",substituteCommand(programs[i].cmd2), "REG_SZ");
if ((programs[i].cmd3 != null)&&(path(programs[i].cmd3) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\4",substituteCommand(programs[i].cmd3), "REG_SZ");
if ((programs[i].cmd4 != null)&&(path(programs[i].cmd4) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\5",substituteCommand(programs[i].cmd4), "REG_SZ");
if ((programs[i].cmd5 != null)&&(path(programs[i].cmd5) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\6",substituteCommand(programs[i].cmd5), "REG_SZ");
if ((programs[i].cmd6 != null)&&(path(programs[i].cmd6) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\7",substituteCommand(programs[i].cmd6), "REG_SZ");
if ((programs[i].rega != null)&&(path(programs[i].rega) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\8","REGEDIT /S "+path(programs[i].rega), "REG_SZ");
}
if (runaudio==1){
runaudio=0;
if (showmpINSBtn == 1) {
runaudioprogram = ".\\audio.exe"
audioshell.run(runaudioprogram, 1, true);
}
}
if (j==appsPerInstallWindow) // call RunOnceEx every 15 apps, so that the window doesn't grow too big
{
WshShell.regWrite(KeyBase + "\\TITLE", getText(txtRunOnceExTitle), "REG_SZ");
window.moveTo(10000,10000);
if (!debugOn)
WshShell.Run("rundll32.exe iernonce.dll,RunOnceExProcess", 10, true);
j=0;
}
}
//Launch the last RunOnceEx process we just wrote keys for and exit
WshShell.regWrite(KeyBase + "\\TITLE", getText(txtRunOnceExTitle), "REG_SZ");
window.moveTo(10000,10000);
if (!debugOn)
WshShell.Run("rundll32.exe iernonce.dll,RunOnceExProcess", 10, true);
window.moveTo(0,0);
SetScriptWaitTimeout(-1);
audioshell.run(".\\Audio\\CloseAudio.exe", 1, true);
if (!debugOn) window.close();
programs = null;
}
function substituteCommand(cmd)
{
var prog = path(cmd);
var firstToken = prog.substr(0,prog.indexOf(" "));
switch (firstToken.toUpperCase())
{
case 'FILECOPY': prog = ("CMD /C " + prog.replace(/FILECOPY/gi,'copy')); break;
case 'DIRCOPY': prog = ("CMD /C " + prog.replace(/DIRCOPY/gi,'xcopy') + "/I /E /Y"); break;
case 'RENAME': prog = ("CMD /C " + prog.replace(/RENAME/gi,'ren')); break;
}
return prog;
}