Версия AutoIt: 3.3.12.0
Имеется такой код:
Прошу сильно не гнобить,если что не правильно. Скрипт рабочий,только не знаю как привязать ко второму combobox вывод общего размера папок, выделенных чекбоксами. Чтобы заранее знать влезет на флешку или нет. Может кто подправит? Или может как то по другому без combobox?
Имеется такой код:
Код:
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <GuiComboBox.au3>
#include <File.au3>
$hGUI = GUICreate("Создание флешки", 440, 490, -1, -1)
$iColor=0xDADADA
GUISetBkColor($iColor)
$font = "Arial"
;Кнопки
$Button1 = GUICtrlCreateButton("Подготовка носителя", 20, 30, 200, 30)
GUICtrlSetFont(-1, 10, 700, 0, $font) ; Жирный шрифт
$Button2 = GUICtrlCreateButton("Установка загрузчика", 220, 30, 200, 30)
GUICtrlSetFont(-1, 10, 700, 0, $font) ; Жирный шрифт
;Группировка
GUICtrlCreateGroup("Подготовка флешки",10,10,420,60,-1,-1)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle(-1), "wstr", 0, "wstr", 0)
GUICtrlSetColor(-1, 0x0000CD) ; Замена цвета в группе
GUICtrlSetFont(-1, 12, 400, 0, $font) ; Крупный шрифт
GUICtrlSetFont(-1, 12, 700, 0, $font) ; Жирный шрифт
$Checkbox1 = GUICtrlCreateCheckbox("Базовые файлы", 20, 100, 97, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Поддержка UEFI", 20, 120, 100, 17)
$Checkbox3 = GUICtrlCreateCheckbox("Windows 7x86", 20, 140, 90, 17)
$Checkbox4 = GUICtrlCreateCheckbox("Windows 7x64", 20, 160, 90, 17)
$Checkbox5 = GUICtrlCreateCheckbox("Windows 8.1x86", 20, 180, 100, 17)
$Checkbox6 = GUICtrlCreateCheckbox("Windows 8.1x64", 20, 200, 100, 17)
$Checkbox7 = GUICtrlCreateCheckbox("Windows 10x86", 20, 220, 95, 17)
$Checkbox8 = GUICtrlCreateCheckbox("Windows 10x64", 20, 240, 95, 17)
$Checkbox9 = GUICtrlCreateCheckbox("Windows XPx86 (Ver 1)", 20, 260, 130, 17)
$Checkbox10 = GUICtrlCreateCheckbox("Windows XPx86 (Ver 2)", 20, 280, 130, 17)
$Checkbox11 = GUICtrlCreateCheckbox("Linux Mint 15", 220, 100, 80, 17)
$Checkbox12 = GUICtrlCreateCheckbox("Boot USB Sergey Strelec", 220, 120, 140, 17)
$Checkbox13 = GUICtrlCreateCheckbox("Windows Live 2k10", 220, 140, 110, 17)
$Checkbox14 = GUICtrlCreateCheckbox("MSDART & Recovery", 220, 160, 120, 17)
$Checkbox15 = GUICtrlCreateCheckbox("AntiWinBlock", 220, 180, 80, 17)
$Checkbox16 = GUICtrlCreateCheckbox("Hirens Boot 10.6", 220, 200, 100, 17)
$Checkbox17 = GUICtrlCreateCheckbox("Диагност. утилиты", 220, 220, 120, 17)
$Checkbox18 = GUICtrlCreateCheckbox("Сборник Acronis", 220, 240, 100, 17)
$Checkbox19 = GUICtrlCreateCheckbox("Папка с драйверами", 220, 260, 125, 17)
$Checkbox20 = GUICtrlCreateCheckbox("Папка с софтом", 220, 280, 100, 17)
$Checkbox21 = GUICtrlCreateCheckbox("Сформирофать bcd ", 20, 300, 150, 17)
$Checkbox22 = GUICtrlCreateCheckbox("Редактировать menu.lst ", 220, 300, 150, 17)
;Группировка
GUICtrlCreateGroup("Формирование набора",10,70,420,415,-1,-1)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle(-1), "wstr", 0, "wstr", 0)
GUICtrlSetColor(-1, 0x0000CD) ; Замена цвета в группе
GUICtrlSetFont(-1, 12, 400, 0, $font) ; Крупный шрифт
GUICtrlSetFont(-1, 12, 700, 0, $font) ; Жирный шрифт
$Button3 = GUICtrlCreateButton("По умолчанию", 20, 390, 400, 30)
GUICtrlSetFont(-1, 10, 700, 0, $font) ; Жирный шрифт
$Button4 = GUICtrlCreateButton("Сбросить", 20, 420, 200, 30)
GUICtrlSetFont(-1, 10, 700, 0, $font) ; Жирный шрифт
$Button5 = GUICtrlCreateButton("Применить", 220, 420, 200, 30)
GUICtrlSetFont(-1, 10, 700, 0, $font) ; Жирный шрифт
$Button6 = GUICtrlCreateButton("Выйти из программы", 20, 450, 400, 30)
GUICtrlSetFont(-1, 10, 700, 0, $font) ; Жирный шрифт
$Button7 = GUICtrlCreateButton("Обновить", 350, 330, 70, 25)
GUICtrlSetFont(-1, 10, 700, 0, $font) ; Жирный шрифт
$Button8 = GUICtrlCreateButton("Обновить", 350, 360, 70, 25)
GUICtrlSetFont(-1, 10, 700, 0, $font) ; Жирный шрифт
$Combo1 = GUICtrlCreateCombo("", 20, 330, 325, 30, BitOR($GUI_SS_DEFAULT_COMBO, $CBS_SIMPLE, $CBS_AUTOHSCROLL))
$Combo2 = GUICtrlCreateCombo("", 20, 360, 325, 30, BitOR($GUI_SS_DEFAULT_COMBO, $CBS_SIMPLE, $CBS_AUTOHSCROLL))
GUICtrlCreateLabel('(587 МБ)', 120,102,70,12)
GUICtrlSetColor(-1, 0xFF0000)
$iSize = Round(DirGetSize("flash\efi") / 1048576, 2)
$Label = GUICtrlCreatelabel("(" & $iSize & " Мб)", 125, 122, 70, 12)
GUICtrlSetColor(-1, 0xFF0000)
$iSize = Round(DirGetSize("flash\core\win7x86") / 1048576, 2)
$Label = GUICtrlCreatelabel("(" & $iSize & " Мб)", 110, 142, 70, 12)
GUICtrlSetColor(-1, 0xFF0000)
$iSize = Round(DirGetSize("flash\core\win7x64") / 1048576, 2)
$Label = GUICtrlCreatelabel("(" & $iSize & " Мб)", 110, 162, 70, 12)
GUICtrlSetColor(-1, 0xFF0000)
$iSize = Round(DirGetSize("flash\core\win8x86") / 1048576, 2)
$Label = GUICtrlCreatelabel("(" & $iSize & " Мб)", 120, 182, 70, 12)
GUICtrlSetColor(-1, 0xFF0000)
$iSize = Round(DirGetSize("flash\core\win8x64") / 1048576, 2)
$Label = GUICtrlCreatelabel("(" & $iSize & " Мб)", 120, 202, 70, 12)
GUICtrlSetColor(-1, 0xFF0000)
$iSize = Round(DirGetSize("flash\core\win10x86") / 1048576, 2)
$Label = GUICtrlCreatelabel("(" & $iSize & " Мб)", 115, 222, 70, 12)
GUICtrlSetColor(-1, 0xFF0000)
$iSize = Round(DirGetSize("flash\core\win10x64") / 1048576, 2)
$Label = GUICtrlCreatelabel("(" & $iSize & " Мб)", 115, 242, 70, 12)
GUICtrlSetColor(-1, 0xFF0000)
$iSize = Round(DirGetSize("flash\core\winXPx86\XPpSP31") / 1048576, 2)
$Label = GUICtrlCreatelabel("(" & $iSize & " Мб)", 155, 262, 60, 12)
GUICtrlSetColor(-1, 0xFF0000)
$iSize = Round(DirGetSize("flash\core\winXPx86\XPpSP3") / 1048576, 2)
$Label = GUICtrlCreatelabel("(" & $iSize & " Мб)", 155, 282, 60, 12)
GUICtrlSetColor(-1, 0xFF0000)
$iSize = Round(DirGetSize("flash\mint") / 1048576, 2)
$Label = GUICtrlCreatelabel("(" & $iSize & " Мб)", 305, 102, 65, 12)
GUICtrlSetColor(-1, 0xFF0000)
$iSize = Round(DirGetSize("flash\sstr") / 1048576, 2)
$Label = GUICtrlCreatelabel("(" & $iSize & " Мб)", 360, 122, 65, 12)
GUICtrlSetColor(-1, 0xFF0000)
$iSize = Round(DirGetSize("flash\2k10") / 1048576, 2)
$Label = GUICtrlCreatelabel("(" & $iSize & " Мб)", 335, 142, 65, 12)
GUICtrlSetColor(-1, 0xFF0000)
$iSize = Round(DirGetSize("flash\erdc") / 1048576, 2)
$Label = GUICtrlCreatelabel("(" & $iSize & " Мб)", 340, 162, 65, 12)
GUICtrlSetColor(-1, 0xFF0000)
$iSize = Round(DirGetSize("flash\awbl") / 1048576, 2)
$Label = GUICtrlCreatelabel("(" & $iSize & " Мб)", 305, 182, 65, 12)
GUICtrlSetColor(-1, 0xFF0000)
$iSize = Round(DirGetSize("flash\hbcd") / 1048576, 2)
$Label = GUICtrlCreatelabel("(" & $iSize & " Мб)", 322, 202, 65, 12)
GUICtrlSetColor(-1, 0xFF0000)
$iSize = Round(DirGetSize("flash\util") / 1048576, 2)
$Label = GUICtrlCreatelabel("(" & $iSize & " Мб)", 342, 222, 75, 12)
GUICtrlSetColor(-1, 0xFF0000)
$iSize = Round(DirGetSize("flash\acrs") / 1048576, 2)
$Label = GUICtrlCreatelabel("(" & $iSize & " Мб)", 325, 242, 70, 12)
GUICtrlSetColor(-1, 0xFF0000)
$iSize = Round(DirGetSize("flash\2drv") / 1048576, 2)
$Label = GUICtrlCreatelabel("(" & $iSize & " Мб)", 345, 262, 70, 12)
GUICtrlSetColor(-1, 0xFF0000)
$iSize = Round(DirGetSize("flash\1sft") / 1048576, 2)
$Label = GUICtrlCreatelabel("(" & $iSize & " Мб)", 325, 282, 70, 12)
GUICtrlSetColor(-1, 0xFF0000)
GUISetState()
While 1
Switch GUIGetMsg()
Case -3
Exit
Case $Button1
Run('Utilites\paragon.exe')
Case $Button2
Run('Utilites\grub\grubinst_gui.exe')
Case $Button3
GUICtrlSetState($Checkbox1, $GUI_CHECKED)
GUICtrlSetState($Checkbox2, $GUI_CHECKED)
GUICtrlSetState($Checkbox3, $GUI_CHECKED)
GUICtrlSetState($Checkbox4, $GUI_CHECKED)
GUICtrlSetState($Checkbox5, $GUI_CHECKED)
GUICtrlSetState($Checkbox6, $GUI_CHECKED)
GUICtrlSetState($Checkbox7, $GUI_CHECKED)
GUICtrlSetState($Checkbox8, $GUI_CHECKED)
GUICtrlSetState($Checkbox9, $GUI_CHECKED)
GUICtrlSetState($Checkbox10, $GUI_CHECKED)
GUICtrlSetState($Checkbox11, $GUI_CHECKED)
GUICtrlSetState($Checkbox12, $GUI_CHECKED)
GUICtrlSetState($Checkbox13, $GUI_CHECKED)
GUICtrlSetState($Checkbox14, $GUI_CHECKED)
GUICtrlSetState($Checkbox15, $GUI_CHECKED)
GUICtrlSetState($Checkbox16, $GUI_CHECKED)
GUICtrlSetState($Checkbox17, $GUI_CHECKED)
GUICtrlSetState($Checkbox18, $GUI_CHECKED)
GUICtrlSetState($Checkbox19, $GUI_CHECKED)
GUICtrlSetState($Checkbox20, $GUI_CHECKED)
GUICtrlSetState($Checkbox21, $GUI_CHECKED)
GUICtrlSetState($Checkbox22, $GUI_CHECKED)
Case $Button4
GUICtrlSetState($Checkbox1, $GUI_UNCHECKED)
GUICtrlSetState($Checkbox2, $GUI_UNCHECKED)
GUICtrlSetState($Checkbox3, $GUI_UNCHECKED)
GUICtrlSetState($Checkbox4, $GUI_UNCHECKED)
GUICtrlSetState($Checkbox5, $GUI_UNCHECKED)
GUICtrlSetState($Checkbox6, $GUI_UNCHECKED)
GUICtrlSetState($Checkbox7, $GUI_UNCHECKED)
GUICtrlSetState($Checkbox8, $GUI_UNCHECKED)
GUICtrlSetState($Checkbox9, $GUI_UNCHECKED)
GUICtrlSetState($Checkbox10, $GUI_UNCHECKED)
GUICtrlSetState($Checkbox11, $GUI_UNCHECKED)
GUICtrlSetState($Checkbox12, $GUI_UNCHECKED)
GUICtrlSetState($Checkbox13, $GUI_UNCHECKED)
GUICtrlSetState($Checkbox14, $GUI_UNCHECKED)
GUICtrlSetState($Checkbox15, $GUI_UNCHECKED)
GUICtrlSetState($Checkbox16, $GUI_UNCHECKED)
GUICtrlSetState($Checkbox17, $GUI_UNCHECKED)
GUICtrlSetState($Checkbox18, $GUI_UNCHECKED)
GUICtrlSetState($Checkbox19, $GUI_UNCHECKED)
GUICtrlSetState($Checkbox20, $GUI_UNCHECKED)
GUICtrlSetState($Checkbox21, $GUI_UNCHECKED)
GUICtrlSetState($Checkbox22, $GUI_UNCHECKED)
Case $Button5
if GUICtrlRead($Checkbox1) = 1 Then RunWait('utilites\scripts\copybase.cmd')
if GUICtrlRead($Checkbox2) = 1 Then RunWait('utilites\scripts\copyefi.cmd')
if GUICtrlRead($Checkbox3) = 1 Then RunWait('utilites\scripts\win7x86.cmd')
if GUICtrlRead($Checkbox4) = 1 Then RunWait('utilites\scripts\win7x64.cmd')
if GUICtrlRead($Checkbox5) = 1 Then RunWait('utilites\scripts\win81x86.cmd')
if GUICtrlRead($Checkbox6) = 1 Then RunWait('utilites\scripts\win81x64.cmd')
if GUICtrlRead($Checkbox7) = 1 Then RunWait('utilites\scripts\win10x86.cmd')
if GUICtrlRead($Checkbox8) = 1 Then RunWait('utilites\scripts\win10x64.cmd')
if GUICtrlRead($Checkbox9) = 1 Then RunWait('utilites\scripts\winXPx86(V1).cmd')
if GUICtrlRead($Checkbox10) = 1 Then RunWait('utilites\scripts\winXPx86(V2).cmd')
if GUICtrlRead($Checkbox11) = 1 Then RunWait('utilites\scripts\copymint.cmd')
if GUICtrlRead($Checkbox12) = 1 Then RunWait('utilites\scripts\copysstr.cmd')
if GUICtrlRead($Checkbox13) = 1 Then RunWait('utilites\scripts\copy2K10.cmd')
if GUICtrlRead($Checkbox14) = 1 Then RunWait('utilites\scripts\copyerdc.cmd')
if GUICtrlRead($Checkbox15) = 1 Then RunWait('utilites\scripts\copyawbl.cmd')
if GUICtrlRead($Checkbox16) = 1 Then RunWait('utilites\scripts\copyhbcd.cmd')
if GUICtrlRead($Checkbox17) = 1 Then RunWait('utilites\scripts\copyutil.cmd')
if GUICtrlRead($Checkbox18) = 1 Then RunWait('utilites\scripts\copyacrs.cmd')
if GUICtrlRead($Checkbox19) = 1 Then RunWait('utilites\scripts\copy2drv.cmd')
if GUICtrlRead($Checkbox20) = 1 Then RunWait('utilites\scripts\copy1sft.cmd')
if GUICtrlRead($Checkbox21) = 1 Then RunWait('utilites\scripts\menuedit.cmd')
if GUICtrlRead($Checkbox22) = 1 Then RunWait('utilites\scripts\menulst.cmd')
Case $Button6
Exit
Case $Button7
_flesh_search()
EndSwitch
WEnd
Func _flesh_search()
$objWMIService = ObjGet("winmgmts:\\.\root\cimv2")
$colDiskDrives = $objWMIService.ExecQuery("SELECT * FROM Win32_DiskDrive")
For $objDrive In $colDiskDrives
ConsoleWrite("Physical Disk: " & $objDrive.Caption & @LF)
$strDeviceID = StringReplace($objDrive.DeviceID, "\", "\\")
$colPartitions = $objWMIService.ExecQuery('ASSOCIATORS OF {Win32_DiskDrive.DeviceID="' & $strDeviceID & '"} WHERE AssocClass = Win32_DiskDriveToDiskPartition')
For $objPartition In $colPartitions
; ConsoleWrite(@TAB & "Disk Partition: " & $objPartition.DeviceID & @LF)
$colLogicalDisks = $objWMIService.ExecQuery('ASSOCIATORS OF {Win32_DiskPartition.DeviceID="' & $objPartition.DeviceID & '"} WHERE AssocClass = Win32_LogicalDiskToPartition')
For $objLogicalDisk In $colLogicalDisks
If DriveGetType($objLogicalDisk.DeviceID) = "Removable" Then
ConsoleWrite(@TAB & "Logical Disk: " & $objLogicalDisk.DeviceID & @LF)
;узнаём объём флехи
$TotalMemL = DriveSpaceTotal($objLogicalDisk.DeviceID)
$TotalMem = Round($TotalMemL)
;узнаём файловую систему
$FileSystem = DriveGetFileSystem($objLogicalDisk.DeviceID)
;узнаём свободное места на флешке флешке
$FreeMemL = DriveSpaceFree($objLogicalDisk.DeviceID)
$FreeMem = Round($FreeMemL)
$DriveM = StringReplace($objDrive.Caption, " USB Device", "")
_GUICtrlComboBox_AddString($Combo1, $objLogicalDisk.DeviceID & " " & $DriveM & " (" & $TotalMem & "MB)" & " (" & $FileSystem & ")" & " (" & $FreeMem & "MB Free)")
EndIf
Next
Next
ConsoleWrite(@LF)
Next
EndFunc ;==>_flesh_search
Прошу сильно не гнобить,если что не правильно. Скрипт рабочий,только не знаю как привязать ко второму combobox вывод общего размера папок, выделенных чекбоксами. Чтобы заранее знать влезет на флешку или нет. Может кто подправит? Или может как то по другому без combobox?