Показать полную графическую версию : [решено] Помогите записать функцию короче
Centrinar
18-04-2010, 21:22
If GUICtrlRead($check[1]) <> 1 and GUICtrlRead($check[2]) <> 1 and GUICtrlRead($check[3]) <> 1 and GUICtrlRead($check[4]) <> 1 and GUICtrlRead($check[5]) <> 1 Then MsgBox(48, "Error", "Выберите как минимум один чекбокс") ContinueLoop EndIf как сделать короче?
как сделать короче?
Это вообще неправильно.
Не уверен на счёт короче, но вот как это обычно делается:
$iContinueLoop = 1
For (http://www.autoitscript.com/autoit3/docs/keywords.htm#For) $i = 1 To (http://www.autoitscript.com/autoit3/docs/keywords.htm#To) 5
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) GUICtrlRead (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlRead.htm)($check[$i]) = 1 Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
$iContinueLoop = 0
ExitLoop (http://www.autoitscript.com/autoit3/docs/keywords.htm#ExitLoop)
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
Next (http://www.autoitscript.com/autoit3/docs/keywords.htm#Next)
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) $iContinueLoop Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
MsgBox (http://www.autoitscript.com/autoit3/docs/functions/MsgBox.htm)(48, "Error", "Выберите как минимум один чекбокс")
ContinueLoop (http://www.autoitscript.com/autoit3/docs/keywords.htm#ContinueLoop)
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
© OSzone.net 2001-2012
vBulletin v3.6.4, Copyright ©2000-2025, Jelsoft Enterprises Ltd.