Sign in to follow this  
Followers 0
kabar

Control to tabs

5 posts in this topic

Please be kind I'm a noob. :D

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=0

While 1

$line = FileReadLine($file)

If @error = -1 Then ExitLoop

$Label[$i]=$line

$i=$i+1

Wend

FileClose($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, 25

Global $add = GUICtrlCreateButton("Add User", 20, 250, 100, 25);20, 250, 100, 25

Global $remove = GUICtrlCreateButton("Remove User", 20, 285, 100, 25);20, 355, 100, 25

Global $checks = GUICtrlCreateButton("Select All", 20, 320, 100, 25);20, 390, 100, 25

Global $clear = GUICtrlCreateButton("Clear All", 20, 355, 100, 25);20, 285, 100, 25

Global $exit = GUICtrlCreateButton("Exit", 20, 390, 100, 25);20, 320, 100, 25

GUICtrlCreateLabel("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 tab

GUISetState()

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()

Exit

EndSelect

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

WEnd

GUIDelete()

Func cks();$checks - Selects All Checkboxes

For $i = 0 To UBound($CheckBoxes) - 1

If GUICtrlRead ($CheckBoxes[$i]) = $GUI_UNCHECKED Then

GUICtrlSetState($CheckBoxes[$i],$GUI_CHECKED)

Else

EndIf

Next

EndFunc ;==>cks

Func 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

;~ EndIf

For $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

Next

EndFunc ;==>rmv

Func Clr();$clear - Clears all checkboxes

For $i = 0 To UBound($CheckBoxes) - 1

If GUICtrlRead ($CheckBoxes[$i]) = $GUI_CHECKED Then

GUICtrlSetState($CheckBoxes[$i],$GUI_UNCHECKED)

Else

EndIf

Next

EndFunc ;==>Clear all Checkboxes

func 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

;~ EndIf

For $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

Next

EndFunc ;==>Add to AD

;~ #cs

func adgm();adgroupmem - retrieves "AD Group Membership" of requested ID from "Pattern After" Input

Global $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

;~ #ce

Func ext() ;Exit

;~ $line1 = "GOOD BYE"

;~ MsgBox(48, "Hello", $line1)

exit

EndFunc ;==>Ext

Exit

list.txt

Share this post


Link to post
Share on other sites



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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0