Jump to content
Sign in to follow this  
AmitPatel

[Help] Find and run setup from DVD

Recommended Posts

AmitPatel

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 off

for %%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

)

)

:WPI

if exist %wpiroot% (

START %wpiroot%\setup.exe)

pause>nul

exit

3. If setup.exe not found then it will popup a messege box saying following.

Posted Image

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

Share this post


Link to post
Share on other sites
99ojo

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.

Posted Image

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

Share this post


Link to post
Share on other sites
AmitPatel

Thanks Stefan, your script work very well! :).

+1 rep. for you ;).

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.