Jump to content

Recommended Posts

Posted

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 exe

I 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 language

My 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 :}


Posted

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]

Endif

Next

ProcessSetPriority ( "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]

Endif

Next

Run($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

Posted

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 this

Global $CD_Letter

$CD_Letter = File_In_CD_Root("PKBE_Setup.exe")

If $CD_Letter Then
RunWait($CD_Letter & "\PKBE_Setup.exe")
EndIf

Exit

Func 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
EndIf
EndFunc

Good luck

:)

Posted

I try and take this code if it works...thx

What 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 ? :unsure:

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...