mdwerne Posted September 17, 2008 Share Posted September 17, 2008 Hello, I'm trying to write a function that will display the members of the local administrators group. The code below does that, my problem is that when I have the "Admins" tab selected..only my submit button seems to work..Quit, Help and About don't. If I'm on any other tab, the other buttons work again. All I can guess is that I'm doing a poor job with my getAdmins function and not retrieving the data properly. Any thoughts? Thanks for any suggestions or a pointer to some helpful docs, -Mike expandcollapse popup;includes #include <GUIConstantsEx.au3> #include <INet.au3> #include"Array.au3" #include"File.au3" ;declare variables Dim $Date, $Admins, $Group, $Account ;call functions getDate() getAdmins() ;build form/gui $PMLForm = GUICreate("PML for " & @ComputerName, 499, 234, 310, 322) GUICtrlSetColor(-1, 0xCC0000); dark red GUISetBkColor(0xFAD43E) GUISetIcon("pinion.ico") GUISetFont(12, 400, 0, "Book Antiqua") $PMLControl = GUICtrlCreateTab(8, 8, 484, 185) GUICtrlSetFont(-1, 8.5, 800, 0, "Constantia") GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) $Info_Tab = GUICtrlCreateTabItem("Info") GUICtrlSetState(-1, $GUI_SHOW); will force info tab to be displayed first $Label_DateOfWork = GUICtrlCreateLabel("Date of Work:", 25, 160, 91, 20) GUICtrlSetFont(-1, 10, 800, 0, "Constantia") $DateOfWork = GUICtrlCreateLabel($Date, 118, 160, 250, 20) GUICtrlSetFont(-1, 10, 800, 0, "Constantia") GUICtrlSetColor(-1, 0xCC0000); dark red ; Tab $One_Tab = GUICtrlCreateTabItem("One") ; Tab $Two_Tab = GUICtrlCreateTabItem("Two") ; Tab $Three_Tab = GUICtrlCreateTabItem("Three") ; Tab $Four_Tab = GUICtrlCreateTabItem("Four") ; Tab $Five_Tab = GUICtrlCreateTabItem("Five") ; Tab $Six_Tab = GUICtrlCreateTabItem("Six") ; Admins Tab $Admins_Tab = GUICtrlCreateTabItem("Admins") $Admins_Label1 = GUICtrlCreateLabel("Admins:", 25, 40, 100, 20) GUICtrlSetFont(-1, 10, 800, 0, "Constantia") $Admins_Label2 = GUICtrlCreateLabel($Admins, 85, 40, 400, 300) GUICtrlSetFont(-1, 10, 600, 0, "Constantia") GUICtrlSetColor(-1, 0xCC0000); dark red ;Blank tab GUICtrlCreateTabItem("") ; Buttons $Submit_Button = GUICtrlCreateButton("&Submit", 14, 200, 75, 25, 0) $Quit_Button = GUICtrlCreateButton("&Quit", 145, 200, 75, 25, 0) $Help_Button = GUICtrlCreateButton("&Help", 276, 200, 75, 25, 0) $About_Button = GUICtrlCreateButton("&About", 407, 200, 75, 25, 0) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Quit_Button ExitLoop Case $msg = $Submit_Button Case $msg = $Help_Button Case $msg = $About_Button EndSelect WEnd ;functions ;get date of program execution Func getDate() $Date = _DateTimeFormat(_NowCalc(), 1) EndFunc ;==>getDate Func getAdmins() $Group = ObjGet("WinNT://" & @ComputerName & "/administrators,group") For $Account In $Group.members $Admins = $Admins & $Account.name & @CRLF Next ;Return $Admins EndFunc ;==>getAdmins ;end Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 17, 2008 Share Posted September 17, 2008 Hello,I'm trying to write a function that will display the members of the local administrators group. The code below does that, my problem is that when I have the "Admins" tab selected..only my submit button seems to work..Quit, Help and About don't. If I'm on any other tab, the other buttons work again. All I can guess is that I'm doing a poor job with my getAdmins function and not retrieving the data properly. Any thoughts?Thanks for any suggestions or a pointer to some helpful docs,-MikeCODE;includes#include <GUIConstantsEx.au3>#include <INet.au3>#include"Array.au3"#include"File.au3";declare variablesDim $Date, $Admins, $Group, $Account;call functionsgetDate()getAdmins();build form/gui$PMLForm = GUICreate("PML for " & @ComputerName, 499, 234, 310, 322)GUICtrlSetColor(-1, 0xCC0000); dark redGUISetBkColor(0xFAD43E)GUISetIcon("pinion.ico")GUISetFont(12, 400, 0, "Book Antiqua")$PMLControl = GUICtrlCreateTab(8, 8, 484, 185)GUICtrlSetFont(-1, 8.5, 800, 0, "Constantia")GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)$Info_Tab = GUICtrlCreateTabItem("Info")GUICtrlSetState(-1, $GUI_SHOW); will force info tab to be displayed first$Label_DateOfWork = GUICtrlCreateLabel("Date of Work:", 25, 160, 91, 20)GUICtrlSetFont(-1, 10, 800, 0, "Constantia")$DateOfWork = GUICtrlCreateLabel($Date, 118, 160, 250, 20)GUICtrlSetFont(-1, 10, 800, 0, "Constantia")GUICtrlSetColor(-1, 0xCC0000); dark red; Tab$One_Tab = GUICtrlCreateTabItem("One"); Tab$Two_Tab = GUICtrlCreateTabItem("Two"); Tab$Three_Tab = GUICtrlCreateTabItem("Three"); Tab$Four_Tab = GUICtrlCreateTabItem("Four"); Tab$Five_Tab = GUICtrlCreateTabItem("Five"); Tab$Six_Tab = GUICtrlCreateTabItem("Six"); Admins Tab$Admins_Tab = GUICtrlCreateTabItem("Admins")$Admins_Label1 = GUICtrlCreateLabel("Admins:", 25, 40, 100, 20)GUICtrlSetFont(-1, 10, 800, 0, "Constantia")$Admins_Label2 = GUICtrlCreateLabel($Admins, 85, 40, 400, 300)GUICtrlSetFont(-1, 10, 600, 0, "Constantia")GUICtrlSetColor(-1, 0xCC0000); dark red;Blank tabGUICtrlCreateTabItem(""); Buttons$Submit_Button = GUICtrlCreateButton("&Submit", 14, 200, 75, 25, 0)$Quit_Button = GUICtrlCreateButton("&Quit", 145, 200, 75, 25, 0)$Help_Button = GUICtrlCreateButton("&Help", 276, 200, 75, 25, 0)$About_Button = GUICtrlCreateButton("&About", 407, 200, 75, 25, 0)GUISetState(@SW_SHOW)While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Quit_Button ExitLoop Case $msg = $Submit_Button Case $msg = $Help_Button Case $msg = $About_Button EndSelectWEnd;functions;get date of program executionFunc getDate() $Date = _DateTimeFormat(_NowCalc(), 1)EndFunc ;==>getDateFunc getAdmins() $Group = ObjGet("WinNT://" & @ComputerName & "/administrators,group") For $Account In $Group.members $Admins = $Admins & $Account.name & @CRLF Next;Return $AdminsEndFunc ;==>getAdmins;endI don't see the problem, but getAdmins() is called at the top of the script and not in the GUI message loop, so how would it be related to the issue...? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
mdwerne Posted September 17, 2008 Author Share Posted September 17, 2008 I don't see the problem, but getAdmins() is called at the top of the script and not in the GUI message loop, so how would it be related to the issue...? If you don't experience the problem then I'm really confused. I just loaded a new install of Autoit on a fresh XP machine and I get the problem both in SciTe and when complied. Tried 3.2.12.1 and 3.2.13.7 - same issue. When the Admins tab is selected, all the buttons except for Submit cease to function (have a rollover state).I wish I could answer your question related to the GUI message loop...but it's beyond me.Thanks for looking at it.-Mike Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 17, 2008 Share Posted September 17, 2008 If you don't experience the problem then I'm really confused. I just loaded a new install of Autoit on a fresh XP machine and I get the problem both in SciTe and when complied. Tried 3.2.12.1 and 3.2.13.7 - same issue. When the Admins tab is selected, all the buttons except for Submit cease to function (have a rollover state).I wish I could answer your question related to the GUI message loop...but it's beyond me.Thanks for looking at it.-MikeActually, I hadn't run it at all, just couldn't see the problem - or any relation to getAdmin() - on visual inspection of the script.You can comment out the line for getAdmin() completely and make a static $admins = "Test" and you still have that problem I'll bet... because the label you create on the Admins tab is bigger than the tab itself, so its covering the buttons below it. Fix the height on that label and I'll bet it works. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
mdwerne Posted September 17, 2008 Author Share Posted September 17, 2008 Actually, I hadn't run it at all, just couldn't see the problem - or any relation to getAdmin() - on visual inspection of the script.You can comment out the line for getAdmin() completely and make a static $admins = "Test" and you still have that problem I'll bet... because the label you create on the Admins tab is bigger than the tab itself, so its covering the buttons below it. Fix the height on that label and I'll bet it works. What a dolt I am! You were absolutly right, the label was covering the buttons. I made it so large because I was not sure how long my list would be. But if GUICtrlCreateTab is only 185, then I guess I know it's not going to fit anything bigger. Guess I need to look for scrollbars if the list is longer than the tab. or two colums??Thank you for taking the time to look!-Mike Link to comment Share on other sites More sharing options...
ProgAndy Posted September 17, 2008 Share Posted September 17, 2008 You coulkd use an Edit Control in $ES_READONLY Style Then you have scrollbars and the user can't edit the text. *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 17, 2008 Share Posted September 17, 2008 You coulkd use an Edit Control in $ES_READONLY Style Then you have scrollbars and the user can't edit the text.Yes, or a ListView, etc.Lots of options. >_< Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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