AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

MouseWheel to Intelligently Move Mouse Cursor

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
PooFox



Joined: 15 Mar 2010
Posts: 15

PostPosted: Mon Mar 15, 2010 9:13 am    Post subject: MouseWheel to Intelligently Move Mouse Cursor Reply with quote

Hi, im having a hard time executing a seemingly simple script. No doubt this is due to my inexperience, but I could really use some pointers. i think i can get this to work if someone could point out some code to me that would accomplish this one thing:

When i scroll the mousewheel in a certain window of a certain program, i want the cursor to move slowly when i scroll slowly and fast when i scroll fast in a given direction.

ultimately what i want to do is have the mouse wheel simulate click&drag movements either horizontally or vertically, but the dragging portion should follow how much or little i scroll.

If anyone can help me achieve this, i will be able to happily get back to making music instead of fiddling with code i dont entirely grasp. thanks so much!

one other aspect im rather confused about is the interaction of loops and timers. specifically, how can i set things up so that when i scroll it will first click down somewhere and then the rest of the time im scrolling only the cursor position is affected. so i guess i need a timer to detect when my scrollwheel becomes idle but then i need looping to happen and i dont want the clicking to be part of it. im just so confused and this seems so simple.... Confused
Back to top
View user's profile Send private message
[VxE]



Joined: 07 Oct 2006
Posts: 3254
Location: Simi Valley, CA

PostPosted: Tue Mar 16, 2010 2:49 am    Post subject: Reply with quote

This will do a 1-pixel click-drag on every WheelUp done in a new notepad window without releasing the left button between scrolls less than 1/2 a second apart. The left mouse button is released 1/2 second after the last scroll.
Code:
#IfWinactive, Untitled - Notepad

*WheelUp::
   If ( WheelExpiration > A_TickCount )
   {
      SetTimer, ReleaseLButton, -500
      WheelExpiration := A_TickCount + 500
      MouseMove, 0, -1, 0, R
   }
   Else
   {
      SetTimer, ReleaseLButton, -500
      WheelExpiration := A_TickCount + 500
      Click, Left Down
      MouseMove, 0, -1, 0, R
   }
Return

ReleaseLButton:
   Click, Left Up
Return

_________________
Ternary (a ? b : c) guide     TSV Table Manipulation Library
Post code inside [code][/code] tags!
Back to top
View user's profile Send private message
PooFox



Joined: 15 Mar 2010
Posts: 15

PostPosted: Fri Mar 19, 2010 10:47 pm    Post subject: Reply with quote

thanks for the help, i get the timer function better now, but i wasnt getting the results i wanted with this script. ive got something fairly close now, but now all i think i need is a way to apply some acceleration to the mousewheel so that i can move it a little more predictably with the mousewheel. right now its way too slow to be useful.

maybe i can figure it out if someone can point out how to determine how many mousewheel clicks have taken place in the last half second, maybe with a little toolbar or something? then i can just have a fast and a slow movement based on that. thats about all i need...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group