Jump to content

Press tab control


Recommended Posts

Hello Everybody

I am new to AutoIt I just practiced it few days ago

I want to write script that change periodicity for metastock applicatio

I did most of the script I go to menu then F&rmat Then &X-Axis...

As follow

WinWaitActive("[CLASS:MetaStockMainWnd]", "")

WinMenuSelectItem("[CLASS:MetaStockMainWnd]", "", "F&ormat", "&X-Axis..." )

Sleep(500)

Then a window comes out with tab control of four tabs

Scale Periodicity Margins Grid

and I want to choose periodicity

how can I press Periodicity tab

any help please

Link to comment
Share on other sites

The link I gave you is trying to click a tab that has not been created in their own app but in outlook:

"I'm making a program to automate account creation in outlook 2k3. I get all the fields entered with text, click the "More Settings" button, but I cannot click an individual tab. I want to click the "Outgoing mail server" tab and check "My server requires authentication" is there a way to do this without using send keys, and click by coordinates?"

Link to comment
Share on other sites

I'm not sure that I understand the problem. I assume it's an issue due to the controls appearing after a certain time that's not completely predictable. I had a similar situation where selecting an item in one drop down causes new ones to appear on the screen. Rather than "sleeping" to wait for the new controls to appear, I used this:

; Wait for field to appear.
Do
  ControlGetHandle("Title", "", "[NAME:Handle]")
Until @error <> 1
Gerard J. Pinzonegpinzone AT yahoo.com
Link to comment
Share on other sites

Thank you GPinZone for replying and thank Delstone

I got the following script from the linke provided above it activate system propertis window and press the tab advanced

; This must be run with Beta 3.2.13.1 or later to have _GuiCtrlTab_ClickTab()

#include <GuiTab.au3>

; Open system properties

Dim $sTitle = "System Properties"

Send("#{Pause}")

WinWait($sTitle, "", 10)

$hWnd = WinGetHandle($sTitle)

If @error Then _Exitonerror("Failed to open System Properties window.")

WinActivate($hWnd)

Sleep(2000)

; Get handle to Tab control

$hTab = ControlGetHandle($hWnd, "", "SysTabControl321")

If @error Then _Exitonerror("Failed to get handle to TAB control.")

; Find and select Advanced tab

$iAdvTab = _GUICtrlTab_FindTab($hTab, "Advanced")

If $iAdvTab = -1 Then _Exitonerror("Failed to find 'Advanced' tab.")

_GUICtrlTab_ClickTab($hTab, $iAdvTab)

If _GUICtrlTab_GetCurSel($hTab) <> $iAdvTab Then _Exitonerror("Failed to change selected tab to 'Advanced'.")

Sleep(2000)

; Click on Error Reporting button

ControlClick($hWnd, "", "[CLASS:Button; INSTANCE:8]"); Error Reporting

; Wait for Error Reporting dialog and click 'Cancel'

WinWait("Error Reporting", "", 10)

Sleep(2000)

ControlClick("Error Reporting", "", "[CLASS:Button; INSTANCE:8]"); CANCEL

Sleep(2000)

; Close System Properties

WinClose($hWnd)

Func _Exitonerror($sText)

MsgBox(16, "Error", $sText)

Exit

EndFunc

the problem here is even if you change the name of the window Dim ($sTitle = "System Properties")

for another window say Dim $sTitle = "X-Axis Properties"

and change

$iAdvTab = _GUICtrlTab_FindTab($hTab, "Advanced")

to

$iAdvTab = _GUICtrlTab_FindTab($hTab, "Periodicity")

when i run the script the system properties window open i dont know why

you can try it your self if you have an explanation please let me know

thank you very much

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...