Jump to content
Sign in to follow this  
bird42

drive detect

Recommended Posts

bird42

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
Inverted

??

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
bird42

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
Authenticity

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  

×

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.