staline Posted September 3, 2006 Posted September 3, 2006 (edited) As IT consultant, I'm always travelling from a customer to other.I'm used to carry a nice 2.5 HD firewire and USB external drive with all my programs I need to do the job.WPI is very nice, but I often got problem: wrong drive letter.I solved this by a simple modification to make it simpler:I added the file WPI.ICO at the root of my drive.And I modified function findcdrom()function FindCDRom(){ position="generate.js"; whatfunc="FindCDRom()"; var a, i, li; if (foundCDdrv) return cddrv; li = GetCDRomDriveLetters(); for(i=0; i<li.length; i++) { if (FileExists(li[i]+'\\WPI.ICO')) cddrv = li[i]; } foundCDdrv = true; return cddrv;}What it does:when the function getcdrom is called, it will scan all available drives to find a file named WPI.ICO. When the file WPI.ICO is found, it assigns the drive letter to value cddrv .Of course, WPI scripts AND files to install must be in the same drive.Hope it will help someonetoo lazy to edit the file? Get the attachment !!!!generate.js Edited September 3, 2006 by staline
mritter Posted September 4, 2006 Posted September 4, 2006 I already made an update like this for 5.4. What mine does is scan all the fixed disks (harddrives) and compares the letter with wpipath. If they match, started from harddrive and WPI will use it accordingly for a new USSF feature I also added for 5.4. If not hdd is "" (blank) and assumes started from CD/DVD and continues with those checks as normal.With this new feature WPI checks if started from CD/DVD or HDD. If CD/DVD then it will auto-hide the Extra Buttons (Options, Config.......). If from HDD it will show the Extra Buttons. No more having to remember to turn them off in Options before burning your disc.
faresalandlos Posted September 4, 2006 Posted September 4, 2006 what are you all doing that is very strangeyou make it hard at your selfjust replace the cdroom drive letterwith this word %cdrom%like that if your cdrom drive letter is d:u writed:\Acrobat_Reader_7.exejust replace and it will run from the cdrom and find it whatever the letter is!%cdrom%\Other\Acrobat_Reader_7.exe
zorphnog Posted September 5, 2006 Posted September 5, 2006 @faresalandlos: %cdrom% is a WPI variable and not a ms-dos variable. It is only set once WPI is started. What they are talking about is the code used to set the %cdrom% variable.Just wanted to make sure you understood. Welcome to MSFN and WPI!
faresalandlos Posted October 15, 2006 Posted October 15, 2006 @faresalandlos: %cdrom% is a WPI variable and not a ms-dos variable. It is only set once WPI is started. What they are talking about is the code used to set the %cdrom% variable.Just wanted to make sure you understood. Welcome to MSFN and WPI! thanks man and sorry for being late
muiz Posted October 21, 2006 Posted October 21, 2006 The only problem i have is when a cardreader is attached to the pc.Then its all messed up. it says no disc in drive.I found one or two other topics about this , but couldnt find an answer.
lawrenca Posted October 21, 2006 Posted October 21, 2006 (edited) @muiz,Isn't that the reasoning behind using the %cdrom%, %wpipath% or %root% variable? These should provide the relative path to WPI regardless of whether you are launching from cdrom or not. The only possible issue would be on initial installation of the OS when all the drives have not been assigned yet, and you are coming back after a reboot or plug'n play...but even those issues are easily worked.What stage are you losing the paths to your installs? Is it just plugging in a card reader? Since these paths are relative to where you launch wpi.hta, it seems they should resolve properly. Edited October 21, 2006 by lawrenca
pmshah Posted October 22, 2006 Posted October 22, 2006 (edited) If it is fresh installation of the OS you are working with why don't you preassign a letter like "W" to the cdrom using diskpart in run_once? You can be pretty sure than it will be a long time before your usual range of d, e, f, etc are taken up by the volumes created on the fixed hdd or added on volumes like card readers, pen drives or anything attached to the USB port. Edited October 28, 2006 by pmshah
muiz Posted October 23, 2006 Posted October 23, 2006 @muiz,Isn't that the reasoning behind using the %cdrom%, %wpipath% or %root% variable? These should provide the relative path to WPI regardless of whether you are launching from cdrom or not. The only possible issue would be on initial installation of the OS when all the drives have not been assigned yet, and you are coming back after a reboot or plug'n play...but even those issues are easily worked.What stage are you losing the paths to your installs? Is it just plugging in a card reader? Since these paths are relative to where you launch wpi.hta, it seems they should resolve properly. XP setup went fine , but when WPI starts......NO DISC IN DRIVE.Without the cardreader attached to the computer , it runs fine.
gunsmokingman Posted October 23, 2006 Posted October 23, 2006 i do not know if this will help but here is a js script that will return the drive letter using WMI.I have it set using the $OEM$ folder and the cmdlines.txt as the check, you will have to edit thatto match what you need.var wbemFlagReturnImmediately = 0x10;var wbemFlagForwardOnly = 0x20;var Fso = new ActiveXObject("Scripting.FileSystemObject");var Act = new ActiveXObject("Wscript.Shell");var Drv/* PLACE THE FILE NAME HERE THIS IS JUST A EXAMPLE AND USES THE $OEM$ FOLDER AND CMDLINES.TXT*/var WPI = "\\$OEM$\\cmdlines.txt" var objWMIService = GetObject("winmgmts:\\\\.\\root\\CIMV2"); var colItems = objWMIService.ExecQuery("SELECT * FROM Win32_CDROMDrive", "WQL", wbemFlagReturnImmediately | wbemFlagForwardOnly); var enumItems = new Enumerator(colItems); for (; !enumItems.atEnd(); enumItems.moveNext()) { var objItem = enumItems.item(); Drv = objItem.Drive + WPI; if (Fso.FileExists(Drv)) {(Act.Popup("Set The CD Drive Letter = " + Drv, 7,"Confirm", 0 + 32 + 4096));} else { Act.Popup("Can not find the CD or DVD drive?", 7,"Missing", 0 + 32 + 4096)} ;}
Guest zium Posted October 23, 2006 Posted October 23, 2006 i do not know if this will help but here is a js script that will return the drive letter using WMI.I have it set using the $OEM$ folder and the cmdlines.txt as the check, you will have to edit thatto match what you need.var wbemFlagReturnImmediately = 0x10;var wbemFlagForwardOnly = 0x20;var Fso = new ActiveXObject("Scripting.FileSystemObject");var Act = new ActiveXObject("Wscript.Shell");var Drv/* PLACE THE FILE NAME HERE THIS IS JUST A EXAMPLE AND USES THE $OEM$ FOLDER AND CMDLINES.TXT*/var WPI = "\\$OEM$\\cmdlines.txt" var objWMIService = GetObject("winmgmts:\\\\.\\root\\CIMV2"); var colItems = objWMIService.ExecQuery("SELECT * FROM Win32_CDROMDrive", "WQL", wbemFlagReturnImmediately | wbemFlagForwardOnly); var enumItems = new Enumerator(colItems); for (; !enumItems.atEnd(); enumItems.moveNext()) { var objItem = enumItems.item(); Drv = objItem.Drive + WPI; if (Fso.FileExists(Drv)) {(Act.Popup("Set The CD Drive Letter = " + Drv, 7,"Confirm", 0 + 32 + 4096));} else { Act.Popup("Can not find the CD or DVD drive?", 7,"Missing", 0 + 32 + 4096)} ;}Ok thx , but a bit more info about how to use this plz.
gunsmokingman Posted October 23, 2006 Posted October 23, 2006 The js script will only check for CD or DVD drives, I added the script to address this problem. muizXP setup went fine , but when WPI starts......NO DISC IN DRIVE.Without the cardreader attached to the computer , it runs fine.
gunsmokingman Posted October 23, 2006 Posted October 23, 2006 (edited) Where do i put this?I am not sure as I have not used WPI and only provided the script as another way to set the drive letter.Here is a Cmd Promt script that will only check for the CD DVD drive 1:\ Makes a vbs script that checks only for the CD DVD drive2:\ Outputs the CD DVD drive letter to a new cmd script3:\ Then it calls the new cmd script and passes the CD DVD drive Letter back to the original scriptNote you will have to change this line to match the file it will be looking for with WPIRed text is the part you have to change please keep the quotations Echo If Fso.FileExists(StrD ^& "\$OEM$\cmdlines.txt") Then >> %CDDVD%Save As Set_CDDVD_Drv.cmd@Echo OffCLSColor F9Mode 65,5Title Set CD DVD Drive LetterEcho. Echo Processing the CD DVD Drive Letterset CDDVD=%SystemDrive%\CDDVD.vbsEcho Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject") > %CDDVD%Echo Dim Drv, strFileName, StrD, TS >> %CDDVD%Echo Set Drv = Fso.Drives >> %CDDVD% Echo strFileName = Fso.BuildPath(Wscript.ScriptFullName ^& "\..", "CDDVD.cmd") >> %CDDVD% Echo strFileName = Fso.GetAbsolutePathName(strFileName) >> %CDDVD% Echo For Each StrD In Drv >> %CDDVD% Echo If StrD.DriveType = 4 Then >> %CDDVD%Echo If StrD.IsReady = True Then >> %CDDVD%Echo If Fso.FileExists(StrD ^& "\$OEM$\cmdlines.txt") Then >> %CDDVD%Echo Set TS = Fso.CreateTextFile(strFileName) >> %CDDVD%Echo Ts.WriteLine "Set CDROM=" ^& StrD ^& "\" >> %CDDVD%Echo TS.Close >> %CDDVD%Echo Else >> %CDDVD% Echo Set TS = Fso.CreateTextFile(strFileName) >> %CDDVD%Echo Ts.WriteLine "Set CDROM=Wrong_CD_DVD" >> %CDDVD%Echo TS.Close >> %CDDVD%Echo End If >> %CDDVD%Echo End If >> %CDDVD%Echo Else >> %CDDVD% Echo Set TS = Fso.CreateTextFile(strFileName) >> %CDDVD%Echo Ts.WriteLine "Set CDROM=No_CD_DVD_Disk_In_Drive" >> %CDDVD%Echo TS.Close >> %CDDVD%Echo End If >> %CDDVD%Echo Next >> %CDDVD%Start /w %CDDVD%Call %SystemDrive%\CDDVD.cmdSet %CDROM%=Del %CDDVD%Del %SystemDrive%\CDDVD.cmdEcho %CDROM%Pause Edited September 18, 2007 by gunsmokingman
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now