Sign in to follow this  
Followers 0
HiSoftDev

i need it

10 posts in this topic

i want to detect USB devices only for deleting and copying some data from their root.

my problem is that i want to exclude "A:\" drive from detecting using DriveGetDrive("REMOVABLE").

"A:\" Drive is floppy drive which i want to exclude from detection of USB Devices.

it should also not work if the drive is not ready. i hope some of you will help me.

Thanks for reading and any help in future.


Share this post


Link to post
Share on other sites



i think this can solve your problem

$DISC=DriveGetDrive("Removable")
For $A=1 To UBound($DISC)-1
    If $DISC[$A] <>  "A:" Then
        $STATUS=DriveStatus($DISC[$A])
        If $STATUS="READY" Then
            MsgBox(0, '', $DISC[$A])
        Else
            MsgBox(0, "Not Ready", $DISC[$A])       
        EndIf
    EndIf       
Next

Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, ‘What happened?’” –Casey Stengel

Share this post


Link to post
Share on other sites

Thanks but My Problem is not solved.

your code is Perfect but not complete, i want that the USB Device should be not detected if it have no data or is empty.

can any of you help the newbie?

Plzzzzzzzz


Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thanks but My Problem is not solved.

your code is Perfect but not complete, i want that the USB Device should be not detected if it have no data or is empty.

can any of you help the newbie?

Plzzzzzzzz

You can't take a look at the helpfile with the example provided and discover that it only takes 2 more lines? Like, _FileListToArray()?

EDIT: Put talk instead of Take, heh.

Edited by Alienware

Share this post


Link to post
Share on other sites

Thanks but My Problem is not solved.

your code is Perfect but not complete, i want that the USB Device should be not detected if it have no data or is empty.

can any of you help the newbie?

Plzzzzzzzz

Example:

$aDrive = DriveGetDrive("Removable")
If @error Then Exit

For $i = 1 To $aDrive[0]
    If $aDrive[$i] <> "a:" Then
        If (DriveStatus($aDrive[$i]) = "READY") And (FileExists($aDrive[$i] & "\*.*")) Then MsgBox(0, "USB", $aDrive[$i])
    EndIf      
Next

Share this post


Link to post
Share on other sites

@ rasim

thanks for your code. will it work if the files have "+SHR" Attributes?


Share this post


Link to post
Share on other sites

Example:

$aDrive = DriveGetDrive("Removable")
If @error Then Exit

For $i = 1 To $aDrive[0]
    If $aDrive[$i] <> "a:" Then
        If (DriveStatus($aDrive[$i]) = "READY") And (FileExists($aDrive[$i] & "\*.*")) Then MsgBox(0, "USB", $aDrive[$i])
    EndIf      
NextoÝ÷ Ûú®¢×¢ê¡סj÷¬¢g®º+²)ì×*´7¯ØbKaÇ(uè¬=êßyËg£§w*.®ènW¦Â)emë(÷jëh×6$DISC = DriveGetDrive("Removable")
For $X = 1 To UBound($DISC)-1
    If $DISC[$X] <>  "A:" Then
        $STATUS = DriveStatus($DISC[$X])
        If $STATUS = "READY" And FileExists($DISC[$X] & "*.*") Then
            MsgBox(0, "Drive is Ready And Have Some Data", "Drive Name: ' " & $DISC[$X] & "\ '")
        Else
            MsgBox(0, "Following Drive is detected and have no data", "Drive Name: ' " & $DISC[$X] & "\ '")     
        EndIf
    EndIf       
Next

can anyone optimize and improve this code?


Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, ‘What happened?’” –Casey Stengel

Share this post


Link to post
Share on other sites

HiSoftDev

Open mouth, put food... Instead of asking, you can check this, it not is difficult.

ChromeFan

Your Code have some errors inside

Where? Show me please. Your example identical my example and have error in this line:

If $STATUS = "READY" And FileExists($DISC[$X] & "*.*") Then

You have forgotten to add a back slash. Should be FileExists($DISC[$X] & "\*.*"), because DriveGetDrive() returns a array contains drive in this representation: a: c: d: and etc... :)

Share this post


Link to post
Share on other sites

i was already testing a script which gave some error and i thought it's your script! i was out of mind. sorry for that :)


Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, ‘What happened?’” –Casey Stengel

Share this post


Link to post
Share on other sites

ChromeFan

OK. Never mind :)

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