EileenW Posted October 12, 2010 Share Posted October 12, 2010 Hi, The application I want to automate has multiple tabs and all the tabs are of the same Class "SysTabControl32" and Instance "1". I found that in method ControlCommand you can move to the next tab to the right or to the left, but I am wondering if there is a way to move to a tab using the tab name? That way we don't need to care about which tab we are right now, and I think the script would be more robust at handling GUI changes (e.g. tab layout order changes). Thanks, Eileen Link to comment Share on other sites More sharing options...
martin Posted October 12, 2010 Share Posted October 12, 2010 Hi,The application I want to automate has multiple tabs and all the tabs are of the same Class "SysTabControl32" and Instance "1". I found that in method ControlCommand you can move to the next tab to the right or to the left, but I am wondering if there is a way to move to a tab using the tab name? That way we don't need to care about which tab we are right now, and I think the script would be more robust at handling GUI changes (e.g. tab layout order changes).Thanks,EileenI doubt you will find a better method than you are already using. Move left untill the tab name doesn't change or is the tab name you want, If it doesn't change move right until the tab is what you want or it doesn't change. SysTabControl32 is the tabcontrol which contains all the tabbed pages so it will be the same for all tabs.You can send a message to a tab control to select a tab by index, and you can send a message to get the index of the currently selected tab. So if you knew the index you could do what you want, or once you have selected each tab you can get its index so that when you select next time you just have to send a message with the index. 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...
EileenW Posted October 12, 2010 Author Share Posted October 12, 2010 Hi Martin, Can you give some more detail on how to send a message with the index? Say I have used ControlCommand with "CurrentTab" command to find out the index of a specific tab (is that the right way to get the index?), so next time how do I move to this tab using the index? As I'm new to AutoIt please bear with me if my question is too obvious. Thanks, Eileen Link to comment Share on other sites More sharing options...
Ascend4nt Posted October 12, 2010 Share Posted October 12, 2010 _GUICtrlTab_FindTab() is supposed to work, but the Tab controls are pretty much botched up right now. You could try to pull out and change the _GUICtrlTab_GetItem() function to use $TCIF_TEXT instead of '$TCIF_ALLDATA', which will fix getting the correct index, but then you'll have to use the index to calculate movement using a mix of ControlCommand($hWnd,"",$hTabControl,"CurrentTab","") and multiple ControlCommand($hWnd,"",$hTabControl,$sDir,"") [where $sDir = "Right" or "Left"] My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
Varian Posted October 12, 2010 Share Posted October 12, 2010 I think it will be easier to use Gui Tab controls. I do not know of a way to return the tab name with ControlCommand. Here is a sample...just change "Your Window Title" and "Your Search Text" (the string name of the Tab you want focused) with the relevant values for your situation. Let me know if this works for you.#include<GuiTab.au3> WinWait('Your Window Title') $hTab = ControlGetHandle('Your Window Title', '', 'SysTabControl321') $tIndex = _GUICtrlTab_FindTab($hTab, 'Your Search Text', True, 0) If $tIndex = -1 Then MsgBox(0, 'ERROR', 'Cannot Find Tab') Else _GUICtrlTab_SetCurFocus($hTab, $tIndex) EndIf Link to comment Share on other sites More sharing options...
martin Posted October 12, 2010 Share Posted October 12, 2010 Hi Martin,Can you give some more detail on how to send a message with the index? Say I have used ControlCommand with "CurrentTab" command to find out the index of a specific tab (is that the right way to get the index?), so next time how do I move to this tab using the index?As I'm new to AutoIt please bear with me if my question is too obvious. Thanks,EileenFirstly Varian has shown a good example which also shows the way to do it and that I was wrong to say you wouldn'y find a better way; I didn't know the _GuiCtrlTab_FindTab function.But to answer your question, have a look at the GuiTab.au3 udf in the includes folder for AutoIt. Most of the functions use messages. 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...
EileenW Posted October 13, 2010 Author Share Posted October 13, 2010 I think it will be easier to use Gui Tab controls. I do not know of a way to return the tab name with ControlCommand. Here is a sample...just change "Your Window Title" and "Your Search Text" (the string name of the Tab you want focused) with the relevant values for your situation. Let me know if this works for you.#include<GuiTab.au3> WinWait('Your Window Title') $hTab = ControlGetHandle('Your Window Title', '', 'SysTabControl321') $tIndex = _GUICtrlTab_FindTab($hTab, 'Your Search Text', True, 0) If $tIndex = -1 Then MsgBox(0, 'ERROR', 'Cannot Find Tab') Else _GUICtrlTab_SetCurFocus($hTab, $tIndex) EndIf Hi Varian, Thank you for your answer. However when I tried it, I got a "Cannot Find Tab" Error box. Note that I have replaced the window title with my application window title and search text with the tab name. I have tried different tabs and none of them worked. Can you help me more here? Thanks, Eileen Link to comment Share on other sites More sharing options...
Varian Posted October 13, 2010 Share Posted October 13, 2010 (edited) Hi Varian,Thank you for your answer. However when I tried it, I got a "Cannot Find Tab" Error box. Note that I have replaced the window title with my application window title and search text with the tab name. I have tried different tabs and none of them worked. Can you help me more here?Thanks,EileenWhat application or window are we talking about here. Some MS controls resist (some of) AutoIT's GUI fuctions (Listview & Tab functions especially). I would like to help & perhaps if I can reproduce the problem on my end I can help with a solution. A few other questions:What is your OS?What is your OS's Architecture (x86 or x64)?What version of AutoIT are you running?Do the Tabs on your app remain in a constant order & amount (always the same number of tabs in the same order)?Does your app remember the last Tab focused and does it start with the last selected tab?EDIT: Since ControlCommand works, you may be able to identify the selected IF the the text in the Window (or a control's text) changes Edited October 13, 2010 by Varian Link to comment Share on other sites More sharing options...
Ascend4nt Posted October 13, 2010 Share Posted October 13, 2010 I have already mentioned the broken _GUICtrlTab_FindTab() functionality in my post, and a solution. The tab functions fail for me even on Internet Explorer's properties sheet. I've already coded my own solution though, and I don't have the time to fix all of the broken standard UDF's just now. My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
EileenW Posted October 13, 2010 Author Share Posted October 13, 2010 What application or window are we talking about here. Some MS controls resist (some of) AutoIT's GUI fuctions (Listview & Tab functions especially). I would like to help & perhaps if I can reproduce the problem on my end I can help with a solution. A few other questions:What is your OS?What is your OS's Architecture (x86 or x64)?What version of AutoIT are you running?Do the Tabs on your app remain in a constant order & amount (always the same number of tabs in the same order)?Does your app remember the last Tab focused and does it start with the last selected tab?EDIT: Since ControlCommand works, you may be able to identify the selected IF the the text in the Window (or a control's text) changesHere are some more information:The application is developed in C++ and MFC. I was using WinXP (32bit) when trying your script.AutoIt version is V3.3.6.1The tabs on my app remain in a constant order & amount, but it could change when development changes.The app does NOT remember the last tab focused, and it always start with the first tab focused. Link to comment Share on other sites More sharing options...
EileenW Posted October 13, 2010 Author Share Posted October 13, 2010 I have already mentioned the broken _GUICtrlTab_FindTab() functionality in my post, and a solution. The tab functions fail for me even on Internet Explorer's properties sheet. I've already coded my own solution though, and I don't have the time to fix all of the broken standard UDF's just now.Sorry I didn't read your previous post very carefully because as I'm new to autoIt, modifying its library seems a little too advanced for me at this point Honestly I am surprised about the tab problem as tab is very common in Windows application.Comparing to having to modify the source code, I would probably prefer going back to controlCommand, even though that's not the most effective way to move between tabs.Thanks,Eileen Link to comment Share on other sites More sharing options...
Ascend4nt Posted October 13, 2010 Share Posted October 13, 2010 Eileen, understandable. Perhaps when I have time I'll submit a bug report - but there's a number of functions in that UDF that don't work, and they rely on a number of other UDF's as well as internal functions that makes it more difficult to debug. I would put up my own code, but I too use my own UDF's to work with the tabs.. sorry Perhaps an alternative is to use the AutoIt window info tool on each tab to see what visible text is there when you switch tabs. That way, you can just check for some unique text as you rotate through the tabs.. it's a kludge, but it might work My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
EileenW Posted October 13, 2010 Author Share Posted October 13, 2010 Thanks for your help, I'll try this way for now. And please post a note on the thread if the tab functions do get fixed some day Link to comment Share on other sites More sharing options...
warezoogle3 Posted July 10, 2012 Share Posted July 10, 2012 Fixed Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted July 10, 2012 Moderators Share Posted July 10, 2012 warezoogle3, necroing posts this old is generally discouraged on this forum, especially when you're not adding anything to the thread itself. As this member has not been active in almost two years, I doubt this will do them any good "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! 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