Swimming_Bird Posted May 21, 2007 Share Posted May 21, 2007 "rocking" the mouse is when you hold down one key then click the other one.I'm looking to make a script that would detect when someone rocks their mouse in either direction and will perform an action depending on the direction (right<-left , right->left)I've found the (relatively) new function _IsPressed but the issue i was wondering if there was any sort of mouse detection that would act more like a hotkey. I'm not a fan of using such loops when i don't have to. i'm always paranoid they'll miss the action or delay the action too much.When testing it using the given example it missed my just tapping the end key, i had to hold it down instead#include <Misc.au3> $dll = DllOpen("user32.dll") While 1 Sleep ( 250 ) If _IsPressed("23", $dll) Then MsgBox(0,"_IsPressed", "End Key Pressed") ExitLoop EndIf WEnd DllClose($dll)I'd love some suggestions.This script was inspired by the Lifehacker rocker app found here source, it was written in something called Autohotkey.Thanks Link to comment Share on other sites More sharing options...
Davo Posted May 22, 2007 Share Posted May 22, 2007 Hi, you don't necessarily have to sleep for 250ms. It would be fine for most processors these days to sleep for 100 or even 50ms without putting too much stress on the cpu Try only sleeping for 50ms and see how it goes. Dave ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------"I don't need to know everything, I just need to know where to find it when I need it"....EinsteinAnd in our case... That's the AutoIT helpfile ;) Please read before posting!!! Link to comment Share on other sites More sharing options...
Achilles Posted May 22, 2007 Share Posted May 22, 2007 "rocking" the mouse is when you hold down one key then click the other one. I'm looking to make a script that would detect when someone rocks their mouse in either direction and will perform an action depending on the direction (right<-left , right->left) I've found the (relatively) new function _IsPressed but the issue i was wondering if there was any sort of mouse detection that would act more like a hotkey. I'm not a fan of using such loops when i don't have to. i'm always paranoid they'll miss the action or delay the action too much. When testing it using the given example it missed my just tapping the end key, i had to hold it down instead #include <Misc.au3> $dll = DllOpen("user32.dll") While 1 Sleep ( 250 ) If _IsPressed("23", $dll) Then MsgBox(0,"_IsPressed", "End Key Pressed") ExitLoop EndIf WEnd DllClose($dll)Is this what you meant? My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Swimming_Bird Posted May 22, 2007 Author Share Posted May 22, 2007 #Include <Misc.au3> While 1 While _IsPressed('01') If _IsPressed('02') then ConsoleWrite('Congratulation! You pressed both mouse keys at the same time!' & @CRLF) Sleep(100) EndIf Wend Sleep(40) WEndIs this what you meant?i'm not sure if that would be sufficient, but ill give it a shot, because it would have to work both ways. I may try learning the original language, it seems better for capturing things. Link to comment Share on other sites More sharing options...
Achilles Posted May 23, 2007 Share Posted May 23, 2007 (edited) i'm not sure if that would be sufficient, but ill give it a shot, because it would have to work both ways. I may try learning the original language, it seems better for capturing things.When I tested this (very briefly) it worked for both... that's because your computer has sufficient time to enter both loops no matter which button you click first... I suppose you could event make a line like this if you wanted to: While _IsPressed('01') and _IsPressed('02') Edited May 23, 2007 by Piano_Man My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] 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