Jump to content

Slight Problem


Recommended Posts


WPI.cmd:

@ECHO OFF

REM Example, how to look for CDROM-drive. Must have a file to identify in its root (like WIN51 or WPI.ico).
for %%i in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%i:\wpi.ico set CDROM=%%i:
echo Found CD-Rom as drive %CDROM%

REM Determine the WPI startup path.
REM if wpi should run off the cd the replace %~dp0 with %cdrom%.
set wpipath=%cdrom%

REM Force resolution to needed size for wpi interface.
--start %wpipath%\common\VideoChanger.exe 1280x1024x32@85 -q

REM Hide this command window.
"%wpipath%\common\cmdow.exe" @ /hid

REM Font installation - the smooth and customizable way.
start /wait %wpipath%\common\fonts\fontinstaller.exe

REM Special registry tweak needed.
regedit /s "%wpipath%\common\wpi.reg"

REM Make WPI directory the current directory.
for /f "delims=: tokens=1" %%i in ("%wpipath%") do %%i:
cd "%wpipath%"

REM Start WPI and wait for its end
start /wait WPI.hta

REM Cleaning up the desktop.
del /s/q "%userprofile%\desktop\*.lnk"

REM Rebooting the sytem to finalize the installation process.
--shutdown.exe -r -f -t 10 -c "Reboot in 10 sec..."

exit

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;

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 (foundCDdrv) return cddrv;
li = GetCDRomDriveLetters();
 for (i=0; i<li.length; i++)
 {
  if (FileExists(li[i]+'\\WPI.ico'))
  {    
   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+'\\WPI.ico'))
   {
    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") + "\\";
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(/%allusersprofile%/gi, allusersprofile);  
rs = rs.replace(/%userprofile%/gi,userprofile);
rs = rs.replace(/%appdata%/gi, appdata);
rs = rs.replace(/%commonprogramfiles%/gi, commonprogramfiles);
rs = rs.replace(/\\\\/gi, "\\");

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] == "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] == "true"){  // 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 (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);
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;
}

Config.js:

//---------------------------------------------------------------------------------------------
// Reference ... prog[0] won't be used. It's just an example
// look in program.js to see explanation of these properties
//---------------------------------------------------------------------------------------------  
// pn=0    // start value vor prog numbering
// prog[pn]=['ProgramName']
// desc[pn]=['Description']
// regb[pn]=['Registry Key Path']
// cmd1[pn]=['CommandLine 1']
// cmd2[pn]=['CommandLine 2']
// cmd3[pn]=['CommandLine 3']
// cmd4[pn]=['CommandLine 4']
// cmd5[pn]=['CommandLine 5']
// cmd6[pn]=['CommandLine 6']
// rega[pn]=['Registry Key Path']
// dflt[pn]=['no']
// forc[pn]=['false']
//  cat[pn]=['Application Category']
// ordr[pn]=[0]
//  uid[pn]=['APP1']
// cond[pn]=['Javascript Conditional Statement']
// deps[pn]=[]
// excl[pn]=[]
// pn++

//---------------------------------------------------------------------------------------------
// Your programs here ...
//---------------------------------------------------------------------------------------------
pn=1;
prog[pn]=['7-Zip 4.24b']
uid[pn]=['7ZIP']
desc[pn]=['7-Zip is a file archiver with high compression ratio.']
ordr[pn]=[10]
cmd1[pn]=['%CDROM%\\WPI\\Install\\7-Zip\\7z424.exe /S']
dflt[pn]=['yes']
cat[pn]=['Utilities']
pn++

prog[pn]=['ATI Tool 0.25 Beta 1']
uid[pn]=['ATITOOL']
desc[pn]=['ATITool is an overclocking utility designed for ATI video cards.']
cmd1[pn]=['%CDROM%\\WPI\\Install\\ATITool\\ATITool_0[1].25b1 /S']
cat[pn]=['PowerToys']
pn++

prog[pn]=['Ad-Aware SE Professional 1.06']
uid[pn]=['ADAWARESE']
desc[pn]=['Ad-Aware SE is the latest version of our award winning and industry leading line of antispyware solutions and represents the next generation in Spyware detection and removal. It is quite simply the most advanced solution available to protect your privacy. With the all new Code Sequence Identification (CSI) technology that we have developed, you will not only be protected from known content, but will also have advanced protection against many of their unknown variants.']
cmd1[pn]=['%CDROM%\\WPI\\Install\\AD-Aware\\aawsepro.exe /s']
dflt[pn]=['yes']
cat[pn]=['Utilities']
pn++

prog[pn]=['Adobe Acrobat Reader 7.0']
uid[pn]=['ADOBEACROBATREADERV70']
desc[pn]=['Adobe® Reader® 7.0 — free software that lets you view, print, search, and share Adobe Portable Document Format (PDF) files more securely using a variety of platforms and devices.']
ordr[pn]=[15]
cmd1[pn]=['%CDROM%\\WPI\\Install\\AdobeReader\\acroread7s.exe']
dflt[pn]=['yes']
cat[pn]=['Office']
pn++

prog[pn]=['AquaMark3']
uid[pn]=['AQUAMARK3']
desc[pn]=['AquaMark3 is a powerful tool to determine reliable information about the gaming performance of a computer system.']
cmd1[pn]=['%CDROM%\\WPI\\Install\\AquaMark3\\AquaMark3.exe /s']
cat[pn]=['Benchmarking']
pn++

prog[pn]=['BitLord 1.1']
uid[pn]=['BITLORD']
desc[pn]=['BitLord is a p2p file-sharing freeware fully compatible with Bittorrent, which is one of the most popular p2p protocol designed for high-speed distribution of 100MB or GB sized files. BitLord is a powerful, clean, fast, and easy-to-use bittorrent client. It supports simultaneous downloads, download queue, selected downloads in torrent package, fast-resume, chatting, disk cache, speed limits, port mapping, proxy, ip-filter, etc.']
ordr[pn]=[140]
cmd1[pn]=['%CDROM%\\WPI\\Install\\BitLord\\BitLord_1.1.exe /S']
cat[pn]=['Internet']
pn++

prog[pn]=['CrapCleaner 1.21']
uid[pn]=['CRAPCLEANER']
desc[pn]=['CCleaner (Crap Cleaner) is a freeware System optimization tool. That removes unused and temporary files from your System - allowing Windows to run faster, more efficiently and giving you more hard disk space. The best part is that it is fast! (normally taking less that a second to run) and Free. :)']
ordr[pn]=[115]
cmd1[pn]=['%CDROM%\\WPI\\Install\\CCleaner\\ccsetup121 /S']
dflt[pn]=['yes']
cat[pn]=['Utilities']
pn++

prog[pn]=['DVDDecrypter 3.5.4.0']
uid[pn]=['DVDDECRYPTER']
desc[pn]=['DVD Decrypter is a free tool which enables you decrypt and copy a DVD to your PC\'s hard disk. From there you can choose to watch them with the likes of PowerDVD and WinDVD or you can re-encode them to MPEG1 (VCD) or DivX.']
cmd1[pn]=['%CDROM%\\WPI\\Install\\DVDDecrypter\\SetupDVDDecrypter_3.5.4.0']
cat[pn]=['CD & DVD Tools']
pn++

prog[pn]=['EVEREST Home Edition 2.01']
uid[pn]=['EVEREST']
desc[pn]=['EVEREST Home Edition is a freeware hardware diagnostics and memory benchmarking solution for home PC users, based on the award-winning EVEREST Technology. It offers the world\'s most accurate hardware information and diagnostics capabilities, including online features, memory benchmarks, hardware monitoring, and low-level hardware information.']
ordr[pn]=[90]
cmd1[pn]=['%CDROM%\\WPI\\Install\\Everest\\everesthome201.exe /VERYSILENT /SP-']
dflt[pn]=['yes']
cat[pn]=['PowerToys']
pn++

prog[pn]=['MSN Messenger 7']
uid[pn]=['MSNMESSENGER']
desc[pn]=['Instant message in real time, get face-to-face with webcam, send messages to your friends\' cell phones, or get the latest news with MSN Alerts. It is really easy to explore all the ways to stay in touch!']
ordr[pn]=[215]
cmd1[pn]=['%CDROM%\\WPI\\Install\\MSN\\MsnMsgs.msi ADDEXPLORERTOOLBAR = "" SETSEARCHENGINE = "" SETHOMEPAGE = "" /QB']
cat[pn]=['Internet']
pn++

prog[pn]=['Media Player Classic 6.4.8.4']
uid[pn]=['MEDIAPLAYERCLASSIC']
desc[pn]=['Window Media Player Classic is an enhanced version of Windows Media Player 6.4. This program can play DVDs with help of external decoders like WinDVD and it can also play Realmedia files, if realplayer one is installed.']
ordr[pn]=[225]
cmd1[pn]=['%CDROM%\\WPI\\Install\\WMPC\\Media_Player_Classic.exe /VERYSILENT']
dflt[pn]=['yes']
cat[pn]=['Utilities']
pn++

prog[pn]=['Nero Burning ROM 6.6.0.15']
uid[pn]=['NEROBURNINGROM']
desc[pn]=['Nero burning ROM is the best all-in-one CD-R application on the market. Period. It combines huge amounts of features in a compact and easy to use package. It handles disc duplicating and pre-mastering with ease, supported by a cover designer and even an audio file editor. The excellent GUI desing keeps all the functions handy and guarantees that simple tasks can be done quickly.']
ordr[pn]=[240]
cmd1[pn]=['%CDROM%\\WPI\\Install\\Nero\\Nero_Custom_Setup.exe']
dflt[pn]=['yes']
cat[pn]=['CD & DVD Tools']
pn++

prog[pn]=['ZoneAlarm 5.5']
uid[pn]=['ZONEALARM']
desc[pn]=['An easy-to-use firewall that blocks hackers and other unknown threats.']
cmd1[pn]=['%CDROM%\\WPI\\Install\\ZoneAlarm\\zlsSetup_55_094_000.exe /s']
dflt[pn]=['yes']
cat[pn]=['Internet']
pn++

//---------------------------------------------------------------------------------------------
// End of program definitions ...
//---------------------------------------------------------------------------------------------

Winnit:

; Generated by nLite 1.0 beta 4

[Data]
Autopartition = 0
FloppyLess = 1
MsDosInitiated = 0
UnattendedInstall = Yes

[Unattended]
UnattendMode = GuiAttended
UnattendSwitch = No
OemPreinstall = Yes
OemSkipEula = Yes
FileSystem = *
WaitForReboot = No
NoWaitAfterTextMode = 1
NoWaitAfterGUIMode = 1
TargetPath = Windows
DriverSigningPolicy = Ignore
NonDriverSigningPolicy = Ignore

[Display]
Xresolution = 1024
Yresolution = 768
BitsPerPel = 32
Vrefresh = 75

[GuiUnattended]
TimeZone = 085
OEMSkipRegional = 1
OemSkipWelcome = 1

[Components]

[UserData]
ProductKey = ""
OrgName = "Home"

[RegionalSettings]
Language = 0809

[Networking]
InstallDefaultComponents = Yes

[Identification]
JoinDomain = "Home"

[GuiRunOnce]
%CDROM%\WPI\WPI.cmd

Folder Layout:

D:\I386

\WPI\Common

\WPI\Install\7-Zip etc (directory of where my program installations are located)

\WPI\Themes

\WPI\WpiScripts

I will make the needed changes and we wiil try to get this working for you.

Cheers mate :)

Edited by OliverMaltby
Link to comment
Share on other sites

mm,

I'm having a similar problem. All the WPi files reside in %cdrom%\wpi folder. I've edited wpi.cmd to change the wpi startup path to %cdrom%\wpi and the cdrom gets identified correctly. However, when I select the apps to install and begin the install WPI adds WPI to the path of the application to be installed. e.g Nero resides at %cdrom%\$oem$\cd3_apps\nero\nero.exe and the config.js file tell WPI to run %cdrom%\$oem$\cd3_apps\nero\nero.exe. However when i start the install and runonceex begins i get the error that setup cannot find:

"%cdrom%\WPI\$oem$\cd3_apps\nero\nero.exe

I have tried changing the wpi startup path to just %cdrom% and then editing the paths to videochanger, WPI.hta etc to read %cdrom%\wpi but it appears that whatever folder wpi.jta is run from is added to the installation path after the cdrom drive letter.

can anyone tell me why its doing this???

thanks

Link to comment
Share on other sites

The problem is this:

REM Make WPI directory the current directory.
for /f "delims=: tokens=1" %%i in ("%wpipath%") do %%i:
cd "%wpipath%"

REM Start WPI and wait for its end
start /wait WPI.hta

In the config.js, all my apps are referenced to %cdrom%\software\

After it changes this, it thinks %cdrom% is now %cdrom%\software\wpi.

then when hta is executed, it looks to d:\software\wpi\software\program

I'm going to hardcode the start /wait and remove the change of the wpipath. I hope nothing else breaks because of it.

Edited by newnick
Link to comment
Share on other sites

Well, I gave up and moved my software to the WPI dir. Not my preferred work around, but it was quick.

REM Determine the WPI startup path. 
REM if wpi should run off the cd the replace %~dp0 with %cdrom%.
set wpipath=%cdrom%

REM Force resolution to needed size for wpi interface.
--start %wpipath%\software\WPI\common\VideoChanger.exe 1280x1024x32@85 -q

REM Hide this command window.
"%wpipath%\software\WPI\common\cmdow.exe" @ /hid

REM Font installation - the smooth and customizable way.
start /wait %wpipath%\software\WPI\common\fonts\fontinstaller.exe

REM Special registry tweak needed.
regedit /s "%wpipath%\software\WPI\common\wpi.reg"

REM Make WPI directory the current directory.
for /f "delims=: tokens=1" %%i in ("%wpipath%") do %%i:
cd "%wpipath%"

REM Start WPI and wait for its end
start /wait WPI.hta

folders are like:

cdrom:\software\wpi\applications\programs...

and then in config.js, paths are like:

%cdrom%:\\applications\\adobe\\etc

Link to comment
Share on other sites

Newnick, how do you launch the WPI application through Winnit? What code do you use as the only way I can get it to work would be by putting it in the $OEM$ folder, so that it is copied to the hard drive. This means that the applications must also be in that directory, which causes them to also be copied to the hard drive - I would like to avoid this as it helps to reduce the installation time.

Link to comment
Share on other sites

Right I've finally figured out where I was going wrong, I still had the WPI.ico file in the WPI directory. Once I figured that if I put it in the root then everything would fall into place I was very happy, thanks for all your help! :)

Oliver.

Link to comment
Share on other sites

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...