MuffettsMan Posted January 15, 2008 Share Posted January 15, 2008 trying to get controlsend to send a mouseclick to something like mspaint.... in theory the click would leave a single black pixel no dice though... any ideas? expandcollapse popup#include <Array.au3> #include <misc.au3> Global $MsPaint2[3][3] #cs >>>> Window <<<< Title: untitled - Paint Class: MSPaintApp Position: 594, 0 Size: 683, 742 Style: 0x16CFC000 ExStyle: 0x00000110 Handle: 0x002E01C0 >>>> Control <<<< Class: Instance: ClassnameNN: ID: Text: Position: Size: ControlClick Coords: Style: ExStyle: Handle: 0x0508024E #ce Run("mspaint.exe", "", @SW_MAXIMIZE) sleep(1000) $MsPaint2 = WinList ("untitled - Paint") sleep(1000) $pos = MouseGetPos() ConsoleWrite( "left mouse click... Mouse x,y: " & $pos[0] & "," & $pos[1] & @CRLF) ; ControlClick ( "title", "text", controlID [, button [, clicks [, x [, y ]]]] ) ; ControlClick ( $MsPaint2[1][1], "", "", "left", 1, $pos[0], $pos[1]) ; ERROR: ==> Incorrect number of parameters in function call.: ; ControlClick ( "untitled - Paint",,,,, $pos[0], $pos[1]) ; ==> Error in expression.: ; ==> Error in expression.: ControlClick ( "untitled - Paint",,,,, $pos[0], $pos[1]) ; ==> Error in expression.: ControlClick ( "untitled - Paint",^ ERROR ; ControlClick ( "untitled - Paint","","","","", $pos[0], $pos[1]) ; ERROR: ==> Incorrect number of parameters in function call. WinActivate ( "untitled - Paint" ) ; These don't error... but no click either >_< ControlClick ("untitled - Paint", '', '' , 'left' , 1, 200 , 200) ControlClick ($MsPaint2[1][1], "", "" , 'left' , 2 , 200 , 201) ControlClick ($MsPaint2[1][1], "", "" , 'left' , 1 , 200 , 202) Don't let that status fool you, I am no advanced memeber! Link to comment Share on other sites More sharing options...
Nahuel Posted January 16, 2008 Share Posted January 16, 2008 ControlClick ( "title", "text", controlID [, button [, clicks [, x [, y ]]]] )And look at what you did:ControlClick ("untitled - Paint", '', '' , 'left' , 1, 200 , 200) Link to comment Share on other sites More sharing options...
MuffettsMan Posted January 16, 2008 Author Share Posted January 16, 2008 ControlClick ( "title", "text", controlID [, button [, clicks [, x [, y ]]]] ) And look at what you did: ControlClick ("untitled - Paint", '', '' , 'left' , 1, 200 , 200) I put the Autoit window info in the comments that shows the controlID as blank? this same logic works for controlsend - so basicly controlclick req a controlID and if it doesn't have one then its sol? this is the window info output for mspaint... can u tell me what the controlID should be? O.o >>>> Window <<<< Title: WinNfo.JPG - Paint Class: MSPaintApp Position: -4, -4 Size: 1288, 746 Style: 0x17CFC000 ExStyle: 0x00000110 Handle: 0x00B10392 >>>> Control <<<< Class: Afx:1000000:8 Instance: 1 ClassnameNN: Afx:1000000:81 ID: Text: Position: 58, 2 Size: 1220, 616 ControlClick Coords: 327, 401 Style: 0x54200000 ExStyle: 0x00000000 Handle: 0x01D803FE >>>> Mouse <<<< Position: 385, 449 Cursor ID: 0 Color: 0xFFFFFF >>>> StatusBar <<<< 1: For Help, click Help Topics on the Help Menu. 2: 324,398 3: >>>> Visible Text <<<< For Help, click Help Topics on the Help Menu. Colors Colors Tools Tools >>>> Hidden Text <<<< Don't let that status fool you, I am no advanced memeber! Link to comment Share on other sites More sharing options...
MuffettsMan Posted January 16, 2008 Author Share Posted January 16, 2008 yah for sanity sake i checked my other scripts.... this is working perfectly - program its sneding into doesn't have a controlid either ControlSend ($WoWClient2[1][1],"","","{s Down}") ControlSend ($WoWClient3[1][1],"","","{q Down}") ControlSend ($WoWClient4[1][1],"","","{e Down}") can't find much of any examples on the forums either think i may just have to focus each window Don't let that status fool you, I am no advanced memeber! Link to comment Share on other sites More sharing options...
Nahuel Posted January 16, 2008 Share Posted January 16, 2008 (edited) oh well... The other thing I noticed is that you wrote "untitled" instead of "Untitled" (My Os isn't in english so I wasn't sure). Replace "untitled - Paint" with "[Class:MSPaintApp]" in all of them. This works for me: Run("mspaint.exe", "", @SW_MAXIMIZE) ;~ sleep(1000) ;~ $MsPaint2 = WinList ("[Class:MSPaintApp]" ) ;~ sleep(1000) $pos = MouseGetPos() ConsoleWrite( "left mouse click... Mouse x,y: " & $pos[0] & "," & $pos[1] & @CRLF) WinActivate ( "[Class:MSPaintApp]" ) ControlClick ("[Class:MSPaintApp]" , '', '[ClassNN:Afx:1000000:81]' , 'left' , 1, 200 , 200) ControlClick ("[Class:MSPaintApp]", "", '[ClassNN:Afx:1000000:81]' , 'left' , 2 , 200 , 201) ControlClick ("[Class:MSPaintApp]", "", '[ClassNN:Afx:1000000:81]' , 'left' , 1 , 200 , 202) Afx:1000000:81 is what my window info tool tells me to be the ClassnameNN of the control... hope it works for you too. This used to be easier with older Windows versions... Edited January 16, 2008 by Nahuel Link to comment Share on other sites More sharing options...
MuffettsMan Posted January 16, 2008 Author Share Posted January 16, 2008 oh well... The other thing I noticed is that you wrote "untitled" instead of "Untitled" (My Os isn't in english so I wasn't sure). Replace "untitled - Paint" with "[Class:MSPaintApp]" in all of them. This works for me: Run("mspaint.exe", "", @SW_MAXIMIZE) ;~ sleep(1000) ;~ $MsPaint2 = WinList ("[Class:MSPaintApp]" ) ;~ sleep(1000) $pos = MouseGetPos() ConsoleWrite( "left mouse click... Mouse x,y: " & $pos[0] & "," & $pos[1] & @CRLF) WinActivate ( "[Class:MSPaintApp]" ) ControlClick ("[Class:MSPaintApp]" , '', '[ClassNN:Afx:1000000:81]' , 'left' , 1, 200 , 200) ControlClick ("[Class:MSPaintApp]", "", '[ClassNN:Afx:1000000:81]' , 'left' , 2 , 200 , 201) ControlClick ("[Class:MSPaintApp]", "", '[ClassNN:Afx:1000000:81]' , 'left' , 1 , 200 , 202) Afx:1000000:81 is what my window info tool tells me to be the ClassnameNN of the control... hope it works for you too. This used to be easier with older Windows versions... wow i just tried it this works for me too good stuff - i didn't know i could use class as the title and ClassnameNN as the controlID but i just tried it and it seems to work well thanks for the help this def got me going in the right direction Don't let that status fool you, I am no advanced memeber! 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