rmmastermind Posted August 18, 2006 Posted August 18, 2006 First, Hi to all (I'm new here)I want to install my favorite game with autoit (with the original dvd)My script for silent install of my game is done but I'd like to AutoIt retrive my CDRom letter then launch the setup exeI used this code (batch file)wich occures me a lot of problem(...I'll won't explain it but after many changes I founded no issues), after, launching my compiled script wich installmy game :FOR %%a in (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 %%a:\PKBE_Setup.exe set CDROM=%%a: "%CDROM%\PKBE_Setup.exe"I'm looking for the same code in AutoIt languageMy setup is PKBE_Setup.exe (in the root of the dvd)I launch my compiled script from a batch file (from a cd on my other cdrom drive)I hope someone will help me because I'm unable to write this code
rmmastermind Posted August 18, 2006 Author Posted August 18, 2006 I made a little search on the board with 'drivegetdrive' (my other seachs was with 'autoit') and I founded that :$CD = DriveGetDrive("CDROM")For $I=1 to Number($CD[0])$pa = $CD[$I] & "\win51ip.SP2" If FileExists($pa) Then $instDrv=$CD[$I] EndifNextProcessSetPriority ( "setup.exe", 0)Run($instDrv & "\$oem$\WatchDriverSigningPolicy.exe")ProcessWait("WatchDriverSigningPolicy.exe")RunWait($instDrv & "\$oem$\SetupCopyOEMInf.exe " & $instDrv & "\$oem$\Drivers")ProcessClose("WatchDriverSigningPolicy.exe")ProcessSetPriority ( "setup.exe", 2)FileDelete(@SystemDir & "\driver.au3")After changing it's :$CD = DriveGetDrive("CDROM")For $I=1 to Number($CD[0])$pa = $CD[$I] & "\PKBE_Setup.exe" If FileExists($pa) Then $instDrv=$CD[$I] EndifNextRun($instDrv & "\PKBE_Setup.exe")It seems to work ; I will say you if it works great (because i install the game during windows xp installation...)Thx
MHz Posted August 19, 2006 Posted August 19, 2006 Nice to see that you helped yourself out. Just one thing is you should check @error after using DriveGetDrive() and before using the array to prevent a soft error message from AutoIt which can halt the operation.I did some changes and was left with thisGlobal $CD_Letter$CD_Letter = File_In_CD_Root("PKBE_Setup.exe")If $CD_Letter Then RunWait($CD_Letter & "\PKBE_Setup.exe")EndIfExitFunc File_In_CD_Root($file) Local $I, $CD $CD = DriveGetDrive("CDROM") If Not @error Then For $I = 1 to $CD[0] If FileExists($CD[$I] & "\" & $file) Then Return $CD[$I] Endif Next EndIfEndFuncGood luck
rmmastermind Posted August 19, 2006 Author Posted August 19, 2006 I try and take this code if it works...thxWhat would be nice is :If the error comes... have a message box with "it's not the good cd; inser the cd "my game" and press ok" and then when ok is pressed my sript begin again...(even not checking the cdlabel, if my setup.exe doesn't exist, it's not the good cd...)Any help ?
MHz Posted August 21, 2006 Posted August 21, 2006 Perhaps my FindCD() UDF here may help you with the message box warnings.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now