Klexen Posted October 20, 2008 Posted October 20, 2008 (edited) 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? This is what I get with WindowInfo expandcollapse popup>>>> Window <<<< Title: Internet E-mail Settings Class: #32770 Position: 296, 270 Size: 367, 443 Style: 0x94C800CC ExStyle: 0x00010101 Handle: 0x001B043C >>>> Control <<<< Class: SysTabControl32 Instance: 1 ClassnameNN: SysTabControl321 Advanced (Class): [CLASS:SysTabControl32; INSTANCE:1] ID: 12320 Text: Position: 6, 7 Size: 349, 375 ControlClick Coords: 71, 9 Style: 0x54030200 ExStyle: 0x00000004 Handle: 0x00280442 >>>> Mouse <<<< Position: 376, 308 Cursor ID: 0 Color: 0x000000 >>>> StatusBar <<<< >>>> Visible Text <<<< General Mail Account Type the &name by which you would like to refer to this account. For example: "Work" or "Microsoft Mail Server" mail.test.com Other User Information &Organization: &Reply E-mail: OK Cancel >>>> Hidden Text <<<< &Apply Help Outgoing Server My &outgoing server (SMTP) requires authentication &Use same settings as my incoming mail server &Log on using Log on to &incoming mail server before sending mail User &Name: &Password: &Remember password Log on using &Secure Password Authentication (SPA) Edited October 20, 2008 by Klexen
PsaltyDS Posted October 20, 2008 Posted October 20, 2008 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?Have you tried any of the _GuiCtrlTab_* UDF functions in the current Beta? 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
Klexen Posted October 20, 2008 Author Posted October 20, 2008 Have you tried any of the _GuiCtrlTab_* UDF functions in the current Beta? I wasn't aware there were any. I will check it out!
Klexen Posted October 21, 2008 Author Posted October 21, 2008 How do I get the tab properties of tabs that I didn't create? like $hwnd $iIndex
rasim Posted October 21, 2008 Posted October 21, 2008 How do I get the tab properties of tabs that I didn't create? like $hwnd $iIndexExample: #include <WindowsConstants.au3> #include <GuiTab.au3> Send("#{Pause}") Dim $sTitle = "Свойства системы" ;Change title name, because my OS is russian :) WinWait($sTitle) WinActivate($sTitle) WinWaitActive($sTitle) $hWnd = WinGetHandle($sTitle) $hTab = ControlGetHandle($hWnd, "", "SysTabControl321") $TabID = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", $hTab) $TabID = $TabID[0] MsgBox(48, "Attention", "Now we change a tab item") _GUICtrlTab_SetCurFocus($hTab, 1) $sResult = _SendMessage($hWnd, $WM_NOTIFY, $TabID, $TCN_SELCHANGE)
PsaltyDS Posted October 21, 2008 Posted October 21, 2008 How do I get the tab properties of tabs that I didn't create? like $hwnd $iIndex You have a working example from rasim, but here is one that avoids the DLL call and uses the Beta UDF for GuiTab.au3. It opens the System Properties window, selects the Advanced tab, then clicks on Error Reporting, closes that by clicking Cancel, and lastly closes the System Properties window. It works fine under XP, might need tweaking for other OS's: expandcollapse popup; 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 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
Klexen Posted October 21, 2008 Author Posted October 21, 2008 (edited) I got it! Thank you so much, both of you! The only thing that sucks though, is the _GUICtrlTab_ClickTab doesn't work if computer is locked, like controlsend etc.. Oh well! Edited October 21, 2008 by Klexen
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