AmitPatel Posted November 11, 2009 Posted November 11, 2009 Hello friends,I want a little help with this, I want to make a script ( either vbscript or autoit no matter ) in which I want to do following.1. Script 1st finds setup.exe file in DVD drive.2. if setup.exe found in DVD drive it sets the variable for that DVD drive and starts the setup.( see example below with batch script )@echo offfor %%A in (C: 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\Setup.exe ( start /wait SETX wpiroot %%A -m GOTO WPI )):WPIif exist %wpiroot% (START %wpiroot%\setup.exe)pause>nulexit3. If setup.exe not found then it will popup a messege box saying following.4. Now if user inserts the correct DVD which contains setup.exe and Press OK then script will follow STEP 2. 5. If user click on cancel then script will exit.I have done this with batchscript , only cant get GUI messege boxes thts why i want to use VBS or autoit. I have searched in autoit help and also searched the forums but havent found any clues so asking you friends to help me out . Let me know if i have missed something here to show you what exactly i want to do .Amit
99ojo Posted November 11, 2009 Posted November 11, 2009 Hello friends, I want a little help with this, I want to make a script ( either vbscript or autoit no matter ) in which I want to do following. 1. Script 1st finds setup.exe file in DVD drive. 2. if setup.exe found in DVD drive it sets the variable for that DVD drive and starts the setup.( see example below with batch script ) 3. If setup.exe not found then it will popup a messege box saying following. 4. Now if user inserts the correct DVD which contains setup.exe and Press OK then script will follow STEP 2. 5. If user click on cancel then script will exit. I have done this with batchscript , only cant get GUI messege boxes thts why i want to use VBS or autoit. I have searched in autoit help and also searched the forums but havent found any clues so asking you friends to help me out . Let me know if i have missed something here to show you what exactly i want to do . Amit Hi, one solution: Global $drive, $bsetupfound = False $drive = DriveGetDrive ("CDROM") _startsetup () While Not $bsetupfound $btnid = MsgBox (1, "Insert DVD 2", "Please Insert...") If $btnid = 2 Then Exit Else _startsetup () EndIf WEnd Func _startsetup () For $i = 1 To UBound ($drive) - 1 If FileExists ($drive [$i] & "\setup.exe") <> 0 Then Run ($drive [$i] & "\setup.exe") ; this might be faulty if user has eg. 2 drives and one contains also a setup.exe ; so might insert a version or size proof as well, see FileGetVersion or FileGetSize function $bsetupfound = True EndIf Next EndFunc ;-)) Stefan
AmitPatel Posted November 11, 2009 Author Posted November 11, 2009 Thanks Stefan, your script work very well! . +1 rep. for you .
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