martin Posted October 16, 2006 Share Posted October 16, 2006 If I run the script below and then start up another script which has a window title "test" I thought I would be able to get the mouse position in the test window like this. #Include <GuiConstants.au3> Dim $c[4] $q = guicreate("cursor position") $l = guictrlcreatelabel("",10,10,100,20) guisetstate() WinWaitActive("test");wait for my test app to start $h = WinGetHandle("test");get its handle while GUIGetMsg() <> $GUI_EVENT_CLOSE $c = GUIGetCursorInfo($h) if IsArray($c) Then;show the position of the mouse in the test window guictrlsetdata($l,"x= " & $c[0] & ", y= " & $c[1] & " ,buttons = " & $c[2] & ", " & $c[3]) EndIf WEnd GUIGetCursorINfo($h) never returns an array. What am I doing wrong? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Helge Posted October 16, 2006 Share Posted October 16, 2006 GUIGetCursorInfo only works on GUIs created by the same script. Instead you can use MouseCoordMode (Opt) and MouseGetPos to handle the mouse-positions. Use _IsPressed to detect mouseclicks and WinActive to check if the "test"-window is active. Link to comment Share on other sites More sharing options...
martin Posted October 16, 2006 Author Share Posted October 16, 2006 GUIGetCursorInfo only works on GUIs created by the same script.Thanks Helge, the help file wasn't clear to me on this point. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. 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