Sign in to follow this  
Followers 0
bird42

drive detect

4 posts in this topic

i want to make a script which detects i f a drive is plugged in... can u help me?

Share this post


Link to post
Share on other sites



??

There is a whole family of drive-related functions. Read the help ?

Especially DriveStatus seems suited to your needs.

Share this post


Link to post
Share on other sites

i alredy know drive related functions but i don't want to write a loop such this:

while 1
    $var = DriveGetDrive( "REMOVABLE" )
    For $i = 1 to $var[0]
;do something
next
EndSelect
WEnd

i need a script like this

repeat

sleep(100)

until a usb is plugged

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

From G. Born's press

; Drive type constants
Const Global Unknown = 0
Const Global Removable = 1      ; Removable medium
Const Global Fixed = 2          ; Fixed medium (hard disk)
Const Global Remote = 3             ;Network drive
Const Global CDROM = 4          ; CD-ROM
Const Global RAMDisk = 5                ; RAM disk

Dim $fso, $oDrive, $Drive

$fso = ObjGet("Scripting.FileSystemObject")
$oDrive = $fso.Drives

For $Drive In $oDrive
     Switch $Drive.DriveType

          Case Unknown
                    .....

          Case Fixed
                    .....
     EndSwitch
Next

;... by G. Born
Edited by Authenticity

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  
Followers 0