/* ======================================================================

JScript Source File -- Created with SAPIEN Technologies PrimalSCRIPT(TM)

NAME: InstallDlg.js

AUTHOR: Ion C. Freeman

COMMENT: Copies UGDlgBx.exe and UGDlgBx_resources.dll to c:\hp\support\ and 
KeyChecker.vbs and UserGuide.js to c:\hp\support\HP User Guide\

========================================================================= */
var aFileName = new Array(
'UGDlgBx.exe', 
'open.js',
'UserGuide.js', 
'KeyChecker.vbs'
);
var fso = WScript.CreateObject("Scripting.FileSystemObject");
var folderSpec = 'c:\\hp\\support\\HP User Guide\\';
var fol = getFolder(folderSpec);
for(var i=0; i<aFileName.length; i++){
	var fil = fso.GetFile(aFileName[i]);
	fil.Copy(fol.Path + '\\' + fil.Name);
}
function getFolder(path){
	var re = /([^\\]+\\?)/g;
	var a = path.match(re);
	var spec = '';
	for(var i = 0; i<a.length; i++){
		spec += a[i];
		if(!fso.FolderExists(spec))
			var fol = fso.CreateFolder(spec);
		else
			var fol = fso.GetFolder(spec);
	}
	return fol;
}