Creat0R, выскакивает ошибка Error: Error in expression
Код:
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <WindowsConstants.au3>
; Только эту строку и нужно править для добавления новых, или удаления пунктов ;)
Global $sProgs =
@ScriptDir & '\7z.exe x -y -aoa -o"' & @WindowsDir & '\DriversPozia" "' & @ScriptDir & '\1.7z"=Driver 1|' & _
@ScriptDir & '\7z.exe x -y -aoa -o"' & @WindowsDir & '\DriversPozia" "' & @ScriptDir & '\2.7z"=Driver 2|' & _
@ScriptDir & '\7z.exe x -y -aoa -o"' & @WindowsDir & '\DriversPozia" "' & @ScriptDir & '\3.7z"=Driver 3|' & _
@ScriptDir & '\7z.exe x -y -aoa -o"' & @WindowsDir & '\DriversPozia" "' & @ScriptDir & '\4.7z"=Driver 4|' & _
@ScriptDir & '\7z.exe x -y -aoa -o"' & @WindowsDir & '\DriversPozia" "' & @ScriptDir & '\5.7z"=Driver 5'
Global Const $aProgs = StringSplit($sProgs, '|')
Global $anCheckBoxes[$aProgs[0]+1] = [$aProgs[0]]
$Form1 = GUICreate("", 500, 500)
$iTop = 10
$iLeft = 20
For $i = 1 To $aProgs[0]
$anCheckBoxes[$i] = GUICtrlCreateCheckbox(StringRegExpReplace($aProgs[$i], '^.*=', ''), $iLeft, $iTop, -1, 15)
GUICtrlSetFont($anCheckBoxes[$i], 9, 400)
$iTop += 20
If $iTop > 440 Then
$iTop = 10
$iLeft += 100
EndIf
Next
GUICtrlCreateLabel("Status:", 200, 475, 460, 15)
GUICtrlSetFont(-1, 9, 800)
$nStatus = GUICtrlCreateLabel("", 250, 476, 240, 15)
GUICtrlSetColor(-1, 0xFF0000)
$nStart = GUICtrlCreateButton("Выполнить", 10, 470, 80, 25)
$nCancel = GUICtrlCreateButton("Отмена", 100, 470, 80, 25)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE, $nCancel
Exit
Case $nStart
For $i = 1 To $aProgs[0]
If GUICtrlRead($anCheckBoxes[$i]) = $GUI_CHECKED Then
$sProgName = StringRegExpReplace($aProgs[$i], '^.*=', '')
$sProgExe = StringRegExpReplace($aProgs[$i], '=.*$', '')
GUICtrlSetData($nStatus, StringFormat("Please wait, installing [%s]...", $sProgName))
GUICtrlSetFont($anCheckBoxes[$i], 9, 800)
_ControlsSetState($GUI_DISABLE, $anCheckBoxes[1], $anCheckBoxes[$anCheckBoxes[0]])
RunWait($sProgExe)
GUICtrlSetFont($anCheckBoxes[$i], 9, 400)
_ControlsSetState($GUI_ENABLE, $anCheckBoxes[1], $anCheckBoxes[$anCheckBoxes[0]])
EndIf
Next
GUICtrlSetData($nStatus, "Done!")
GUIDelete($Form1)
Exit
EndSwitch
WEnd
Func _ControlsSetState($nState, $iFirst, $iLast)
For $iCtrlID = $iFirst To $iLast
GUICtrlSetState($iCtrlID, $nState)
Next
EndFunc
|