Jump to content
Sign in to follow this  
solid2005

Help For the Func

Recommended Posts

solid2005

CODE
Func GetRemAndFixedDrives()

Local $RetErr = 0

Local $RetDrivesArr = DriveGetDrive("REMOVABLE")

Else $RetDrivesArr = "a:" or $RetDrivesArr = "b:" Then ContinueLoop

$DriveStatus = DriveStatus($RetDrivesArr)

Else $DriveStatus = "NotReady" Then ContinueLoop

If @error Then

Local $RetDrivesArr[1]

$RetErr = 1

EndIf

Local $FixedDrivesArr = DriveGetDrive("FIXED")

If @error And $RetErr Then Return SetError(1)

Local $Ubound

For $i = 1 To UBound($FixedDrivesArr)-1

$Ubound = UBound($RetDrivesArr)

ReDim $RetDrivesArr[$Ubound+1]

$RetDrivesArr[$Ubound] = $FixedDrivesArr[$i]

Next

$RetDrivesArr[0] = $Ubound

Return $RetDrivesArr

EndFunc

Can Some One Fix This I get stuck when using this Script.

Edited by solid2005

Share this post


Link to post
Share on other sites
ChrisL

What is this supposed to do? Did you write this or take it from somewhere else. As it is it will never work.

Give us some information about what EXACTLY this should do and we might be able to help

Edit: I think this is what your trying to do?

#include <Array.au3>

$aDrives= GetRemAndFixedDrives()

_ArrayDisplay($aDrives)

Func GetRemAndFixedDrives()
    Local $RetErr = 0
    Local $ReMoveableDrivesArr = DriveGetDrive("REMOVABLE")
    Local $RetArray[1]
    
    For $i = 1 to UBound($ReMoveableDrivesArr) -1
        If $ReMoveableDrivesArr[$i] = "a:" or $ReMoveableDrivesArr[$i] = "b:" Then ContinueLoop
        $DriveStatus = DriveStatus($ReMoveableDrivesArr[$i])
        If $DriveStatus = "NotReady" Then ContinueLoop
        ReDim $RetArray[Ubound($RetArray) +1]
        $RetArray[Ubound($RetArray) -1] = $ReMoveableDrivesArr[$i]
    Next


    Local $FixedDrivesArr = DriveGetDrive("FIXED")
    For $i = 1 To UBound($FixedDrivesArr)-1
        ReDim $RetArray[Ubound($RetArray) +1]
        $RetArray[Ubound($RetArray) -1] = $FixedDrivesArr[$i]
    Next
    $RetArray[0] = Ubound($RetArray)-1
    IF $RetArray[0] = 0 then SetError(1)
    Return $RetArray
    
EndFunc
Edited by ChrisL

Share this post


Link to post
Share on other sites
solid2005

Thanks About This

Edited by solid2005

Share this post


Link to post
Share on other sites
ChrisL

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  

×