Jump to content

Recommended Posts

Posted (edited)

Hi,

i need help, because i'm near to become crazy!

When i click on Install Button i've get an error like this

Url: file://%path%\wpi.hta

File: generate.js

Line: 267

How i can solve this error?

Thanx and best regards

Anacleto

Edited by Asterisco

Posted

Some of the previous version had a lot of work done to the generate.js file by a few people at a time and some things got messed up. I am working on v5.0 and should be done in the next week or two. All the known bugs are fixed and many new features/updates made.

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.

Posted
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+'\\'+FindFile))

{

cddrv = li;

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!=null; i++ )

{

if (forc!=null && forc == "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!=null; i++ )

debug(i+1 + ".: " +programs.ordr + " - " + programs.prog,1);

debug("Installing...",1);

for ( i = 0; i<programs.length && programs!=null; i++ )

{

j++;

if (sorting && !installByCategory) e = programs.ordr;

else { e = '0' + i; while (e.length<4) e = "0" + e; }

WshShell.regWrite(KeyBase + "\\"+e+"\\", programs.prog, "REG_SZ");

if (true) { // set to false, if you want just the display but no real installs

if ((programs.regb != null)&&(path(programs.regb) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\1","REGEDIT /S "+path(programs.regb), "REG_SZ");

if ((programs.cmd1 != null)&&(path(programs.cmd1) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\2",substituteCommand(programs.cmd1), "REG_SZ");

if ((programs.cmd2 != null)&&(path(programs.cmd2) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\3",substituteCommand(programs.cmd2), "REG_SZ");

if ((programs.cmd3 != null)&&(path(programs.cmd3) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\4",substituteCommand(programs.cmd3), "REG_SZ");

if ((programs.cmd4 != null)&&(path(programs.cmd4) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\5",substituteCommand(programs.cmd4), "REG_SZ");

if ((programs.cmd5 != null)&&(path(programs.cmd5) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\6",substituteCommand(programs.cmd5), "REG_SZ");

if ((programs.cmd6 != null)&&(path(programs.cmd6) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\7",substituteCommand(programs.cmd6), "REG_SZ");

if ((programs.rega != null)&&(path(programs.rega) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\8","REGEDIT /S "+path(programs.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+'\\'+FindFile))

{

cddrv = li;

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!=null; i++ )

{

if (forc!=null && forc == "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!=null; i++ )

debug(i+1 + ".: " +programs.ordr + " - " + programs.prog,1);

debug("Installing...",1);

for ( i = 0; i<programs.length && programs!=null; i++ )

{

j++;

if (sorting && !installByCategory) e = programs.ordr;

else { e = '0' + i; while (e.length<4) e = "0" + e; }

WshShell.regWrite(KeyBase + "\\"+e+"\\", programs.prog, "REG_SZ");

if (true) { // set to false, if you want just the display but no real installs

if ((programs.regb != null)&&(path(programs.regb) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\1","REGEDIT /S "+path(programs.regb), "REG_SZ");

if ((programs.cmd1 != null)&&(path(programs.cmd1) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\2",substituteCommand(programs.cmd1), "REG_SZ");

if ((programs.cmd2 != null)&&(path(programs.cmd2) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\3",substituteCommand(programs.cmd2), "REG_SZ");

if ((programs.cmd3 != null)&&(path(programs.cmd3) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\4",substituteCommand(programs.cmd3), "REG_SZ");

if ((programs.cmd4 != null)&&(path(programs.cmd4) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\5",substituteCommand(programs.cmd4), "REG_SZ");

if ((programs.cmd5 != null)&&(path(programs.cmd5) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\6",substituteCommand(programs.cmd5), "REG_SZ");

if ((programs.cmd6 != null)&&(path(programs.cmd6) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\7",substituteCommand(programs.cmd6), "REG_SZ");

if ((programs.rega != null)&&(path(programs.rega) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\8","REGEDIT /S "+path(programs.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;

}

Posted

At first glance, those lines of code should never cause an error message. Something somewhere else is to blame. What, there is no real way to tell without seeing your entire code (don't send it). Or you have an error in your config file or user options file.

Posted (edited)
At first glance, those lines of code should never cause an error message. Something somewhere else is to blame. What, there is no real way to tell without seeing your entire code (don't send it). Or you have an error in your config file or user options file.

Ok, i think i found the error, but i don't know how i can solve it.

The error is here, in the useroptions file at this line var timer='on'; , i put "off" in place off "on" and so i don't have the error, but is not the good way to solve this error, because i need the clock.

I fix a little error with translation in line "var configlist" in the useroptions file but the problem was not there.

Could you help me, please?

Thanx again

Anacleto

Edited by Asterisco

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...