Jump to content

Tabs - once again


Recommended Posts

OK, I need to get the NAME of the tab out of, lets say, System Propeties applet window. I have searched this forum and found many examples of how to get the name out of "self generated" items. But, how do you get them out of a 3rd party application/applet?

Here is what I have tried so far:

#include <GuiTab.au3>
#include <GuiConstantsEx.au3>

Run('control sysdm.cpl')
WinWaitActive('System Properties')

Dim $hWnd = WinGetHandle('System Properties')
Dim $hSysTab = ControlGetHandle($hWnd, '', 'SysTabControl321')
sleep(500)
_GUICtrlTab_SetCurFocus($hSysTab, 1)
$tTabs = _GUICtrlTab_GetItemCount($hSysTab)
_GUICtrlTab_SetCurFocus($hWnd, 0)
For $i = 0 to $tTabs
    MsgBox(0,"Tabs" & $tTabs, "Tab #" & $i & " is " & _GUICtrlTab_GetItemText($hWnd, $i))
    MsgBox(0,"Command", "ControlCommand tab is " & ControlCommand("System Properties","", "SysTabControl321", "CurrentTab",""))
    MsgBox(0,"Command2", "ControlCommand tab is " &ControlGetText("System Properties","", "SysTabControl321"))
    ControlCommand("System Properties","", "SysTabControl321", "TabRight","")
Next

$tIndex = _GUICtrlTab_FindTab($hSysTab, "Hardware", True, 0)

if $tIndex = -1 Then
    MsgBox(0,"ERROR", "Cannot find tab")
Else
    _GUICtrlTab_SetCurFocus($hSysTab, $tIndex)
EndIf

I also strid the GUI Tab items but they are no help either.

Thanks

F

Link to comment
Share on other sites

Joon,

What does your message mean??? Can I get a fix for now or... well, not fully understanding what is meant.

Thanks

F

You can either wait for next AutoIt release or compile your code with Beta version.

Link to comment
Share on other sites

Thanks,

I tried that (downloaded the current beta version) but seems it is still the same.

What am I doing wrong???

Thanks

F

If you are using SciTE, you need to run/compile as Beta. Under tool menu.

Link to comment
Share on other sites

I tried it with his script using the 3.3.7.10 beta, still doesn't get the tabs text, Windows 7 x86 and Windows XP x86, both run under administrator account.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Well, this worked for me with from his script on Windows 7 x64

ConsoleWrite("AutoIt version: " & @AutoItVersion & @CRLF)

#include <GuiTab.au3>
#include <GuiConstantsEx.au3>

Run('control sysdm.cpl')
WinWaitActive('System Properties')

Dim $hWnd = WinGetHandle('System Properties')
Dim $hSysTab = ControlGetHandle($hWnd, '', 'SysTabControl321')
sleep(500)
_GUICtrlTab_SetCurFocus($hSysTab, 1)
$tTabs = _GUICtrlTab_GetItemCount($hSysTab)
_GUICtrlTab_SetCurFocus($hWnd, 0)
For $i = 0 to $tTabs
;~     ConsoleWrite("Tab #" & $i & " is " & _GUICtrlTab_GetItemText($hSysTab, $i) & @LF)
    $aItem = _GUICtrlTab_GetItem($hSysTab, $i)
        For $y = 0 To 3
            ConsoleWrite("$aItem[" & $y & "]: " & $aItem[$y] & @LF)
        Next
        ConsoleWrite("---------------------" & @LF)
    ControlCommand("System Properties","", "SysTabControl321", "TabRight","")
Next

$tIndex = _GUICtrlTab_FindTab($hSysTab, "Hardware", True, 0)

if $tIndex = -1 Then
    MsgBox(0,"ERROR", "Cannot find tab")
Else
    _GUICtrlTab_SetCurFocus($hSysTab, $tIndex)
EndIf

Console Output:

AutoIt version: 3.3.7.10
$aItem[0]: 0
$aItem[1]: Computer Name
$aItem[2]: -1
$aItem[3]: 3017164
---------------------
$aItem[0]: 0
$aItem[1]: Hardware
$aItem[2]: -1
$aItem[3]: 29165346
---------------------
$aItem[0]: 0
$aItem[1]: Advanced
$aItem[2]: -1
$aItem[3]: 5244840
---------------------
$aItem[0]: 0
$aItem[1]: System Protection
$aItem[2]: -1
$aItem[3]: 31852614
---------------------
$aItem[0]: 1
$aItem[1]: Remote
$aItem[2]: -1
$aItem[3]: 9568486
---------------------
$aItem[0]: 0
$aItem[1]: 
$aItem[2]: 0
$aItem[3]: 0
---------------------

_GUICtrlTab_GetItemText($hWnd, $i) to _GUICtrlTab_GetItemText($hSysTab, $i) is another change too.

Edited by Joon
Link to comment
Share on other sites

That might be why it wasn't pulling the text, wrong handle and all. Didn't even look at that myself and I should have.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Joon,

Yes your example does work in beta version. Had a time trying to figure out to make the beta compile and run but have it now. Will try this more but thanks for you help

P.S. It seemed to work better in Win7 (x32 for me) but I have to make it work on XP also (that is where I have been seeing the problems more) and sometimes 3rd party software with tabs, I have seen the tabs move. Not sure why, but want to make sure I get it right.

Thanks again

F

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...