kabar Posted September 21, 2009 Share Posted September 21, 2009 Please be kind I'm a noob. I am having trouble controlling tab functions. I created the same GUI minus tabs and it works fine.I'm sure i need to add the tab functions to each task but I'm have no idea how to do this.The radio button text is filled via a text for easy changes.Any direction would be greatly appreciated.I have attached the text file I am using.#include <WindowsConstants.au3>#include <adfunctions.au3>#include <GUIConstantsEx.au3>#include <GUIConstants.au3>;~ Opt('MustDeclareVars', 1)Global $Label[75]$file=FileOpen(@ScriptDir&'\List.txt',0)$i=0While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop $Label[$i]=$line $i=$i+1WendFileClose($file) GUICreate("Network Access Control Panel", 1005, 850, -1, -1);( "title" [, width [, height ;Expansion GUISetBkColor(0x00E0FFFF) GUISetFont(9, 300) GUICtrlCreateLabel("Enter ID Info:", 4, 4)Global $adgroupmem = GUICtrlCreateButton("Pattern After", 20, 175, 100, 25);20, 390, 100, 25Global $add = GUICtrlCreateButton("Add User", 20, 250, 100, 25);20, 250, 100, 25Global $remove = GUICtrlCreateButton("Remove User", 20, 285, 100, 25);20, 355, 100, 25Global $checks = GUICtrlCreateButton("Select All", 20, 320, 100, 25);20, 390, 100, 25Global $clear = GUICtrlCreateButton("Clear All", 20, 355, 100, 25);20, 285, 100, 25Global $exit = GUICtrlCreateButton("Exit", 20, 390, 100, 25);20, 320, 100, 25GUICtrlCreateLabel("Enter ID to add", 20, 35)Global $ID1 = GUICtrlCreateInput("", 20, 50, 100, 21);~ GUICtrlCreateLabel("Enter 2nd ID to add", 20, 80);~ Global $ID2 = GUICtrlCreateInput("", 20, 95, 100, 21)GUICtrlCreateLabel("See Pattern After Apps", 20, 135)Global $PTN = GUICtrlCreateInput("", 20, 150, 100, 21)Global $tab, $tab0, $tab1$tab = GUICtrlCreateTab(150, 5, 850, 840);left, top [, width [, height ;Expansion 150, 5, 1045, 840$tab1 = GUICtrlCreateTabItem("Ground Ops") Global $CheckBoxes[75] For $i = 0 To 24 $CheckBoxes[$i] = GUICtrlCreateCheckbox($Label[$i], 160 + 260 * Int($i/40), 30 + 20 * Mod($i,40)) Next$tab2 = GUICtrlCreateTabItem("Maint") Global $CheckBoxes[75] For $i = 25 To 49 $y=$i-25 $CheckBoxes[$i] = GUICtrlCreateCheckbox($Label[$i], 160 + 260 * Int($y/25), 30 + 20 * Mod($y,25)) Next $tab3 = GUICtrlCreateTabItem("Technology")Global $CheckBoxes[75] For $i = 0 To UBound($CheckBoxes) - 1 $CheckBoxes[$i] = GUICtrlCreateCheckbox($Label[$i], 160 + 260 * Int($i/25), 30 + 20 * Mod($i,25)) Next ;~ $tab3 = GUICtrlCreateTabItem("") ;Holder for new tabGUISetState()While 1 $Msg = GUIGetMsg() Select Case $Msg = $checks cks() Case $Msg = $add add()Case $Msg = $clear clr()Case $Msg = $remove rmv()Case $Msg = $adgroupmem adgm()Case $Msg = $exit ext() ExitEndSelect If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEndGUIDelete()Func cks();$checks - Selects All Checkboxes For $i = 0 To UBound($CheckBoxes) - 1 If GUICtrlRead ($CheckBoxes[$i]) = $GUI_UNCHECKED ThenGUICtrlSetState($CheckBoxes[$i],$GUI_CHECKED) ElseEndIf Next EndFunc ;==>cksFunc rmv() ;$remove - REMOVES USER FROM AD GROUPS _ Used for testing Not in production! Local $data1 = GUICtrlRead($ID1);~ Local $data2 = GUICtrlRead($ID2) ;future enhancement;~ Local $data3 = GUICtrlRead($ID3) ;future enhancement;~ Local $E1 = StringLeft($data1,1);~ Local $E2 = StringLeft($data2,1);future enhancement;~ Local $E3 = StringLeft($data3,1);future enhancement;~ If $data1 = "" or (StringLower($E1) <> "e" and StringLower($E1) <> "x") Then;~ MsgBox(64, "Information", "ID1 missing or incorrect");~ Return;~ EndIfFor $i = 0 To UBound($CheckBoxes) - 1 If GUICtrlRead ($CheckBoxes[$i]) = $GUI_CHECKED Then _ADRemoveUserFromGroup(_ADSamAccountNameToFQDN($Label[$i]), _ADSamAccountNameToFQDN($data1)); Removes from the AD Group MsgBox(64, "Information", $data1 & " removed from" & @CRLF & $Label[$i]) EndIf;~ If $data2 <> "" Then ;Verifies an E or X is the first input character.;~ If StringLower($E1) = "e" or StringLower($E1) = "x" Then;~ _ADRemoveUserFromGroup(_ADSamAccountNameToFQDN($CheckBoxes[$i]), _ADSamAccountNameToFQDN($data2)); Removes from the AD Group;~ EndIf;~ EndIf;~ EndIf NextEndFunc ;==>rmvFunc Clr();$clear - Clears all checkboxes For $i = 0 To UBound($CheckBoxes) - 1 If GUICtrlRead ($CheckBoxes[$i]) = $GUI_CHECKED ThenGUICtrlSetState($CheckBoxes[$i],$GUI_UNCHECKED) ElseEndIf NextEndFunc ;==>Clear all Checkboxesfunc add();$add - Adds ID's to checked AD groups; Local $data1 = GUICtrlRead($ID1);~ Local $data2 = GUICtrlRead($ID2);future enhancement;~ Local $data3 = GUICtrlRead($ID3);future enhancement;~ Local $E1 = StringLeft($data1,1);~ Local $E2 = StringLeft($data2,1);future enhancement;~ Local $E3 = StringLeft($data3,1);future enhancement;~ If $data1 = "" or (StringLower($E1) <> "e" and StringLower($E1) <> "x") Then;~ MsgBox(64, "Information", "ID1 missing or incorrect");~ Return;~ EndIfFor $i = 0 To UBound($CheckBoxes) - 1 If GUICtrlRead ($CheckBoxes[$i]) = $GUI_CHECKED Then _ADAddUserToGroup(_ADSamAccountNameToFQDN($Label[$i]), _ADSamAccountNameToFQDN($data1)); adds to the AD Group MsgBox(64, "Information", $data1 & " added to" & @CRLF & $Label[$i]) EndIf;~ If $data2 <> "" Then ;Verifies an E or X is the first input character.;~ If StringLower($E1) = "e" or StringLower($E1) = "x" Then;~ _ADAddUserToGroup(_ADSamAccountNameToFQDN($CheckBoxes[$i]), _ADSamAccountNameToFQDN($data2)); adds to the AD Group;~ EndIf;~ EndIf;~ EndIf NextEndFunc ;==>Add to AD;~ #csfunc adgm();adgroupmem - retrieves "AD Group Membership" of requested ID from "Pattern After" InputGlobal $asGroups[100]Global $asGroups2[100]Local $data1 = GUICtrlRead($ptn);~ Local $E1 = StringLeft($data1,1);~ If $data1 = "" or (StringLower($E1) <> "e" and StringLower($E1) <> "x") Then;~ MsgBox(64, "Information", "ID1 missing or incorrect");~ Return;~ EndIf;~ $testid = "e36747"_ADGetUserGroups($asGroups, $data1)$asGroups2[0]=$asGroups[0]for $x = 1 to $asGroups[0] ;MsgBox(0,"test",$asGroups[$x]) $asGroups2[$x]=StringTrimLeft(_ADDNToDisplayName($asGroups[$x]),3)Next_ArrayDisplay($asGroups2)EndFunc ;==>adgm;~ #ceFunc ext() ;Exit;~ $line1 = "GOOD BYE";~ MsgBox(48, "Hello", $line1)exitEndFunc ;==>ExtExitlist.txt Link to comment Share on other sites More sharing options...
martin Posted September 21, 2009 Share Posted September 21, 2009 Without "adfunctions.au3" we can't run what you posted. I removed all the sections which used functions in that include file and the script runs, but I don't understand what you want to do. What is it you want to happen to the tabs? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
kabar Posted September 21, 2009 Author Share Posted September 21, 2009 Sorry I was not clear. I can't get the check boxes to respond to the buttons, for example "Select All", "Clear All", "add user". None of the buttons have any affect on the check boxes. Before I had the tabs I had no problem, but with the number of AD groups I needed to add tabbing. Hope this makes sense. Tom Link to comment Share on other sites More sharing options...
martin Posted September 21, 2009 Share Posted September 21, 2009 Sorry I was not clear. I can't get the check boxes to respond to the buttons, for example "Select All", "Clear All", "add user". None of the buttons have any affect on the check boxes. Before I had the tabs I had no problem, but with the number of AD groups I needed to add tabbing. Hope this makes sense. Tom Ok. You need to set the checkboxes depending on which tabitem is selected. So I think you just don't know how to get that. You can use GuiCtrlRead($tab) which returns the selected tab index. Then in your function you can have switch GuiCtrlRead($tab) case 0 ;set checkboxes on first tabitem case 1 Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
kabar Posted September 21, 2009 Author Share Posted September 21, 2009 Ok. You need to set the checkboxes depending on which tabitem is selected. So I think you just don't know how to get that. You can use GuiCtrlRead($tab) which returns the selected tab index. Then in your function you can have switch GuiCtrlRead($tab) case 0 ;set checkboxes on first tabitem case 1 Thanks Martin, I appreciate your time. I'll play with GuiCtrlRead. Regards, Tom 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