Vaeb Posted November 28, 2007 Share Posted November 28, 2007 Hi! I want to add a window which shows as many checkboxes as $hwmny[0] is. $hwmny = _FileListToArray("\\srver\root\Group\Public\Printers\" & $n & "Obergeschoss\" & $ort, '*.lnk', 1) Select Case $hwmny[0] = "0" MsgBox (16,"Error","An diesem Ort sind keine Drucker vorhanden.") Case $hwmny[0] = "1" $gui_check_1 = GUICtrlCreateCheckbox($pr2 & $srv3 ,10,10,180,20) Case $hwmny[0] > "1" $gui_check_2 = GUICtrlCreateCheckbox($pr2 & $srv3 ,10,30,180,20) Case $hwmny[0] > "2" $gui_check_3 = GUICtrlCreateCheckbox($pr2 & $srv3 ,10,50,180,20) Case $hwmny[0] > "3" $gui_check_4 = GUICtrlCreateCheckbox($pr2 & $srv3 ,10,70,180,20) Case $hwmny[0] > "4" $gui_check_5 = GUICtrlCreateCheckbox($pr2 & $srv3 ,10,90,180,20) Case $hwmny[0] > "5" $gui_check_6 = GUICtrlCreateCheckbox($pr2 & $srv3 ,10,110,180,20) Case $hwmny[0] > "6" $gui_check_7 = GUICtrlCreateCheckbox($pr2 & $srv3 ,10,130,180,20) Case $hwmny[0] > "7" $gui_check_8 = GUICtrlCreateCheckbox($pr2 & $srv3 ,10,150,180,20) Case $hwmny[0] > "8" $gui_check_9 = GUICtrlCreateCheckbox($pr2 & $srv3 ,10,170,180,20) EndSelect The problem is, that the script opens as many guis as $hwmny[0] is. Do any1 know a good way to do what i tried to do? Greets Vaeb I <3 it:http://www.autoitscript.com/forum/index.php?showtopic=69912http://www.autoitscript.com/forum/index.php?showtopic=69914http://www.autoitscript.com/forum/index.php?showtopic=69911 Link to comment Share on other sites More sharing options...
poisonkiller Posted November 28, 2007 Share Posted November 28, 2007 (edited) #include <GUIConstants.au3> $hwmny = _FileListToArray("\\srver\root\Group\Public\Printers\" & $n & "Obergeschoss\" & $ort, '*.lnk', 1) Dim $gui_check[$hwmny[0] + 1] GuiCreate("Test", 200, 190) If $hwmny = 0 Then MsgBox (16,"Error","An diesem Ort sind keine Drucker vorhanden.") Else For $i = 1 to $hwmny[0] $gui_check[$i] = GUICtrlCreateCheckbox($pr2 & $srv3 ,10,-10 + $i*20,180,20) Next EndIf While 1 $msg = GuiGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit WEnd This probably isn't the best way to do this and I haven't tested the code, so it may not work. Edited November 28, 2007 by poisonkiller Link to comment Share on other sites More sharing options...
Vaeb Posted November 28, 2007 Author Share Posted November 28, 2007 Hello Thank you. It worked. I tried to read the Checkboxes i click. Unfortunatly, the script doesn't react when i click on $buttoninst It should install the printers. (it already worked without the checkboxes) Do any1 find the error? expandcollapse popupFunc Check() Opt("GUICloseOnESC", 1) $linkname = _FileListToArray("\\srvr\root\Group\Public\Printers\" & $n & "Obergeschoss\" & $ort, '*.lnk', 1) For $i = 1 To $linkname[0] $pr = StringInStr($linkname[$i], " ", 1) $prLen = StringLen($linkname[$i]) $pr3 = $prLen - $pr $pr2 = StringTrimRight($linkname[$i], $pr3) $srv = StringInStr($linkname[$i], " ", 1, 1) $srv2 = StringTrimLeft($linkname[$i], $srv + 3) $srv3 = StringTrimRight($srv2, 4) Opt("GUICloseOnESC", 1) Dim $gui_check_[$linkname[0] + 1] $gui_check_[$i] = GUICtrlCreateCheckbox($pr2 & $srv3 ,10,-10 + $i*20,680,20) Next $linkname = _FileListToArray("\\srvr\root\Group\Public\Printers\" & $n & "Obergeschoss\" & $ort, '*.lnk', 1) For $i = 1 To $linkname[0] $pr = StringInStr($linkname[$i], " ", 1) $prLen = StringLen($linkname[$i]) $pr3 = $prLen - $pr $pr2 = StringTrimRight($linkname[$i], $pr3) $srv = StringInStr($linkname[$i], " ", 1, 1) $srv2 = StringTrimLeft($linkname[$i], $srv + 3) $srv3 = StringTrimRight($srv2, 4) $buttoninst = GUICtrlCreateButton("Install", 195, 270) GUISetState() While 1 $Msg = GUIGetMsg() If $Msg = $buttoninst Then Dim $gui_check_[$linkname[0] + 1] If IsChecked($gui_check_[$i]) Then RunWait("rundll32 printui.dll,PrintUIEntry /in /n \\" & $srv3 & "\" & $pr2) RunWait("rundll32 printui.dll,PrintUIEntry /in /n \\" & $srv3 & "\" & $pr2 & " /y") EndIf EndIf WEnd Next EndFunc Func IsChecked($control) Return BitAnd(GUICtrlRead($control),$GUI_CHECKED) = $GUI_CHECKED EndFunc thx & greets Vaeb I <3 it:http://www.autoitscript.com/forum/index.php?showtopic=69912http://www.autoitscript.com/forum/index.php?showtopic=69914http://www.autoitscript.com/forum/index.php?showtopic=69911 Link to comment Share on other sites More sharing options...
poisonkiller Posted November 28, 2007 Share Posted November 28, 2007 Are you sure your RunWait functions work? Try them out, if they work, I have no idea whats wrong. Link to comment Share on other sites More sharing options...
Vaeb Posted November 29, 2007 Author Share Posted November 29, 2007 Yes I am sure that the runwait lines are working. As I already said: It already worked without the checkboxes Btw. nothing is happening too when i put a msgbox in. I hope some1 find the error. Greets Vaeb I <3 it:http://www.autoitscript.com/forum/index.php?showtopic=69912http://www.autoitscript.com/forum/index.php?showtopic=69914http://www.autoitscript.com/forum/index.php?showtopic=69911 Link to comment Share on other sites More sharing options...
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