Efo74 Posted December 20, 2011 Posted December 20, 2011 It is not best of programming but it works.#include <File.au3>#include <Process.au3>$var = _Get_Phisical_Disk_Numbers()for $i=1 to $var[0] Msgbox(0,"\\.\PhysicalDrive" & $var[$i],$var[$i])Next;********************************************************************************Func _Get_Phisical_Disk_Numbers();return the number of Phisical Drives installed \\.\PhysicalDrive(x);return array, array[0] = number of disk find;array[0]=-1 if error;********************************************************************************Dim $Array_return[100]$Array_return[0] = 0$phisical_disk_find = 0$s_TempFile = _TempFile()$Run_command_line = "wmic partition get name,size,type >" & '"' & $s_TempFile & '"'_RunDOS($Run_command_line) if FileExists($s_TempFile)=0 Then $Array_return[0]=-1 return $Array_return EndIf$file = FileOpen($s_TempFile, 0)If $file = -1 Then $Array_return[0]=-1 return $Array_returnEndIfWhile 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop $start_extract = StringInStr($line, "#") if $start_extract <> 0 Then $start_extract+=1 $end_extract = StringInStr($line,",",0,1,$start_extract) if $end_extract <> 0 Then $str_disk_n = StringMid($line,$start_extract,$end_extract-$start_extract) if ($str_disk_n <> "") Then $phisical_disk_find+=1 $Array_return[0]=$phisical_disk_find $Array_return[$phisical_disk_find]=$str_disk_n EndIf EndIf EndIfWendFileClose($file)FileDelete($s_TempFile)return $Array_returnEndFunc :rolleyes:
JohnOne Posted December 21, 2011 Posted December 21, 2011 I have not ran your code, but is it different to the native function "DriveGetDrive()" ? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Efo74 Posted December 22, 2011 Author Posted December 22, 2011 Yes John, DriveGetDrive return --> "C:" "D:" ... My Function return ---> 0 1 2 For example C: can not be 0 :rolleyes:
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now