Henrik Posted July 11, 2005 Share Posted July 11, 2005 My script tries to manipulate an application whose main window contains a SysTabControl32 with 4 tabs. MouseClick() is used to switch between the Tab pages. Switching from any Tab page to page 4 works fine. Then, when switching away from page 4 to another Tab page, that page is not displayed properly, i.e: - The new Tab comes to the front, but the controls from page 4 are still displayed. - When mousing over the tab page area, the controls on the newly selected page are shown on top of the page 4 controls and function properly. - A button outside of the Tab control changes behaviour according to which Tab page has been selcted. This button retains its 'page 4 behaviour'. This behaviour occurs with both AutoIt 3.1.1 and the 3.1.1.56 beta. It seems the application receives the MouseClick(), but does not respond as it should. Any suggestions as to what the reason might be? Workarounds are welcome, too. Oh, btw, in one case (out of say, 30) the application responded properly to the MouseClick(). As for using ControlCommand to switch between tabs, "CurrentTab" returns 1 no matter which tab page has been selected. Ignorance is strength. Link to comment Share on other sites More sharing options...
jpm Posted July 11, 2005 Share Posted July 11, 2005 Can you share with us the script and the environment needed? At least part of it Difficult to help you Link to comment Share on other sites More sharing options...
Henrik Posted July 11, 2005 Author Share Posted July 11, 2005 This script reproduces the problem: expandcollapse popup; AutoIT scripting options AutoItSetOption("MustDeclareVars", 1) ; variables must be declared with Dim/Local/Global AutoItSetOption("WinTitleMatchMode", 4);advanced mode ; Tab control pages dim $CopyTab_x = 600 dim $ScanTab_x = 700 dim $PrintTab_x = 800 dim $SetupTab_x = 900 dim $Tabs_y = 35 ;Generic controls Dim $Generic_OKBtn = 1 Dim $Generic_CloseBtn = 2 ; Main window controls (except controls on the tab pages) Dim $CopyBtn = 1379 ; Controls on Setup Tab Dim $Setup_MarginBtn = 1132 dim $Dummy SelectSetupTab();This is "Tab page 4" ; Begin: ADDING THIS PROVOKES FAILURE ClickControlInActiveWindow($Setup_MarginBtn) ClickControlInActiveWindow($Generic_OKBtn);close "Margins" dialog or open "Margins Updated" dialog ; When the above is done first time after JetImage launch (or possibly other situations), ; we get the "Margins Updated" dialog & must close it If WinActive("active", "Margins Updated") Then ClickControlInActiveWindow($Generic_OKBtn);close "Margins Updated" dialog ClickControlInActiveWindow($Generic_OKBtn);close "Margins" dialog EndIf ; End: ADDING THIS PROVOKES FAILURE SelectCopyTab();This is "Tab page 1" ; Both the following 2 click methods fail ;~ ClickControlInActiveWindow($CopyBtn);first method Dim $pos = ControlGetPos("active","",$CopyBtn);2nd method MouseClick("left",$pos[0] +($pos[2]/2),$pos[1]+($pos[3]/2)) $Dummy = MsgBox(0, @ScriptName, "End of script.") ;functions Func SelectCopyTab() MouseClick("left", $CopyTab_x+5, $Tabs_y) Sleep(250) EndFunc Func SelectSetupTab() MouseClick("left", $SetupTab_x, $Tabs_y) Sleep(250) EndFunc func ClickControlInActiveWindow($TheControl) dim $Result $Result = ControlClick("active", "", $TheControl) if $Result = 0 Then $Dummy = MsgBox(0, @ScriptName, "Clicking the control with number " & $TheControl & " failed. Exiting script.") EndIf Sleep(250) EndFunc Just switching between Tab pages went OK. Adding code which opens and closes a dialog before switching to the first ("Copy") tab provokes the error (That code is marked above with "ADDING THIS PROVOKES FAILURE" at its start and end). Perhaps it is something to do with the main window not being properly activated after closing the dialog? This is a sample script to reproduce the error, I refrained from posting the entire script in the OP, as it is some 15 files. The application is "DesignJet 4500 Scanner 6.2". It runs on a "Panel PC" with a touch screen under WinXP Embedded. Ignorance is strength. Link to comment Share on other sites More sharing options...
Henrik Posted July 13, 2005 Author Share Posted July 13, 2005 Problem solved. The WinActive call was not correct. ;This is the code which didn't work: AutoItSetOption("WinTitleMatchMode", 4);advanced mode If WinActive("active", "Margins Updated") Then <a couple of ControlClick()'s, each followed by a short Delay()> Endif What was intended with the WinActive call was to ask 'Does the currently active window contain the text "Margins Updated"?' Apparently that is not the meaning of the call, as WinActive returned 1 (success) in all cases. Consequently, the script ControlClick'ed in cases where it shouldn't have, which screwed up the application. This works as required (the window I'm checking for has no title): AutoItSetOption("WinTitleMatchMode", 3);exact title match If WinActive("", "Margins Updated") Then How exactly does the "active" parameter work (in mode 4)? Does it override the other matching criteria in the Win### functions? Ignorance is strength. 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