// This script installs shortcut in Windows Program Menu
// and registry keys so that Vb81_XuR can be launched by double-clicking
// tape or disk images.


Shell = WScript.CreateObject("WScript.Shell");
FullName = WScript.ScriptFullName;
XuRPath = FullName.substr(0, FullName.length-WScript.ScriptName.length-6);

fso = new ActiveXObject("Scripting.FileSystemObject");
MenuPath = Shell.SpecialFolders("Programs")+"\\VB81 XUR Release";     
if ( ! fso.FolderExists(MenuPath) )
	fso.CreateFolder(MenuPath);     

answer=Shell.Popup("This scrip will install a new folder in Windows Program Menu \n"
		+"\n"
		+"\n"
		+"\n"
		+"Read VB81 XuR info ?\n"
		,0,"XuR links",4+32);
if (answer==6)
	Shell.Run("notepad "+XuRPath+"VB81_Changes.TXT",1,true);

// Création du raccourci Vb81_XuR.lnk
link = Shell.CreateShortcut(MenuPath + "\\Vb81_XuR.lnk");
link.Description = "Vb81 XuR Zx81 emulator";
link.IconLocation = XuRPath+ "icons\\vb81.ico";
link.TargetPath = XuRPath+ "Vb81_XuR.exe";
link.WindowStyle = 0;
link.WorkingDirectory = XuRPath;
link.Save();

// Création du raccourci info DskCenter.
link = Shell.CreateShortcut(MenuPath + "\\Changes.lnk");
link.Arguments = "";
link.Description = "Changes";
link.IconLocation = XuRPath + "icons\\help.ico";
link.TargetPath = XuRPath + "VB81_Changes.TXT";
link.WindowStyle = 2;
link.WorkingDirectory = XuRPath;
link.Save();

 key =  "HKEY_CLASSES_ROOT\\"
 Shell.RegWrite( key + "Applications\\VB81_XUR.EXE\\shell\\open\\command\\", "\""+XuRPath+"Vb81_XuR.exe\" \"%1\"");
 Shell.RegWrite( key + ".P\\", "Vb81_XuR.P");
 Shell.RegWrite( key + ".81\\", "Vb81_XuR.81");
 Shell.RegWrite( key + ".T81\\", "Vb81_XuR.T81");
 Shell.RegWrite( key + ".TZX\\", "Vb81_XuR.TZX");
 Shell.RegWrite( key + ".4TT\\", "Vb81_XuR.4TT");
 Shell.RegWrite( key + ".4TB\\", "Vb81_XuR.4TB");

 Shell.RegWrite( key + "Vb81_XuR.P\\", "Vb81_XuR ZX81 P Tape");
 Shell.RegWrite( key + "Vb81_XuR.81\\", "Vb81_XuR ZX81 81 Tape");
 Shell.RegWrite( key + "Vb81_XuR.T81\\", "Vb81_XuR ZX81 T81 Tape");
 Shell.RegWrite( key + "Vb81_XuR.TZX\\", "Vb81_XuR ZX81 TZX Tape");
 Shell.RegWrite( key + "Vb81_XuR.4TT\\", "Vb81_XuR ZX81 Forth Text program");
 Shell.RegWrite( key + "Vb81_XuR.4TB\\", "Vb81_XuR ZX81 Forth Binary program");

 Shell.RegWrite( key + "Vb81_XuR.P\\DefaultIcon\\", XuRPath+"icons\\Pfiles.ico");
 Shell.RegWrite( key + "Vb81_XuR.81\\DefaultIcon\\", XuRPath+"icons\\81files.ico");
 Shell.RegWrite( key + "Vb81_XuR.T81\\DefaultIcon\\", XuRPath+"icons\\T81files.ico");
 Shell.RegWrite( key + "Vb81_XuR.TZX\\DefaultIcon\\", XuRPath+"icons\\TZXfiles.ico");
 Shell.RegWrite( key + "Vb81_XuR.4TT\\DefaultIcon\\", XuRPath+"icons\\Forthtxt.ico");
 Shell.RegWrite( key + "Vb81_XuR.4TB\\DefaultIcon\\", XuRPath+"icons\\Forthbin.ico");

 Shell.RegWrite( key + "Vb81_XuR.P\\shell\\Launch Vb81 XuR\\command\\", "\""+XuRPath+"VB81_XUR.EXE\"\"%1\"");
 Shell.RegWrite( key + "Vb81_XuR.81\\shell\\Launch Vb81 XuR\\command\\", "\""+XuRPath+"VB81_XUR.EXE\"\"%1\"");
 Shell.RegWrite( key + "Vb81_XuR.T81\\shell\\Launch Vb81 XuR\\command\\", "\""+XuRPath+"VB81_XUR.EXE\"\"%1\"");
 Shell.RegWrite( key + "Vb81_XuR.TZX\\shell\\Launch Vb81 XuR\\command\\", "\""+XuRPath+"VB81_XUR.EXE\"\"%1\"");
 Shell.RegWrite( key + "Vb81_XuR.4TT\\shell\\Launch Vb81 XuR\\command\\", "\""+XuRPath+"VB81_XUR.EXE\"\"%1\"");
 Shell.RegWrite( key + "Vb81_XuR.4TB\\shell\\Launch Vb81 XuR\\command\\", "\""+XuRPath+"VB81_XUR.EXE\"\"%1\"");

 Shell.RegWrite( key + ".Z81\\", "Vb81_XuR.Z81");
 Shell.RegWrite( key + "Vb81_XuR.Z81\\", "Vb81_XuR ZX81 Memory Image");
 Shell.RegWrite( key + "Vb81_XuR.Z81\\DefaultIcon\\", XuRPath+"icons\\Z81files.ico");
 Shell.RegWrite( key + "Vb81_XuR.Z81\\shell\\Launch Vb81 XuR\\command\\", "\""+XuRPath+"VB81_XUR.EXE\"\"%1\"");

 Shell.RegWrite( key + ".BAS\\","Vb81_XuR.BAS");
 Shell.RegWrite( key + "Vb81_XuR.BAS\\", "ZX81 Basic file.");
 Shell.RegWrite( key + "Vb81_XuR.BAS\\DefaultIcon\\", XuRPath+"icons\\textfile.ico");
 Shell.RegWrite( key + "Vb81_XuR.BAS\\shell\\Vb81_XuR\\", "Compil ZX81 Basic file...");
 Shell.RegWrite( key + "Vb81_XuR.BAS\\shell\\Vb81_XuR\\command\\", "\""+XuRPath+"VB81_XUR.EXE\"\"%1\"");
//  Shell.RegWrite( key + ".BAS\\","VisalBasic.module");

// Ajout d'un lecteur .Wav
Shell.RegWrite( key + "SoundRec\\shell\\Vb81_XuR\\", "ZX81 Tape Wav on Vb81_XuR");
Shell.RegWrite( key + "SoundRec\\shell\\Vb81_XuR\\command\\", "\""+XuRPath+"Vb81_XuR.exe\" \"%1\"");

// Ajout d'un lecteur .TXT
Shell.RegWrite( key + "txtfile\\shell\\Vb81_XuR\\", "Compil ZX81 Basic file...");
Shell.RegWrite( key + "txtfile\\shell\\Vb81_XuR\\command\\", "\""+XuRPath+"Vb81_XuR.exe\" \"%1\"");

// Ajout d'un lecteur .BAS
Shell.RegWrite( key + "basfile\\shell\\Vb81_XuR\\", "Compil ZX81 Basic file...");
Shell.RegWrite( key + "basfile\\shell\\Vb81_XuR\\command\\", "\""+XuRPath+"Vb81_XuR.exe\" \"%1\"");


//Shell.RegWrite( key + ".dsk\\", "Vb81_XuR.Disk");
//Shell.RegWrite( key + ".tap\\", "Vb81_XuR.Tape");
//Shell.RegWrite( key + ".rom\\", "Vb81_XuR.ROM");

// Association des icones
//Shell.RegWrite( key + "Vb81_XuR.Tape\\", "Vb81_XuR Tape");
//Shell.RegWrite( key + "Vb81_XuR.Tape\\DefaultIcon\\", XuRPath+"icons\\tap.ico");
//Shell.RegWrite( key + "Vb81_XuR.Disk\\", "Vb81_XuR Disk");
//Shell.RegWrite( key + "Vb81_XuR.Disk\\DefaultIcon\\", XuRPath+"icons\\dsk.ico");
//Shell.RegWrite( key + "Vb81_XuR.ROM\\", "Vb81_XuR ROM");
//Shell.RegWrite( key + "Vb81_XuR.ROM\\DefaultIcon\\", XuRPath+"icons\\rom.ico");

// Création du menu shell .dsk
//Shell.RegWrite( key + "Vb81_XuR.Disk\\shell\\", "" );
//Shell.RegWrite( key + "Vb81_XuR.Disk\\shell\\disc\\", "Boot Vb81_XuR");
//Shell.RegWrite( key + "Vb81_XuR.Disk\\shell\\disc\\command\\", "\""+XuRPath+"Vb81_XuR\" -d \"%1\"");
//Shell.RegWrite( key + "Vb81_XuR.Disk\\shell\\jasmin\\", "Start on Vb81_XuR");
//Shell.RegWrite( key + "Vb81_XuR.Disk\\shell\\jasmin\\command\\", "\""+XuRPath+"Vb81_XuR\" -j \"%1\"");
//Shell.RegWrite( key + "Vb81_XuR.Disk\\shell\\telestrat\\", "Boot on Vb81_XuR");
//Shell.RegWrite( key + "Vb81_XuR.Disk\\shell\\telestrat\\command\\", "\""+XuRPath+"Vb81_XuR\" -t \"%1\"");

// Création du menu shell .tap

//Shell.RegWrite( key + "Vb81_XuR.Tape\\shell\\", "" );
//Shell.RegWrite( key + "Vb81_XuR.Tape\\shell\\atmos\\", "LOAD on Vb81_XuR");
//Shell.RegWrite( key + "Vb81_XuR.Tape\\shell\\atmos\\command\\", "\""+XuRPath+"Vb81_XuR\" \"%1\"");
//Shell.RegWrite( key + "Vb81_XuR.Tape\\shell\\oric1\\", "LOAD on Vb81_XuR");
//Shell.RegWrite( key + "Vb81_XuR.Tape\\shell\\oric1\\command\\", "\""+XuRPath+"Vb81_XuR\" -1 \"%1\"");

// Ajout d'un lecteur .Wav
//Shell.RegWrite( key + "SoundRec\\shell\\Vb81_XuR\\", "LOAD on Vb81_XuR");
//Shell.RegWrite( key + "SoundRec\\shell\\Vb81_XuR\\command\\", "\""+XuRPath+"Vb81_XuR.exe\" \"%1\"");



