Code: Select all
; ======================================================================================================================
; Funktion DriveGetObj()
; Ersatz für das AHK-eigene DriveGet/DriveSpaceFree-Kommando.
; Die Funktion erstellt ein Array mit den Schlüsseln
; "List"
; "ListAvailable"
; "Capacity"
; "CapacityFree"
; "FileSystem"
; "Label"
; "Serial"
; "Type"
; "Status"
; "StatusCD"
; ... und den Werten der entsprechenden Ausgabevariablen des DriveGet/DriveSpaceFree-Kommandos.
; ======================================================================================================================
DriveGetObj(var:="C:\") { ;Rückgabe von drive properties mittels AHK Standard-Kommando
local
if var in CDROM,REMOVABLE,FIXED,NETWORK,RAMDISK,UNKNOWN
DriveGet, list, List ,% var
else { DriveGet, list, List
listAvailable := SubStr(RegExReplace("CDEFGHIJKLMNOPQRSTUVWXYZ", "[" . list . "]"),-24) ;Retrieves the available drive letters
StringUpper, list, list ;Kosmetik. Angleichung zur Großschreibung bei Ausgabe in MsgBox
}
var := StrLen(var) = 1 ? RegExReplace(var,"\W") ":\" : var
DriveGet, capacity, Capacity , % var ;Retrieves the total capacity of the specified path in megabytes.
DriveGet, filesystem, FileSystem , % var ;Retrieves the type of the specified drive's file system.
DriveGet, label, Label , % var ;Retrieves the volume label of the specified drive.
DriveGet, serial, Serial , % var ;Retrieves the volume serial number of the specified drive.
DriveGet, type, Type , % var ;Retrieves the drive type of the specified path.
DriveGet, status, Status , % var ;Retrieves the status of the specified path.
DriveGet, statusCD, StatusCD , % var ;Retrieves the media status of a CD or DVD drive.
DriveSpaceFree, CapacityFree, % var ;Retrieves the free disk space of a drive, in Megabytes.
Return { List: list ; Assoziatives Array erstellen und zurückgeben
, Available: listAvailable
, Capacity: capacity
, CapacityFree: CapacityFree
, FileSystem: filesystem
, Label: label
, Serial: serial
, Type: type
, Status: status
, StatusCD: statusCD}
}