Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Enumerate hard disks, exclude partitions
#23
this fixes dialog static text display really don't need a mes before if your showing same thing in dialog its redundant. also clean up the function some got rid of unused variables

Code:
Copy      Help
_s.expandpath("$desktop$\diskpartinfo.txt")
str s cl=F"cmd.exe /C diskpart /s ''{_s}''"
RunConsole2 cl s
s.trim
int i tt ttt tttt tset
str disklist partitionlist1 partitionlist2
ARRAY(str) a=s
for(i a.len-1 -1 -1)
,if a[i].len = 0
,,a.remove(i)
for i 0 a.len
,a[i].trim
,if(findrx(a[i] "Disk(?=\s\d*\s+Online)" 0 0) >=0)
,,if ttt=0
,,,disklist+ a[i]
,,,ttt+1
,,else
,,,disklist+"[]"
,,,disklist+ a[i]
,,,ttt+1
,if(a[i]="Disk 0 is now the selected disk.")
,,tset=!tset
,if(a[i]="Disk 1 is now the selected disk.")
,,tset=!tset
,if tset
,,if(findrx(a[i] "Partition(?=\s\d+)" 0 0)>=0)
,,,if tt=0
,,,,partitionlist1+ a[i]
,,,,tt+1
,,,else
,,,,partitionlist1 + "[]"
,,,,partitionlist1 +a[i]
,,,,tt+1
,else
,,if(findrx(a[i] "Partition(?=\s\d+)" 0 0)>=0)
,,,if tttt=0
,,,,partitionlist2+ a[i]
,,,,tttt+1
,,,else
,,,,partitionlist2 + "[]"
,,,,partitionlist2 +a[i]
,,,,tttt+1
int disknum= numlines(disklist)
int part1num= numlines(partitionlist1)
int part2num= numlines(partitionlist2)

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
;3 Static 0x54000000 0x0 12 12 198 82 ""
;4 Edit 0x54030080 0x200 161 100 38 14 ""
;5 Static 0x54000000 0x0 104 101 52 13 "excluded part:"
;6 Static 0x54000000 0x4 12 101 38 14 "select HD:"
;7 Edit 0x54030080 0x204 54 100 38 14 ""
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040700 "*" "" "" ""

str controls = "3 4 7"
str  s3 e4 e7
s3=
F
;You currently have {disknum} hard drives
;The first hard drive has {part1num} partitions
;The second hard drive has {part2num} partitions

if(!ShowDialog(dd &sub.DlgProc &controls)) ret
if(!empty(e4))
,out e4
if(!empty(e7))    
,out e7

#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1

also showed how to get the values of the two edits when you click ok


Messages In This Thread
Enumerate hard disks, exclude partitions - by win - 09-08-2018, 09:34 PM
RE: Enumerate hard disks, exclude partitions - by Kevin - 09-09-2018, 08:06 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)