AutoHotkey Community

It is currently May 27th, 2012, 5:40 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: March 15th, 2010, 10:13 am 
Offline

Joined: March 15th, 2010, 9:51 am
Posts: 15
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.... :?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 16th, 2010, 3:49 am 
Offline
User avatar

Joined: October 7th, 2006, 8:45 am
Posts: 3330
Location: Simi Valley, CA
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!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2010, 11:47 pm 
Offline

Joined: March 15th, 2010, 9:51 am
Posts: 15
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...


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot], HotkeyStick, mrhobbeys, rbrtryn and 57 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group