illya Posted April 14, 2008 Share Posted April 14, 2008 Hi i've been trying to create a AutoIt that is supposed to: 1) Send("^!r") 2) wait untill I have pressed something with the main mousebutton 3) then Send("^!r") again the problem: It doesnt allow windows to register the mouseclick. Lets say Send("^!r") makes a menu popup, when I then klick on a link on that menu, it performs Send("^!r") again and the menu is gone. But the menu never registered that I klicked on it. And I want it to register that. In other words: The script registers the mouseclicks, but no other application. #include <MouseSetOnEvent_UDF.au3> Send("^!r") ;press ctrl+alt+r _MouseSetOnEvent($MOUSE_PRIMARYUP_EVENT, "MousePrimaryUp_Event") ;Listen for mouseUp and then call MousePrimaryUp_Event Sleep(6000) ;how long the AutoIt should stay up in case I dont click anything Func MousePrimaryUp_Event() Sleep(100) ;I tried to do this to enable the links to sense the mouseUp before Send("^!r") performed Send("^!r") ;press ctrl+alt+r ; Here im gonna find a way to shut down the AutoIt EndFunc I did have another post about this, but since the topic was about something else I thought it was better to create a new. Link to comment Share on other sites More sharing options...
monoceres Posted April 14, 2008 Share Posted April 14, 2008 I think you would be better of with _IsPressed(): #include <misc.au3> Send("^!r") $timer=TimerInit() While 1 Sleep(100) If _IsPressed("01") Then Send("^!r") ExitLoop EndIf If TimerDiff($timer)>6000 Then ExitLoop WEnd Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
illya Posted April 14, 2008 Author Share Posted April 14, 2008 Hi i've been trying to create a AutoIt that is supposed to: 1) Send("^!r") 2) wait untill I have pressed something with the main mousebutton 3) then Send("^!r") again the problem: It doesnt allow windows to register the mouseclick. Lets say Send("^!r") makes a menu popup, when I then klick on a link on that menu, it performs Send("^!r") again and the menu is gone. But the menu never registered that I klicked on it. And I want it to register that. In other words: The script registers the mouseclicks, but no other application. #include <MouseSetOnEvent_UDF.au3> Send("^!r") ;press ctrl+alt+r _MouseSetOnEvent($MOUSE_PRIMARYUP_EVENT, "MousePrimaryUp_Event") ;Listen for mouseUp and then call MousePrimaryUp_Event Sleep(6000) ;how long the AutoIt should stay up in case I dont click anything Func MousePrimaryUp_Event() Sleep(100) ;I tried to do this to enable the links to sense the mouseUp before Send("^!r") performed Send("^!r") ;press ctrl+alt+r ; Here im gonna find a way to shut down the AutoIt EndFunc I did have another post about this, but since the topic was about something else I thought it was better to create a new. EDIT: SOLVED: Using ControlClick I was able to get rid of the problem, by making ControlClick click again. #include <MouseSetOnEvent_UDF.au3> $i = 0 $a = 0 Send("^!r") _MouseSetOnEvent($MOUSE_PRIMARYUP_EVENT, "MousePrimaryUp_Event") While $i <= 20 $i = $i + 1 If $i = 21 Then If $a = 0 Then Send("^!r") EndIf EndIf If $i <= 20 Then Sleep(200) EndIf WEnd Func MousePrimaryUp_Event() ControlClick ( "RocketDock", "", "" ) Sleep(100) Send("^!r") $i = 20 $a = 1 EndFunc The only problem now is a little nasty focus-problem where the window the link opens looks like it has focus, but in fact doesnt. Anyway the big problem is solved 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