AlBundy33 Posted June 18, 2006 Share Posted June 18, 2006 I want to use %CDROM% in the ExecuteBefore-Option but I get an error where the command should be executed. :-(This is my entry in useroptions.js:ExecuteBefore=['%CDROM%\\copywintools.cmd'];orExecuteBefore=['%ROOT%\\copywintools.cmd'];And this is my modified FindCDRom():function FindCDRom(){ position = "generate.js"; whatfunc="FindCDRom()"; if (foundCDdrv) return cddrv; cddrv = fso.GetAbsolutePathName(".\\.."); debug("Found Root as folder " + cddrv,1,2); foundCDdrv = true; return cddrv;}This function works great on "normal" installs - but not on ExecuteBefore. :-/I also tried this, without problems - except ExecuteBefore (I get the same error like above). :-(generate.js...function GetRootDir(){ position = "generate.js"; whatfunc="GetRootDir()"; root = fso.GetAbsolutePathName(".\\.."); debug("Found Root as folder " + root,1,2); return root;}...function replpath(v) { position="generate.js"; whatfunc="replpath()"; var rs = new String(); cddrv = FindCDRom(); root = GetRootDir(); 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 = v; rs = rs.replace(/%wpipath%/gi,wpipath); rs = rs.replace(/%cdrom%/gi, cddrv); rs = rs.replace(/%root%/gi,root); 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;}The errormessage is:JavaScript Error ReportMessage: 'undefined' ist Null oder kein Objekt.Url: file://D:\\System\\WPI\WPI.htaFile: generate.jsFunction: GetRootDir()Line: 150But Line 150 is rs = rs.replace(/%cdrom%/gi, cddrv);?!?If I remove my function and use the default-FindCDRom() I get the same error on a Line between 140 and 150 (this is in replpath()).I also tried a original WPI-installation but I get the same error. :-/Is this a WPI-bug?Again: All examples working great except for ExecuteBefore (ExecuteAfter not testet yet).Can anybody help to fix this problem?ThanksAl Link to comment Share on other sites More sharing options...
AlBundy33 Posted June 19, 2006 Author Share Posted June 19, 2006 The error seems to be because a bug in installer.js - with this installer.js it should work://// Date Last Modified: June 9, 2006//// Modified By: Mark Ritter (mritter) and Djé//function ShowInstaller(){ position="installer.js"; whatfunc="ShowInstaller()"; var txt = new String(); txt==""; var line = new String(); line=""; var iWidth, iHeight; iWidth=328+ExtraWidth; iHeight=410+ExtraHeight; if (PlayAudioInInstaller) iHeight +=62; strFile=wpipath+"Common\\Installer.hta"; if (!FileExists(strFile)) { alert("Could not open '"+strFile+"'."); ExitWPI(); } InstallWindow=window.showModelessDialog(strFile,window,"dialogLeft:25;dialogTop:25;dialogWidth:"+iWidth+"px;dialogHeight:"+iHeight+"px;center:no;help:no;resizable:no;scroll:no;status:no;"); Pause(0,100); InstallWindow.document.getElementById("InstallHeaderText").innerHTML=getText(InstallerHeaderTxt); InstallWindow.document.getElementById("installLayer").style.cursor='wait'; if (PlayAudioInInstaller) { InstallWindow.document.getElementById("MediaPLayer").style.display='block'; }}function CheckInstaller(){ position="installer.js"; whatfunc="CheckInstaller()"; if (InstallWindow.closed) { ShowInstaller(); }}function CloseInstaller(){ position="installer.js"; whatfunc="CloseInstaller()"; WshShell.RegWrite("HKEY_CURRENT_USER\\Software\\WPI\\Installer\\InstallFinished","TRUE"); CloseLogFile(); Pause(2,0); return;}function InstallPrograms() { position="installer.js"; whatfunc="InstallPrograms()"; InstallShell = new ActiveXObject("WScript.Shell"); var ce=0; programs = new Array(); htm(); // Turn off tips StopAudio(); window.resizeTo(0,0); window.moveTo(25,25); for(i=1; prog[i] != null; i++) { if (forc[i] != null && forc[i]=="yes" && ReallyForce) setChecked(i); if (document.getElementById("chkbox"+i) && document.getElementById("chkbox"+i).checked) programs[programs.length++] = new program(i); } topLine=0; currentLine=0; totalLine=programs.length; if (totalLine==0) return; if (!InstallByCategory) programs.sort(SortByOrdr); OpenLogFile(); WriteLogLinePlain("\nList of programs to be installed:"); for(i=0; programs[i] != null; i++) WriteLogLinePlain(" "+programs[i].prog); if (ExecuteBeforeEnabled && ExecuteBefore!=null) { programs.splice(0,0,new program(999998)); programs[0].prog="Execute Before"; programs[0].uid="EXECUTE_BEFORE"; programs[0].ordr=999998; programs[0].cat="WPI Built In"; programs[0].cmd1=ExecuteBefore; totalLine++; } if (ExecuteAfterEnabled && ExecuteAfter!=null) { programs.splice(programs.length,0,new program(999999)); programs[programs.length-1].prog="Execute After"; programs[programs.length-1].uid="EXECUTE_AFTER"; programs[programs.length-1].ordr=999999; programs[programs.length-1].cat="WPI Built In"; programs[programs.length-1].cmd1=ExecuteAfter; totalLine++; } ShowInstaller(); CheckInstaller(); for(i=0; i<programs.length && programs[i] != null; i++) { ce++; programs[i].success=false; programs[i].fail=false; UpdateInstallList(ce,programs); StartLogEntry(programs[i]); InstallOne(i,'regb'); CheckInstaller(); for(j=1; j<=6; j++) { InstallOne(i,'cmd'+j); CheckInstaller(); } CheckInstaller(); InstallOne(i,'rega'); WriteLogLine("Finished installation"); UpdateProgressBar(Math.round((ce/programs.length)*100)); Pause(0,250); } CheckInstaller(); UpdateInstallList(10000000,programs); Pause(0,250); CheckInstaller(); if (RestartComputer) { cmdLine='shutdown.exe -r -f -t '+RestartSeconds+' -c "To finish installations WPI will now reboot in '+RestartSeconds+' seconds..."'; InstallShell.Run(cmdLine,1,false); } CloseInstaller();}function InstallOne(item,cmdName){ position="installer.js"; whatfunc="InstallOne()"; var cmd, ReturnCode, result; CheckInstaller(); cmd=eval('programs['+item+'].'+cmdName); if (cmd == null || (cmdLine=path(cmd)) == '') return; if (cmdName=='regb' || cmdName=='rega') { if (!FileExists(cmdLine)) { programs[i].fail=true; cmdName=(cmdName=='regb') ? 'Reg Before' : (cmdName=='rega') ? 'Reg After' : cmdName; WriteLogLine(cmdName+' '+result+' (returned code '+ReturnCode+'): RegEdit /S "'+cmdLine+'"'); return; } if (cmdLine.indexOf(" ") != -1 && cmdLine.substr(0,1) != '"') cmdLine='"'+cmdLine+'"'; cmdLine="RegEdit /S "+cmdLine; } else cmdLine=handleCommand(cmdLine); try { ReturnCode=InstallShell.Run(cmdLine,1,true); result='Success'; programs[i].success=true; } catch(ex) { result='Fail'; programs[i].fail=true; } cmdName=(cmdName=='regb') ? 'Reg Before' : (cmdName=='rega') ? 'Reg After' : cmdName; WriteLogLine(cmdName+' '+result+' (returned code '+ReturnCode+'): "'+cmdLine+'"');}function handleCommand(cmd){ position="installer.js"; whatfunc="handleCommand()"; var firstToken; if (cmd.indexOf(" ") != -1 && cmd.substr(0,1) != '"') { firstToken = cmd.substr(0,cmd.indexOf(" ")); switch(firstToken.toUpperCase()) { case 'FILECOPY': cmd = ("CMD /C " + cmd.replace(/FILECOPY/gi,'copy')); break; case 'DIRCOPY': cmd = ("CMD /C " + cmd.replace(/DIRCOPY/gi,'xcopy') + " /I /E /Y"); break; case 'RENAME': cmd = ("CMD /C " + cmd.replace(/RENAME/gi,'ren')); break; case 'MAKEDIR': cmd = ("CMD /C " + cmd.replace(/MAKEDIR/gi,'md')); break; case 'DELETE': cmd = ("CMD /C " + cmd.replace(/DELETE/gi,'del')); break; default: if (FileExists(cmd)) cmd='"'+cmd+'"'; break; } } return (cmd);}function UpdateInstallList(pos,progs){ position="installer.js"; whatfunc="UpdateInstallList()"; var line, box; CheckInstaller(); box=""; if (progs.length<=maxLines) { for(line=0; line<progs.length; line++) { if (line+1==pos) { box+='<img src="../themes/'+Theme+'/spacer.gif" border="0" width="13" height="1">'; box+='<font style="font-size:12px;"><b>'+progs[line].prog+'</b></font>'; } else { if (line+1<pos) { if (progs[line].success && !progs[line].fail) { box+='<img src="../themes/'+Theme+'/InstallSuccess.gif" border="0" width="11" height="11">'; } if (!progs[line].success && progs[line].fail) { box+='<img src="../themes/'+Theme+'/InstallFail.gif" border="0" width="11" height="11">'; } if (progs[line].success && progs[line].fail) { box+='<img src="../themes/'+Theme+'/InstallPartial.gif" border="0" width="11" height="11">'; } if (!progs[line].success && !progs[line].fail) { box+='<img src="../themes/'+Theme+'/InstallFail.gif" border="0" width="11" height="11">'; } } else { box+='<img src="../themes/'+Theme+'/spacer.gif" border="0" width="11" height="1">'; } box+='<img src="../themes/'+Theme+'/spacer.gif" border="0" width="2" height="1">'; box+='<font style="font-size:12px;">'+progs[line].prog+'</font>'; } box+='<br>'; } } else { currentLine++; if (currentLine>centerLine && topLine+maxLines<totalLine) { currentLine=centerLine; topLine++; } for(line=topLine; line<topLine+maxLines; line++) { if (line+1==pos) { box+='<img src="../themes/'+Theme+'/spacer.gif" border="0" width="13" height="1">'; box+='<font style="font-size:12px;"><b>'+progs[line].prog+'</b></font>'; } else { if (line+1<pos) { if (progs[line].success && !progs[line].fail) { box+='<img src="../themes/'+Theme+'/InstallSuccess.gif" border="0" width="11" height="11">'; } if (!progs[line].success && progs[line].fail) { box+='<img src="../themes/'+Theme+'/InstallFail.gif" border="0" width="11" height="11">'; } if (progs[line].success && progs[line].fail) { box+='<img src="../themes/'+Theme+'/InstallPartial.gif" border="0" width="11" height="11">'; } if (!progs[line].success && !progs[line].fail) { box+='<img src="../themes/'+Theme+'/InstallFail.gif" border="0" width="11" height="11">'; } } else { box+='<img src="../themes/'+Theme+'/spacer.gif" border="0" width="11" height="1">'; } box+='<img src="../themes/'+Theme+'/spacer.gif" border="0" width="2" height="1">'; box+='<font style="font-size:12px;">'+progs[line].prog+'</font>'; } box+='<br>'; } } CheckInstaller(); InstallWindow.document.getElementById("Install_prog").innerHTML=box;}function ClearProgressBar(){ position="installer.js"; whatfunc="ClearProgressBar()"; CheckInstaller(); InstallWindow.document.getElementById("PB_text").innerHTML=""; CheckInstaller(); InstallWindow.document.getElementById("PB_bar").style.width=0; }function UpdateProgressBar(value){ position="installer.js"; whatfunc="UpdateProgressBar()"; if (value>=0 && value<=100) { if (value>9) { CheckInstaller(); InstallWindow.document.getElementById("PB_text").innerHTML=parseInt(value)+"%"; } CheckInstaller(); InstallWindow.document.getElementById("PB_bar").style.width=(value*3)+"px"; }}GreetingsAl Link to comment Share on other sites More sharing options...
ZcWorld Posted June 22, 2006 Share Posted June 22, 2006 not sure if you got ur problem there fixbut i think its coz the %CDROM% is not set to what drive is the cd-rom/ dvd rom drivethere is a code line that sets it i think that may help have a look at http://unattended.msfn.org/unattended.xp/view/web/59/ Link to comment Share on other sites More sharing options...
Kelsenellenelvian Posted June 22, 2006 Share Posted June 22, 2006 Please redownload WPI and try again... Link to comment Share on other sites More sharing options...
ZcWorld Posted June 22, 2006 Share Posted June 22, 2006 (edited) ooh yes smart mov the new one works well asall i use is the %wpipath%\\install\\path\\to\\setup.exe just finished doing the reconfig of the config and testing lolnote :: some of the program i use need to have like the %cdrom% path set or they dont install like office and nero 7 i found can be evil in that way so i use a go.bat / go.cmd file to load up the setting i need to be able to install them without a prolem Edited June 28, 2006 by zc_au Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now