Tricky898 Posted October 29, 2011 Posted October 29, 2011 (edited) I've created a short test script which is supposed to simply right click, move the mouse slightly, and then left click when a hotkey is pressed. However, when I press the hotkey, the function to move the mouse is not called. Am I missing something fundamental? Many thanks HotkeySet("^{F10}", "myexit") Func myexit() Exit EndFunc HotKeySet("^{F11}","movemouse") Func movemouse() mouseclick("right") $pos = MouseGetPos() MouseMove($pos[0], $pos[1] + 37, 10) mouseclick("left") EndFunc EDIT: Working now! Edited October 29, 2011 by Tricky898
hannes08 Posted October 29, 2011 Posted October 29, 2011 (edited) How long does your script run? As far as I can see it will just run and then exit immediately. Try adding a loop at the end: While 1 Sleep(200) Wend Edited October 29, 2011 by hannes08 Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Developers Jos Posted October 29, 2011 Developers Posted October 29, 2011 When this is the whole script it will end right away after it is started! You need some sort of loop to keep the script active. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Tricky898 Posted October 29, 2011 Author Posted October 29, 2011 (edited) Ah, silly me, I thought it would be something simple like this ! Thanks a lot - will give it another try. EDIT: Got it working! Edited October 29, 2011 by Tricky898
3zuBen Posted October 30, 2011 Posted October 30, 2011 @someone of moderators: is acceptable to the policy of the forum to send other results pertinent to the discussion ?
3zuBen Posted October 30, 2011 Posted October 30, 2011 while learning proved: Func movemouse() ; mouseclick("right") Local $pos1 = MouseGetPos() MsgBox(0, "MOUSE INFO", "Mouse x,y: " & $pos1[0] & "," & $pos1[1]) Sleep(200) MouseMove($pos1[0] + 20, $pos1[1] + 20, 10) Sleep(200) Local $pos2 = MouseGetPos() MsgBox(0, "Mouse x,y: ", "Moved at: " & $pos2[0] & "," & $pos2[1]) ; mouseclick("left") EndFunc Func myexit() Exit EndFunc HotkeySet("^{F10}", "myexit") HotKeySet("^{F11}","movemouse") While 1 Local $pos0 = MouseGetPos() ToolTip ( "Mouse x,y: " & $pos0[0] & " __ " & $pos0[1], 0, 0, "TOOLTIP title" , 1, 2) Sleep(200) Wend
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