Badriel Posted February 1, 2011 Share Posted February 1, 2011 Hello, I'm new to this forum and AutoIt in general. I'm trying to use a ControlSend to send a mouseclick, and keystrokes into an application. Even though, I get it working (application receives mouseclicks), after end of the function it always sends "1". So, after each mousehold, it adds "1" into the target window. Here's the script. Global $ItemPick HotKeySet("{F5}", "_ItemPick") HotKeySet("{F11}", "_Exit") ;;;; Body of program would go here ;;;; While 1 Sleep(100) WEnd ;;;;;;;; Func _ItemPick() $ItemPick = NOT $ItemPick While $ItemPick WinWaitActive("Bez tytułu — Notatnik") Sleep(Random(20, 80, 1)) ControlSend ("Bez tytułu — Notatnik", "", "Edit1", MouseDown("left"), "") Sleep (2000) ControlSend("Bez tytułu — Notatnik", "", "Edit1", MouseUp("left"), "") WEnd EndFunc Func _Exit() Exit EndFunc "Bez tytułu — Notatnik" = Notepad in this case. Link to comment Share on other sites More sharing options...
Jfish Posted February 1, 2011 Share Posted February 1, 2011 (edited) I suspect it has something to do with the fact that mousedown("button") returns "1" if on sucess. I don't think you should use controlsend with that function because you are probably sending the result AND performing the function. What if instead you just looped the activation of the window and the mousedown("left"), mouseup("left") without controlsend? [edit: I tested it and it works ...] WinWaitActive("Untitled - Notepad") Sleep(Random(20, 80, 1)) MouseDown("left") MsgBox("","","MouseDown",1) Sleep (2000) MouseUp("left") MsgBox("","","MouseDown",1 JFish Edited February 1, 2011 by Jfish Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt Link to comment Share on other sites More sharing options...
Badriel Posted February 1, 2011 Author Share Posted February 1, 2011 I suspect it has something to do with the fact that mousedown("button") returns "1" if on sucess. I don't think you should use controlsend with that function because you are probably sending the result AND performing the function. What if instead you just looped the activation of the window and the mousedown("left"), mouseup("left") without controlsend?JFishWell, I guess that's the only option, but I really wanted to do it through controlsend. Thank you for your support. Link to comment Share on other sites More sharing options...
Jfish Posted February 1, 2011 Share Posted February 1, 2011 Consider using ControlFocus just prior to mousedown and mouseup instead. Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt 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