AutoHotkey Community

It is currently May 26th, 2012, 5:33 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 32 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject:
PostPosted: March 26th, 2008, 1:28 am 
The Iron Savior wrote:
About returning the cursor to its original location. THIS script as it is presented here (v1.1) does not move the mouse back. I did have a version before posting that would try to keep the mouse in the same spot all the time and it worked well and it was even a feature that you could turn off and on. In the end, it didn't really add anything valuable and I didn't like the way it made my code look, so I just scrapped the whole idea.


Personally I consider it very valuable because scroll wheel turn in most CAD, image editing etc programs works as zoom (not as scroll) and it is cursor orientated so it will zoom in to the point under the cursor (not to the center of the window). At the moment cursor position is not constant and therefore zoom target position is moving away from the initial zoom focus point and we end up in a wrong location.

I experimented with BlockInput MouseMove but with no effort because I don't know if it is possible to read the mouse movement without moving the cursor itself? I have very little experience with autohotkey and in programming whatsoever so even this topic is over my head. Any help would be much appreciated. Thanks.


Report this post
Top
  
Reply with quote  
 Post subject: need help
PostPosted: April 9th, 2008, 9:42 am 
hey guys,
i need to know if it possible for a script to do the following:

scroll with the ball from my marble mouse, while the other mouse ( a normal usb one) remains "unaffected".

Thank you verry much.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 30th, 2008, 1:32 am 
This is the script i use to emulate mouse wheel scrolling with my 3m ergonomic mouse (no scroll wheel)

I've played with it recently and now it has some little glitches, so any feedback welcome.
I would also like to combbine it with "katmouse"/"hotmouse" functionality (e.g. scroll the window under the mouse cursor without losing focus)

But don't have the brains to do it ;)
If anyone could give tips that would be great:
the code for the hotmouse stuff is here but i can't seem to get it to combine: http://www.autohotkey.com/forum/topic6772.html

Code:
MouseWheelSpeed = 1
MouseWheelAccelerationSpeed = 8
MouseWheelMaxSpeed = 15

MouseRotationAngle = 0

Hotkey, MButton & LButton, ButtonWheelDown
Hotkey, MButton & RButton, ButtonWheelUp

ButtonWheelUp:
ButtonWheelDown:

If Button <> 0
{
    If Button <> %A_ThisHotkey%
    {
        MouseWheelCurrentAccelerationSpeed = 0
        MouseWheelCurrentSpeed = %MouseWheelSpeed%
    }
}
StringReplace, Button, A_ThisHotkey, *

ButtonWheelAccelerationStart:
If MouseWheelAccelerationSpeed >= 1
{
    If MouseWheelMaxSpeed > %MouseWheelCurrentSpeed%
    {
        Temp = 0.001
        Temp *= %MouseWheelAccelerationSpeed%
        MouseWheelCurrentAccelerationSpeed += %Temp%
        MouseWheelCurrentSpeed += %MouseWheelCurrentAccelerationSpeed%
    }
}
;MsgBox %Button%
If Button = MButton & RButton
    MouseClick, wheelup, , , ,%MouseWheelCurrentSpeed%,  D
else if Button = MButton & LButton
    MouseClick, wheeldown, , , ,%MouseWheelCurrentSpeed%, D

SetTimer, ButtonWheelAccelerationEnd, 100
return

ButtonWheelAccelerationEnd:
GetKeyState, kstate, LButton, P
if kstate = D
    Goto ButtonWheelAccelerationStart
GetKeyState, kstate, RButton, P
if kstate = D
    Goto ButtonWheelAccelerationStart

MouseWheelCurrentAccelerationSpeed = 0
MouseWheelCurrentSpeed = %MouseWheelSpeed%
Button = 0
return


Report this post
Top
  
Reply with quote  
PostPosted: December 28th, 2009, 4:42 am 
BbErSerkK wrote:
This is the script i use to emulate mouse wheel scrolling with my 3m ergonomic mouse (no scroll wheel)



This is GREAT. I also would appreciate if someone looks into this. Have same issue with 3M mouse... no scroll wheel. Comes handy.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 16th, 2010, 6:02 pm 
Hi

The script from BbErSerkK does not work for me. I am using Logitech marble trackball under Win7

Has anyone have better solution?

thanks


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 6th, 2010, 2:19 pm 
Offline

Joined: February 7th, 2010, 2:48 pm
Posts: 9
Location: Belgium
xordos wrote:
I just add more change, that I add a delay, so it will only put pointer back after about 100ms.

Hope this is better :)


Great script. Was looking for this for a long time, cause I have tablet PC and a two button pen, so scrolling was hard for me.

Just one small request...
Is it possible to launch the script by pressing xbutton1 (scroll button/combination), and closing the script by releasing it ?
I'm a "running processes maniac" :wink:

Thanks anyway.

___________________________________________________
TOSHIBA Portege M700, Intel Core2 DUO, T8100 @ 2.1GHz, 2,0GB RAM
MS Windows XP Tablet Edition SP3
EmergeDesktop, Samurize, StokeIt, DOpus, PDF Revu, AHK, MenuApp.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: March 18th, 2010, 1:11 am 
I have a logitech marble mouse and have being trying to use it with a Cad application, like Autocad.
The scripts that were posted, helped me using the zooming function, by pressing a thrid button (little left one).
However for using the pan function, a regular mouse with a wheel needs to press the middle button, and then move the mouse. With the posted script's i couldn't reply this situation, because if i press the thrid little button and use the ball it only zooms.
It is possible to replicate the panning function by pressing a fourth little button and moving the ball to enable the panning function in autocad?
Can anyone, please help me, as I have no experince in creating scripts for autohotkey??


Thanks, and keep up the great work!


Report this post
Top
  
Reply with quote  
PostPosted: March 30th, 2010, 12:47 pm 
Offline

Joined: August 17th, 2005, 12:07 am
Posts: 6
Tiago Valente wrote:
I have a logitech marble mouse and have being trying to use it with a Cad application, like Autocad.
The scripts that were posted, helped me using the zooming function, by pressing a thrid button (little left one).
However for using the pan function, a regular mouse with a wheel needs to press the middle button, and then move the mouse. With the posted script's i couldn't reply this situation, because if i press the thrid little button and use the ball it only zooms.
It is possible to replicate the panning function by pressing a fourth little button and moving the ball to enable the panning function in autocad?
Can anyone, please help me, as I have no experince in creating scripts for autohotkey??


Thanks, and keep up the great work!


Yeah, that's entirely possible. I assume that panning is done with a tilting mouse wheel when the wheel is tilted left or right? If that is the case, then I can have it track the side to side motion and create left and right tilt events as well.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 30th, 2010, 1:04 pm 
Offline

Joined: August 17th, 2005, 12:07 am
Posts: 6
vitor wrote:
Just one small request...
Is it possible to launch the script by pressing xbutton1 (scroll button/combination), and closing the script by releasing it ?
I'm a "running processes maniac" :wink:

If you're concerned about performance, you should know that it's much worse to constantly start and kill even such a tiny process like AHK. It's much better to leave it running. There's no shame in having many processes running at once, especially if they do what you want them to do.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: May 31st, 2010, 2:55 pm 
hi,

great thin,exactly what i was looking for for some time. i am using a wacom tablet and tried to use it in AutoCAD, but always got anoyed by the missing scrollwheelfunction...
thanks!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 1st, 2010, 6:47 pm 
Offline

Joined: June 1st, 2010, 6:40 pm
Posts: 2
Hi, thanks for this awsome script. I tried it for a day and works pretty good but made a similar script after a quick learn of the AutoHotkey syntax. I've added the possibility to scroll in both X and Y direction and also enabled the browser forward and backwards options as I was really missing those.

And one other thing that I've also added is so that the window where the mouse pointer currently are pointing to will gain focus upon clicking one of the designated keys.

Hope this will help someone ^^

Code:
;;
;; MarbleMagic 1.1
;; "Logitech Marble Mouse Optical" Configuration
;; Version: 1.1 (Jun 1, 2010)
;;
;; Created by Gawy, gawy.gawy@gmail.com

;;
;; Enables you to both scroll and use the back & forward
;; buttons for web browsing!
;;
;; Current configuration is:
;;       Left small button = Back (in browser)
;;      Left small button + right big = Forward (in browser) (Hold down the left small while pressing the right big)
;;      Right small button = Enable scrolling with the trackball (Right small has to be held down)
;;
;; I wrote this simple code for the Logitech Marble Mouse as
;; it doesn't support scrolling by default and because the
;; logitech software sucks for customization.
;;

;; //Configuration
   ;; //Display a tray icon or not
   ;#NoTrayIcon

   ;; // Enable/disable
   mm_EnableScrollX = y
   mm_EnableScrollY = y
   mm_EnableBrowserButtons = y
   mm_EnableFocusGain = y ;; // Enable/disable windows focusing
   
   ;; //Lower = slower scrolling, 1.2 is pretty smooth
   mm_ScrollAcceleration := 1.2
   
   ;; // Higher = slower scrolling (is dependent on the ScrollAcceleration!)
   mm_VerticalScrollMultiplier := 1
   
   ;; // Higher = slower scrolling (is dependent on the ScrollAcceleration!)
   mm_HorizontalScrollMultiplier := 20
   
   ;; // Higher = lower sense between X and Y scrolling, I would suggest moving it at 2 (will only take integers!)
   mm_XScrollDivider := 2
   
   ;; // Timer
   mm_TimerDelay := 10
   
   ;; // Triggers
   ;; //XButton2 = Right small, XButton1 = Left small, RButton = Right mouse button
   mm_ScrollTrigger = XButton2   
   mm_BrowseBackwardsTrigger = XButton1
   mm_BrowseForwardsTrigger = XButton1 & RButton
   
;; //End of configuration

#Persistent
   CoordMode, Mouse, Screen
   Hotkey, %mm_ScrollTrigger%, mm_ScrollTriggerDown
   HotKey, %mm_ScrollTrigger% Up, mm_ScrollTriggerUp
   
   if mm_EnableBrowserButtons = y
   {
      HotKey, %mm_BrowseForwardsTrigger%, mm_TriggerBrowseForward
      HotKey, %mm_BrowseBackwardsTrigger%, mm_TriggerBrowseBackward
   }
   
   mm_KeyDown = n
return


;;;;;;;;;;;;;;;;
;; SETTERS
;;;;;;;;;;;;;;;;

;; //The backward action in the browser
mm_TriggerBrowseBackward:
   if mm_EnableFocusGain = y
      GainFocus()
   
   SendInput, {Browser_Back}
return

;; //The forward action in the browser
mm_TriggerBrowseForward:
   if mm_EnableFocusGain = y
      GainFocus()
      
   SendInput, {Browser_Forward}
return

;; //Scroll is triggered, update timers
mm_ScrollTriggerDown:
   
   if mm_EnableFocusGain = y
      GainFocus()

   mm_HasMoved = n   
   mm_KeyDown = y
   MouseGetPos, temp_OldX, temp_OldY
   MouseGetPos, temp_OrigX, temp_OrigY
   SetTimer, mm_CheckForScrollEvent, %mm_TimerDelay%
return

;; //Scroll is untriggered (key up), check if it was a simple click or if we scrolled
mm_ScrollTriggerUp:
   ;; //Key is not down any more
   mm_KeyDown = n
   
   ;; //Turn of the scrollevent timer
   SetTimer, mm_CheckForScrollEvent, Off
   
   ;; //Send a middle-click if we did not scroll
   if mm_HasMoved = n
      MouseClick, Middle
return

;; //Used for checking scroll position
mm_CheckForScrollEvent:
   
   ;; //If there is no key down, we don't want to do anything
   if mm_KeyDown = n
   {
      SetTimer, mm_CheckForScrollEvent, Off
      return
   }   
   
   ;; //Get the current position
   MouseGetPos, mm_NewX, mm_NewY
   
   ;; //Calculate the difference in Y
   
   if mm_EnableScrollY = y
      mm_MoveDistanceY := (mm_NewY - temp_OldY)
   else
      mm_MoveDistanceY := 0
   
   if mm_EnableScrollX = y
      mm_MoveDistanceX := (mm_NewX - temp_OldX)
   else
      mm_MoveDistanceX := 0
      
   ;; //Have we moved or not?
   if (mm_MoveDistanceY == 0 && mm_MoveDistanceX == 0)
      return
   
   ;; //We have movement, so no middle click
   mm_HasMoved = y

   if Abs(mm_MoveDistanceY) > Abs(mm_MoveDistanceX) // mm_XScrollDivider
   {
      ;; //Check if we moved down or up
      if mm_MoveDistanceY > 0
      {
         ;; //Moved down, move the scroll the correct position
         Loop
         {
            if mm_MoveDistanceY <= 0
               break
               
            MouseClick, WheelDown
            mm_MoveDistanceY -= mm_ScrollAcceleration * mm_VerticalScrollMultiplier
         }
      }
      else if mm_MoveDistanceY < 0
      {
         ;; //We moved up
         Loop
         {
            ;; //Loop until the distance has changed to below zero
            if mm_MoveDistanceY >= 0
               break
               
            MouseClick, WheelUp
            mm_MoveDistanceY += mm_ScrollAcceleration * mm_VerticalScrollMultiplier
         }      
      }
   }
   else
   {
      ;; //Check if we moved right or left
      if mm_MoveDistanceX > 0
      {
         ;; //Moved right, move the scroll the correct position
         Loop
         {
            if mm_MoveDistanceX <= 0
               break
               
            MouseClick, WheelRight
            mm_MoveDistanceX -= mm_ScrollAcceleration * mm_HorizontalScrollMultiplier
         }
      }
      else if mm_MoveDistanceX < 0
      {
         ;; //We moved left
         Loop
         {
            ;; //Loop until the distance has changed to below zero
            if mm_MoveDistanceX >= 0
               break
               
            MouseClick, WheelLeft
            mm_MoveDistanceX += mm_ScrollAcceleration * mm_HorizontalScrollMultiplier
         }      
      }
   }

   ;; //Move and reset mouse position
   MouseMove, temp_OrigX, temp_OrigY
   MouseGetPos, temp_OldX, temp_OldY
   
return

;;;;;;;;;;;;;;;;
;; HELPERS
;;;;;;;;;;;;;;;;

;; //Sets focus for a window
GainFocus()
{
   ;; //Get mouse window
   MouseGetPos,,, MouseWin
   
   ;; //Make a dll call to ask for focus
    DllCall("SwitchToThisWindow", "UInt", MouseWin, "UInt", 1)
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 23rd, 2010, 9:35 pm 
Offline

Joined: September 23rd, 2010, 9:32 pm
Posts: 1
Thanks gawy, I was looking for something like this. I was wondering if you might know how to make it so it will work for horizontal scrolling in Excel? It tries to move but doesn't go. I am new at this so I have no clue what I'd need to do.

Thanks,


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 28th, 2010, 8:42 am 
Offline

Joined: June 1st, 2010, 6:40 pm
Posts: 2
valiskane wrote:
Thanks gawy, I was looking for something like this. I was wondering if you might know how to make it so it will work for horizontal scrolling in Excel? It tries to move but doesn't go. I am new at this so I have no clue what I'd need to do.

Thanks,


Havn't scripted in autohotkey since I made those changes so I really don't know. It seems that the script doesn't really focus on the object sometimes (or that it's not 100% emulated scrolling). I'll try to checkup on it when I got time if nobody else knows how.

Gawy


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: need help
PostPosted: January 4th, 2011, 1:17 pm 
gioni wrote:
hey guys,
i need to know if it possible for a script to do the following:

scroll with the ball from my marble mouse, while the other mouse ( a normal usb one) remains "unaffected".

Thank you verry much.
:arrow: :roll:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 15th, 2011, 12:13 am 
Thanks! Exactly what I needed for a Logitech Marble.
The scroll amount seems to be much bigger than usual, I seem to get almost an entire page each time. Adjusting the lines per scroll doesn't help, neither in the Windows (7) control panel, nor in SetPoint.
Any way to change the WheelUp / Down amount?


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 32 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Stigg and 9 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