jamief00 Posted May 18, 2012 Share Posted May 18, 2012 I have a script which needs to be executed by scheduled job - everything works when I'm logged on (I used MouseClick for one event). However when I switch to using ControlClick, it doesn't work. The control is >>>> Window <<<< Title: Backoffice [JFR] Class: ThunderRT6MDIForm Position: -4, -4 Size: 1288, 1002 Style: 0x17CF0000 ExStyle: 0x00040100 Handle: 0x00180212 >>>> Control <<<< Class: SSListbarWndClass Instance: 1 ClassnameNN: SSListbarWndClass1 Name: Advanced (Class): [CLASS:SSListbarWndClass; INSTANCE:1] ID: Text: Position: 0, 3 Size: 113, 903 ControlClick Coords: 57, 417 Style: 0x56000000 ExStyle: 0x00000000 Handle: 0x00110368 >>>> Mouse <<<< Position: 57, 489 Cursor ID: 0 Color: 0x848284 >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< Blank Form >>>> Hidden Text <<<< I'm using ControlClick($backofficeUser, "", "SSListbarWndClass", "left", 1, 57, 489) Which doesn't work, but the following does MouseClick("left", 57, 489) Can anyone help? Link to comment Share on other sites More sharing options...
JohnOne Posted May 18, 2012 Share Posted May 18, 2012 (edited) ControlClick($backofficeUser, "", "SSListbarWndClass", "left", 1) Edited May 18, 2012 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
jamief00 Posted May 18, 2012 Author Share Posted May 18, 2012 (edited) Hi - I need to use the coordinates, as the control is an "outlook" style listbar. I need to click the "Price Feed Update". The coordinates are correct, its just that the control doesn't seem to receive the correct events.Using Spy++, when I do it manually I get<00038> 00890140 R WM_NCHITTEST nHittest:HTCLIENT <00039> 00890140 S WM_MOUSEACTIVATE hwndTopLevel:004D00F4 nHittest:HTCLIENT uMsg:WM_LBUTTONDOWN <00040> 00890140 R WM_MOUSEACTIVATE fuActivate:MA_ACTIVATE <00041> 00890140 S WM_SETCURSOR hwnd:00890140 nHittest:HTCLIENT wMouseMsg:WM_LBUTTONDOWN <00042> 00890140 S WM_NCHITTEST xPos:59 yPos:448 <00043> 00890140 R WM_NCHITTEST nHittest:HTCLIENT <00044> 00890140 R WM_SETCURSOR fHaltProcessing:False <00045> 00890140 P WM_LBUTTONDOWN fwKeys:MK_LBUTTON xPos:59 yPos:376 <00046> 00890140 P WM_MOUSEMOVE fwKeys:MK_LBUTTON xPos:59 yPos:376However ControlClick does<00001> 005600F4 P WM_LBUTTONDOWN fwKeys:MK_LBUTTON xPos:51 yPos:379 <00002> 005600F4 P WM_LBUTTONUP fwKeys:0000 xPos:51 yPos:379 <00003> 005600F4 S WM_CAPTURECHANGED hwndNewCapture:00000000 <00004> 005600F4 R WM_CAPTURECHANGED Edited May 18, 2012 by jamief00 Link to comment Share on other sites More sharing options...
BrewManNH Posted May 18, 2012 Share Posted May 18, 2012 ControlClick Coords: 57, 417 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 GudeHow 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 More sharing options...
jamief00 Posted May 21, 2012 Author Share Posted May 21, 2012 ControlClick Coords: 57, 417The coordinates I used above are correct - confirmed with mouseclick (prob a copy paste error in my post above).The issue is that the control doesn't seem to receive ControlClick events.Can anyone help? Link to comment Share on other sites More sharing options...
JohnOne Posted May 21, 2012 Share Posted May 21, 2012 In what way do you think controlclick coords are the same as mouseclick coords? How did you confirm it? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
jamief00 Posted May 21, 2012 Author Share Posted May 21, 2012 (edited) I used Au3Info.exeInitially my screen is like this:I usedControlClick($backofficeUser, "", "[CLASS:SSListbarWndClass; INSTANCE:1]", "left", 1, 56, 858)Which works fine, and gives me this:However no matter what I try (coordinates wise), I can't get controlclick to work on the price feed update button.There are no keyboard shortcuts on this control.THe only thing that works in MouseClick, but that isn't suitable as this needs to be a scheduled job.ControlClick($backofficeUser, "", "[CLASS:SSListbarWndClass; INSTANCE:1]", "left", 1, 51, 377)Doesn't work. Edited May 21, 2012 by jamief00 Link to comment Share on other sites More sharing options...
JohnOne Posted May 21, 2012 Share Posted May 21, 2012 Are you certain that the buttons that become available after expanding the category are the same control/instance? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
jamief00 Posted May 21, 2012 Author Share Posted May 21, 2012 Yes - using Au3Info, the whole control is highlighted and has the same classname... Link to comment Share on other sites More sharing options...
JohnOne Posted May 21, 2012 Share Posted May 21, 2012 I'm out then sorry. I don't have backoffice to try it either, but it seems you have been at it for a while anyway, so it might just be unfortunate that you cannot do it in this fashion. I'm not trying to put you off, but there are some controls that will not be manipulated AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
jamief00 Posted May 21, 2012 Author Share Posted May 21, 2012 (edited) Well, managed to get a little further, using the _MouseClickPlus script. I use the _SendMouseMove and then _MouseClickPLus commands, and it appears to click the button. However I then get the following error: --------------------------- Backoffice --------------------------- Initialisation of price feed failed with the following error : Automation error An outgoing call cannot be made since the application is dispatching an input-synchronous call. --------------------------- OK --------------------------- Edited May 21, 2012 by jamief00 Link to comment Share on other sites More sharing options...
JohnOne Posted May 21, 2012 Share Posted May 21, 2012 "_SendMouseMove" ?you got a link? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
jamief00 Posted May 21, 2012 Author Share Posted May 21, 2012 (edited) It was essentially this: Func _SendMouseMove($Window, $X = "", $Y = "", $Speed = 10) Local $WM_MOUSEMOVE = 0x0200 Local $WinHandle = WinGetHandle($Window) Local $i = 0 Local $MouseCoord = MouseGetPos() $StartX = $MouseCoord[0] $StartY = $MouseCoord[1] If $X = "" OR $Y = "" Then $X = $MouseCoord[0] $Y = $MouseCoord[1] EndIf $StopX = $X $StopY = $Y If $Speed > 0 Then $JumpX = ($StopX - $StartX) / $Speed $JumpY = ($StopY - $StartY) / $Speed For $i = 1 to $Speed $X = $X + $JumpX $Y = $Y + $JumpY $lCoords = _MakeLong($X, $Y) __SendMessageCall($WinHandle, $WM_MOUSEMOVE, 0, $lCoords) Sleep(10) Next EndIf $lCoords = _MakeLong($StopX, $StopY) __SendMessageCall($WinHandle, $WM_MOUSEMOVE, 0, $lCoords) EndFunc Func __SendMessageCall($WinHandle, $iAction, $iParam, $lCoords) DllCall("user32.dll", "int", "PostMessage", _ "hwnd", $WinHandle, _ "int", $iAction, _ "int", $iParam, _ "long", $lCoords) EndFunc Edited May 21, 2012 by jamief00 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