Sign in to follow this  
Followers 0
mmillar

Which tab am I on?

4 posts in this topic

#1 ·  Posted (edited)

Hi,

I'm trying to automate the collection of some information in the properties window of a third-party program.

The properties window has eight tabs and when you open it you don't know which of the eight tabs you will be on.

The information I want is on the General tab. At the moment I can use...

     $a = ControlGetFocus("Indicator Properties - test")

...and I know that if I'm on the General tab then $a will be 'Edit1'. If it isn't I send a Ctrl-PgUp (to move to the next tab) and try again.

This seems a bit slow and cumbersome and I wondered if there was an easier/better way to get straight to the General tab.

Thanks for any help.

Edited by mmillar

Share this post


Link to post
Share on other sites



Have a look at

ControlCommand ( "title", "text", controlID, "command", "option" )

and specific

Command, Option Return Value

"CurrentTab", "" Returns the current Tab shown of a SysTabControl32

"TabRight", "" Moves to the next tab to the right of a SysTabControl32

"TabLeft", "" Moves to the next tab to the left of a SysTabControl32

Maybe you could use TabLeft until CurrentTab is General.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hi dabus,

Thanks for your reply. Unfortunately, I can't get this to work. If my properties window is open and I run this code...

If WinActive ("Indicator Properties - test") then

$d = ControlCommand ("Indicator Properties - test", "", "Edit1", "CurrentTab", "")

MsgBox(0, "test2", $d)

EndIf

...then I just get '1' returned every time. If I replace "Edit1" with "" then I just get the same.

Any ideas?

Thanks

Edited by mmillar

Share this post


Link to post
Share on other sites

Hi dabus,

Thanks for your reply. Unfortunately, I can't get this to work. If my properties window is open and I run this code...

If WinActive ("Indicator Properties - test") then

$d = ControlCommand ("Indicator Properties - test", "", "Edit1", "CurrentTab", "")

MsgBox(0, "test2", $d)

EndIf

...then I just get '1' returned every time. If I replace "Edit1" with "" then I just get the same.

Any ideas?

Thanks

hi there

here is the code which you are looking for, it will tell you which tab item you are on

in this example i need to know which tab i am on so i can write a file to that tab

where 0=first tab item, 1=second tab item etc...

using GUICtrlRead will tell you which tab item is open

then simply use the value to manipulate the tab

$d=GUICtrlRead ( $tab )

If $d = 0 Then

GuiCtrlSetData($tab0, $contents)

ElseIf $d=1 Then

GuiCtrlSetData($tab1, $contents)

ElseIf $d=2 Then

GuiCtrlSetData($tab2, $contents)

ElseIf $d=3 Then

GuiCtrlSetData($tab3, $contents)

EndIf

no i can sleep...... :)

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