prp2 Posted October 24, 2007 Share Posted October 24, 2007 Hey folks,I'm in a bit of a jam here. I'm writing a script that will auto-configure the Atheros WLAN Client Utility for a certain SSID. The problem I've run into is the section where you'd go to change profile settings was written using standard System32 controls, rather than clickable buttons and such.Here's a screenshot:What I need to do is select the "Profile Management" tab from that window and make it the active tab. So far I'm not having any luck. This is what I've got so far:; Script Start Opt("TrayIconHide", 1) Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",1) Opt("WinDetectHiddenText",1) ; Launches the config tool Run(@ProgramFilesDir & '\WLAN\ACU.exe') ; Modify the default profile name and SSID WinWait("WLAN Client Utility") If Not WinActive("WLAN Client Utility") Then WinActivate("WLAN Client Utility") WinWaitActive("WLAN Client Utility") ControlListView ( "WLAN Client Utility", "", "SysTabControl32", "Select", "Profile Management" )I'm sure somewhere I've gone horribly wrong, and if it would help I can paste the output of the AutoIt Window Info tool for that particular window... Much thanks in advance! Link to comment Share on other sites More sharing options...
GEOSoft Posted October 24, 2007 Share Posted October 24, 2007 You are not going to make it work with ControlListView when the first line in the help file says "Sends a command to a ListView32 control."Try ControlCommand() George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Zedna Posted October 24, 2007 Share Posted October 24, 2007 ControlCommand & TabRight or _GUICtrlTab_SetCurSel from latest beta Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
GEOSoft Posted October 24, 2007 Share Posted October 24, 2007 or_GUICtrlTab_SetCurSel from latest betaI don't think the window shown is an AutoIt window and I'm thinking that _GUICtrlTab_SetCurSel won't work on an external window. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
prp2 Posted October 24, 2007 Author Share Posted October 24, 2007 (edited) Ok, I tried using: ControlCommand("WLAN Client Utility", "", "SysTabControl321", "TabRight", "") And that worked to switch the tab to the right. The thing is, this program doesn't always start in the default view of Current Status, but instead opens right up to Profile Management, in which case a TabRight wouldn't be what I'd want to do. Should I add an If Else for that, or is there a better way to be sure I'm on the correct tab? Edit -- Thought about it a bit more, I guess I'd need to do a While loop then, until the correct window text appears to know it's on the right tab... Edited October 24, 2007 by prp2 Link to comment Share on other sites More sharing options...
GEOSoft Posted October 24, 2007 Share Posted October 24, 2007 (edited) Ok, I tried using:ControlCommand("WLAN Client Utility", "", "SysTabControl321", "TabRight", "")And that worked to switch the tab to the right. The thing is, this program doesn't always start in the default view of Current Status, but instead opens right up to Profile Management, in which case a TabRight wouldn't be what I'd want to do. Should I add an If Else for that, or is there a better way to be sure I'm on the correct tab?Edit -- Thought about it a bit more, I guess I'd need to do a While loop then, until the correct window text appears to know it's on the right tab...See "CurrentTab" on the same page. Use that to check which tab is current. You could put it in a While/Wend or a Do/UntilEDIT: Btw I'm not sure if CurrentTab will return the text on the tab or the tab index number which will probably be 0 based. Test it with a message box. Edited October 24, 2007 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Zedna Posted October 24, 2007 Share Posted October 24, 2007 I don't think the window shown is an AutoIt window and I'm thinking that _GUICtrlTab_SetCurSel won't work on an external window.You are NOT right.All _GUICtrlTab_xxx functions work also with external applications.Look at:_GUICtrlTab_GetCurSel _GUICtrlTab_GetItemCount _GUICtrlTab_GetItemText _GUICtrlTab_SetCurSel Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
prp2 Posted October 24, 2007 Author Share Posted October 24, 2007 See "CurrentTab" on the same page. Use that to check which tab is current. You could put it in a While/Wend or a Do/UntilEDIT: Btw I'm not sure if CurrentTab will return the text on the tab or the tab index number which will probably be 0 based. Test it with a message box.MsgBox(0, "", ControlCommand("WLAN Client Utility", "", "SysTabControl321", "CurrentTab", "Profile Managment") ) returns 3 for "Profile Management", "Current Status" and "Diagnostics". Am I doing something incorrect or do they really all have the same tab id? Link to comment Share on other sites More sharing options...
Zedna Posted October 24, 2007 Share Posted October 24, 2007 MsgBox(0, "", ControlCommand("WLAN Client Utility", "", "SysTabControl321", "CurrentTab", "Profile Managment") ) returns 3 for "Profile Management", "Current Status" and "Diagnostics". Am I doing something incorrect or do they really all have the same tab id?Read my last post!Look into AutoIt's beta 3.2.9.3 helpfile at these functions... Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
magician13134 Posted January 13, 2008 Share Posted January 13, 2008 When I use the _GUICtrlTab_SetCurSel($hWnd, $index) command, it clicks the tab, but doesn't switch to it. Is that what it's supposed to do? Visit Magic Soft Inc. for some of my software Link to comment Share on other sites More sharing options...
Siao Posted January 13, 2008 Share Posted January 13, 2008 When I use the _GUICtrlTab_SetCurSel($hWnd, $index) command, it clicks the tab, but doesn't switch to it. Is that what it's supposed to do?Yea. Use _GUICtrlTab_SetCurFocus to switch. "be smart, drink your wine" Link to comment Share on other sites More sharing options...
magician13134 Posted January 14, 2008 Share Posted January 14, 2008 (edited) That doesn't work either. In the example for SetCurSel it works, but that uses _GUICtrlTab_InsertItem instead of GUICtrlCreateTabItem, but when I switched my code to _GUICtrlTab_InsertItem, all of my controls were drawn on top of each other, simply ignoring the tabs... Edited January 14, 2008 by magician13134 Visit Magic Soft Inc. for some of my software Link to comment Share on other sites More sharing options...
GEOSoft Posted January 14, 2008 Share Posted January 14, 2008 (edited) If you are using a switch statement in your main Msg loop then you can use Case $Tab;;; Change to the name you gave your GUICtrlCreateTab() GUICtrlSetState(GUICtrlRead($Tab), 16) Or for a select statement it would be Case $Msg = $Tab;; again change the variable names to suit your code GUICtrlSetState(GUICtrlRead($Tab), 16) Then there is the ever popular If GUIGetMsg() = $Tab Then GUICtrlSetState(GUICtrlRead($Tab), 16) EndIf Edited January 14, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Siao Posted January 14, 2008 Share Posted January 14, 2008 So you wanna say this works only for me? #include <GuiTab.au3> GUICreate("", 400, 300) $cTab = GUICtrlCreateTab(0, 30, 400, 270) GUICtrlCreateTabItem("1") GUICtrlCreateCheckbox("#1", 50, 150, 100, 20) GUICtrlCreateTabItem("2") GUICtrlCreateCheckbox("#2", 55, 150, 100, 20) GUICtrlCreateTabItem("3") GUICtrlCreateCheckbox("#3", 60, 150, 100, 20) GUICtrlCreateTabItem("") $b1 = GUICtrlCreateButton("Switch to #1", 20, 5, 100, 20) $b2 = GUICtrlCreateButton("Switch to #2", 140, 5, 100, 20) $b3 = GUICtrlCreateButton("Switch to #3", 260, 5, 100, 20) GUISetState() While 1 Switch GUIGetMsg() Case -3 Exit Case $b1 _GUICtrlTab_SetCurFocus($cTab, 0) Case $b2 _GUICtrlTab_SetCurFocus($cTab, 1) Case $b3 _GUICtrlTab_SetCurFocus($cTab, 2) EndSwitch WEnd Note if you use _GUICtrlTab_SetCurSel instead _GUICtrlTab_SetCurFocus, the tab won't actually switch (controls in page won't change). "be smart, drink your wine" Link to comment Share on other sites More sharing options...
magician13134 Posted January 14, 2008 Share Posted January 14, 2008 Ohhhh... it doesn't work when you have the tab set to $TCS_BUTTONS style. That may be a bug... Visit Magic Soft Inc. for some of my software Link to comment Share on other sites More sharing options...
Siao Posted January 14, 2008 Share Posted January 14, 2008 (edited) Ohhhh... it doesn't work when you have the tab set to $TCS_BUTTONS style. That may be a bug...As a workaround, you can do this: GUICtrlSetStyle($cTab, 0) _GUICtrlTab_SetCurFocus($cTab, $iIndex) GUICtrlSetStyle($cTab, $TCS_BUTTONS) Edited January 14, 2008 by Siao "be smart, drink your wine" Link to comment Share on other sites More sharing options...
magician13134 Posted January 16, 2008 Share Posted January 16, 2008 Oh, nice, thanks, but I just changed my styles, I'm using this so I can use images instead of tabs, so no one will see the tabs anyway, the button style was leftover from an older version. Visit Magic Soft Inc. for some of my software Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 19, 2008 Share Posted May 19, 2008 Ohhhh... it doesn't work when you have the tab set to $TCS_BUTTONS style. That may be a bug... I'm still having issues with SysTabControl32 myself. Just making this change to Siao's script breaks it: $cTab = GUICtrlCreateTab(0, 30, 400, 270, $TCS_BUTTONS) In the help file under _GuiCtrlTab_SetCurFocus(): Remarks If the tab control has the $TCS_BUTTONS style (button mode), the tab with the focus may be different from the selected tab. For example, when a tab is selected, the user can press the arrow keys to set the focus to a different tab without changing the selected tab. In button mode, $TCM_SETCURFOCUS sets the input focus to the button associated with the specified tab, but it does not change the selected tab. If the tab control does not have the $TCS_BUTTONS style, changing the focus also changes the selected tab. And under _GuiCtrlTab_SetCurSel(): Remarks A tab control does not send a $TCN_SELCHANGING or $TCN_SELCHANGE notification message when a tab is selected using this function. So, must we use _SendMessage() to fire the appropriate events in the app that owns the Tab control? Should all functions I write for tab controls first check the style and then use custom _SendMessage()'s to make it work? I think I can code that to work, but I wonder if I'm missing a cleaner solution... 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...
Siao Posted May 19, 2008 Share Posted May 19, 2008 See post #16. I think this could work on external tabs too. Just with _WinAPI_GetWindowLong/_WinAPI_SetWindowLong instead of Gui...Style functions of course. "be smart, drink your wine" Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 19, 2008 Share Posted May 19, 2008 See post #16. I think this could work on external tabs too. Just with _WinAPI_GetWindowLong/_WinAPI_SetWindowLong instead of Gui...Style functions of course.Actually, when I went to try that with my real-time script, the _GuiCtrlTab_SetCurFocus() worked without it. I missed something in my own set up somewhere. Using both ..._SetCurSel() and ..._SetCurFocus() didn't work, so I had put ControlSend($hWin, "", $Tab, "^{TAB}") in as a workaround. When I put ...SetCurFocus() back it just worked.In the meantime, I did read out the style = 0x54030200, which doesn't even have $TCS_BUTTONS set anyway!The problem was more likely mine, but I wonder if anything to do with this was fixed in 3.2.12.0, which I'm now running? 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