home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2001 December
/
Chip_2001-12_cd2.bin
/
utilities
/
iomega
/
ready_to_move.exe
/
SystemFiles
/
autoZip.run
< prev
next >
Wrap
Text File
|
2001-10-03
|
5KB
|
191 lines
// ScriptId "XP Migration tool" "{5416BF74-BB3D-4a7a-8C0A-E88C8EF79B5D}"
// Language "JScript"
// Version 1.0
////////////////////////////////////////////////////////////////////
// MSS 9/27
//
// This script will run the Microsoft Migration Wizard to aid
// in the migration process to XP.
//
////////////////////////////////////////////////////////////////////
// Global Variables
var ActiveDiskObj; // global custom application
var AppIndex;
var drv;
var WshShellObj, fso;
var ShowSplash;
function OnInsert( drvLetter ) {
var MsgString;
var RegSpanPath;
var f, Source, Dest, DestFolder;
drv = drvLetter;
try
{
// Create a Shell Object
WshShellObj = new ActiveXObject( "WScript.Shell");
// Create the Active Disk Object and initalize it
ActiveDiskObj = new ActiveXObject("AutoLib.AutoCust");
ActiveDiskObj.InitDriveLetter(drvLetter);
// Create the File System object
fso = new ActiveXObject("Scripting.FileSystemObject");
}
catch ( err )
{
if (WshShellObj == null)
{
// Can't display error message so just exit
return false;
}
if(ActiveDiskObj == null)
{
MsgString = "ActiveDisk object is null";
}
if(ActiveDiskObj == null)
{
MsgString = "FileSystem object is null";
}
WshShellObj.Popup(MsgString);
return false;
}
try
{
// Look to see if we should show the splash screen now before we create the file
if( fso.FileExists(drv+":\\Usmt2img.dat") ){
ShowSplash = 1;
}
else {
ShowSplash = 0;
}
// Create temporary folder if it doen't already exist
DestFolder = "c:\\migrate";
if (!fso.FolderExists(DestFolder))
{
fso.CreateFolder(DestFolder);
}
// copy ADSplash to the same temorary spot
Dest = DestFolder + "\\ADSplash.exe";
Source = drvLetter + ":\\ADSplash.exe";
CopyUpdateFile(Source, Dest, true);
//copy Fastwiz to a temporary spot on the hard disk
Source = drvLetter + ":\\fastwiz.exe";
Dest = DestFolder + "\\fastwiz.exe";
CopyUpdateFile(Source, Dest, true);
}
catch (err)
{
MsgString = "Temp file could not be copied";
WshShellObj.Popup(MsgString);
return false;
}
try
{
// set the registry for spanning
RegSpanPath = "HKLM\\Software\\Iomega Corp\\ActivityDisks\\CurrentVersion\\" + drvLetter + "\\Spanning" ;
WshShellObj.RegWrite (RegSpanPath,1,"REG_DWORD");
// run the Wizard
AppIndex = ActiveDiskObj.StartApp( Dest, //app to run
"", // cmd line arg
"c:\\migrate", // working directory
2, // 2 = Show_Normal
true, // Wait for app to finish
0, // Time out is infinite
true, // Close on eject
true, // Force shutdown
0); // infinte wait for shutdown
}
catch (err)
{
MsgString = "Can't launch application.";
WshShellObj.Popup(MsgString);
return false;
}
// turn off spanning
WshShellObj.RegWrite (RegSpanPath,0,"REG_DWORD");
return true;
} // end of OnInsert
//**********************************************************************************
//** OnEject()
//** This function is called when the eject button is pressed
//**********************************************************************************
function OnEject() {
var Splash;
if( ShowSplash ){ //if the file is there then...
Splash = ActiveDiskObj.StartApp( "c:\\migrate\\ADSplash.exe", //app to run
"/i", // cmd line arg
"c:\\migrate", // working directory
2, // 2 = Show_Normal
true, // Wait for app to finish
8, // Time out is infinite
false, // Close on eject
true, // Force shutdown
0); // infinte wait for shutdown
}
ActiveDiskObj.ShutdownApplication(AppIndex, true, true, 0);
if( ShowSplash ){ //if the file is there then...
ActiveDiskObj.ShutdownApplication(Splash, true, true, 0);
}
}
//Private functions for this script
//**********************************************************************************
//** CopyUpdateFile
//** This function will Copy over a file or update a file
//**********************************************************************************
function CopyUpdateFile( SourcePath, DestinationPath, Logit ){
var SourceObj;
var DestObj;
var SourceVer;
var DestVer;
try{
if( fso.FileExists(DestinationPath) ){ //if the file is there then...
Logit = false;
SourceVer = fso.GetFileVersion( SourcePath ); // get the file version
DestVer = fso.GetFileVersion( DestinationPath );
if( DestVer != "" && SourceVer != "" ) { // we have version information
if( DestVer >= SourceVer){ // then do not copy
return true;
}
} else { // in this case then lets check the date
SourceObj = fso.GetFile( SourcePath );
DestObj = fso.GetFile( DestinationPath );
if( DestObj.DateLastModified >= SourceObj.DateLastModified ){ // then do not copy
return true;
}
}
}
// Remove any read only attr
if( fso.FileExists(DestinationPath) ){ //if the file is there then...
DestObj = fso.GetFile( DestinationPath );
if( (DestObj.attributes & 1) == 1) { // is it read only
DestObj.attributes = DestObj.attributes - 1;
}
}
fso.CopyFile(SourcePath,DestinationPath,true); // copy over the file
if( Logit == true ){ // then log the file
ActivityObj.LogTempFile(DestinationPath);
}
}
catch(err){
return false;
}
return true;
}