Jump to content

multiple cd drives and autoit


ripken204

Recommended Posts

im pretty sure that this has been asked before but i cant find it

well im going to be using virtual cd drives to test out my xpcd on vmware and how should i go about doing it with autoit. i have a drive f: h: i: j: . and i could possibly use any of them for my install, how can i make it generic to select what drive to install stuff from b/c i will be installing programs from the cd. or to make it easier would you just suggest copying all of the programs to the c: drive, then install them, then delete them?

Link to comment
Share on other sites


I'd suggest leaving stuff on the CD\DVD unless there is a really good reason.

Older script...MHz has a newer more buff version of this:

Global $Drive

Func _FindDrive($type, $name)
  Local $drvs
  While Not $Drive
     $drvs = DriveGetDrive($type)
     If Not @error Then
        For $i = 1 To $drvs[0]
           If DriveStatus($drvs[$i] & "\") = "READY" Then
              If FileExists($drvs[$i] & "\" & $name) Or DriveGetLabel($drvs[$i]) = $name Then
                 $Drive = $drvs[$i] & "\"
                 Return $Drive
              EndIf
           EndIf
        Next
        If Not $Drive Then
           If StringInStr("CDROM|REMOVABLE|NETWORK", $type) Then
              If StringInStr("CDROM|REMOVABLE", $type) Then
                 If MsgBox(21, "Warning", "Please insert media into a drive now") = 2
                    Sleep(1000)
                    If MsgBox(36, 'Important', 'Are you sure that you want to exit?') = 6 Then Exit
              ElseIf $type = "NETWORK" Then
                 If MsgBox(21, "Warning", "Please connect to a network now") = 2 Then
                    Sleep(1000)
                    If MsgBox(36, 'Important', 'Are you sure that you want to exit?') = 6 Then Exit
                 EndIf
              EndIf
           Else
              If MsgBox(36, 'Drive Not Found', 'Drive could not be found would you like to exit?') = 6 Then Exit
           EndIf
           Sleep(2000)
        EndIf
     EndIf
  WEnd
EndFunc

Basically use some thing like this then to find the XP isntall disk:

_FindDrive( "CDROM" , "WIN51" )

Which would then set the global var of $Drive to what ever drive that is....so if it was on say drive Z....then $Drive would equal Z:\

So you would then have some thing like this else where in the script

RunWait ( $Drive & "SOFTWARE\Tools - CD & DVD\ASPI\ASPI_4.71.2_au3.exe" )

To launch an app on the XP CD in a sub folder of "SOFTWARE"

Link to comment
Share on other sites

Your suppose to use all the code listed above.

To find you CD disk labeled "xpcd" you would invoke:

_FindDrive( "CDROM" , "xpcd" )

Since the $name paramiter of the fuction is good for both looking for the title of the storage unit...or a file on the storage unit.

The $type param....is for dictating what type of storage unit to search for. Values availabe are: "ALL", "CDROM", "REMOVABLE", "FIXED", "NETWORK", "RAMDISK", or "UNKNOWN"

Link to comment
Share on other sites

Here is a VBS script that will list all the drive type

This Color Is Inactive It checks to see if the check file is

there, remove ' those from before the begining. To Make

Active Remove The ' from in front of the text.

Add the Sfile to run the check.

This Color is the check file it check for, Place in between the " "

This can be a full path EG Sfile="\Afolder\Bfolder\WhateverCheck.Exe"

This Color Is A Popup that will list each drive this can be removed from the script

Dim Act, Fso, Drv, Sfile, strDrive

Set Act = CreateObject("Wscript.shell")

Set fso = CreateObject("Scripting.FileSystemObject")

'''' Place A Check File Here EG win51

Sfile = ""

   Set Drv = Fso.Drives

   For Each strDrive in Drv

   Act.Popup "This Is Drive, " & strDrive & "\", 3, "List Drives", 0 + 32

  ' If Fso.FileExists(strDrive & Sfile) Then

  ''''PLACE IF IT HERE ACTION HERE

  ' Exit For

  ' Else

  ''''PLACE IF IT NOT HERE ACTION HERE

  ' Exit For

  ' End If

  Next

Edited by gunsmokingman
Link to comment
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
  • Recently Browsing   0 members

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