DragToScroll - updated

Post your working scripts, libraries and tools
guest3456
Posts: 2121
Joined: 09 Oct 2013, 10:31

DragToScroll - updated

17 Oct 2017, 11:12

DragToScroll allows you to scroll by dragging your mouse while you hold down a button. By default, you hold down right-click, and then drag your mouse, and you get the scrolling effect. It will not interfere with normal RButton behavior. Or you could use another mouse button or keyboard key as the 'hold' button.

This originally came from the old ahk forums. I've been using this script for years in conjunction with my Logitech Trackman Marble Mouse, since this trackball has no scroll wheel. The script works well. I had made some changes and updates to the script long ago, but I just finally cleaned it up and put it on github.

Some changes:

- removed the phone-home web update checker from the original
- fixed for unicode AHK_L
- added option to KeepCursorStationary
- added nicer replacement cursor
- fixed gui stuff


Get it here:

https://github.com/mmikeww/DragToScroll

=)
Last edited by guest3456 on 16 Dec 2017, 12:50, edited 2 times in total.

Helgef
Posts: 2600
Joined: 17 Jul 2016, 01:02
Contact:

Re: DragToScroll - updated

18 Oct 2017, 06:31

Hello guest3456 :wave:
Very nice one, thanks for sharing :thumbup:
It seems to work very well, I'd say it has good value even if you have a scroll wheel.

Cheers.
guest3456
Posts: 2121
Joined: 09 Oct 2013, 10:31

Re: DragToScroll - updated

19 Oct 2017, 11:22

Thanks Helgef

User avatar
jeeswg
Posts: 3329
Joined: 19 Dec 2016, 01:58
Location: UK

Re: DragToScroll - updated

05 Dec 2017, 01:23

- This is nice, thanks.
- I find it works well for vertical or horizontal scrolling, although if you try to do both at the same time, in a text editor, with no images, it's hard to follow what position you are at.
- Great solution for one key to do both vertical and horizontal scrolling.
- Works well with Internet Explorer, it even works well with Notepad.
- Also, the icon looks very cool.
fenchai
Posts: 155
Joined: 28 Mar 2016, 07:57

Re: DragToScroll - updated

09 Dec 2017, 10:30

Hi!

Nice job there!

I have been using the old one for a month now, it is so helpful even if you have the scrollwheel...

I did try your new version, I that you are able to change the icon is very helpful! but can I use a .png as the icon? because somehow every .ico that I use gets minimized so much and it just doesn't look good at all...

Also not sure why but this version is very laggy... I will see what the old version's settings were...

thanks!
guest3456
Posts: 2121
Joined: 09 Oct 2013, 10:31

Re: DragToScroll - updated

11 Dec 2017, 15:39

fenchai wrote:I did try your new version, I that you are able to change the icon is very helpful! but can I use a .png as the icon? because somehow every .ico that I use gets minimized so much and it just doesn't look good at all...

not sure, all I'm doing is creating a GUI and putting the ico as a picture on there, maybe you could substitute a png

fenchai wrote:Also not sure why but this version is very laggy... I will see what the old version's settings were...

let me know if you find better settings

fenchai
Posts: 155
Joined: 28 Mar 2016, 07:57

Re: DragToScroll - updated

12 Dec 2017, 18:02

guest3456 wrote:
fenchai wrote:I did try your new version, I that you are able to change the icon is very helpful! but can I use a .png as the icon? because somehow every .ico that I use gets minimized so much and it just doesn't look good at all...

not sure, all I'm doing is creating a GUI and putting the ico as a picture on there, maybe you could substitute a png

fenchai wrote:Also not sure why but this version is very laggy... I will see what the old version's settings were...

let me know if you find better settings


I gave up on changing the settings... I changed all settings to the old version and your version still lagged. Scrolling is so much smoother on the old version but I like how customizable your new version is...

I guess we can't have good thing from both worlds...
guest3456
Posts: 2121
Joined: 09 Oct 2013, 10:31

Re: DragToScroll - updated

12 Dec 2017, 19:27

fenchai wrote:I gave up on changing the settings... I changed all settings to the old version and your version still lagged. Scrolling is so much smoother on the old version but I like how customizable your new version is...

I guess we can't have good thing from both worlds...


i'd like to figure out why its lagging for you if possible

i'm not seeing any lag at all

what if you choose the exact same settings, with the same old icon, does it still lag? what version of Windows are you on?

User avatar
Drugwash
Posts: 406
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania
Contact:

Re: DragToScroll - updated

15 Dec 2017, 05:39

Without running this script I tried right-click + drag down in my QtWeb browser to see what happens - it closed last tab. Did it again, closed another tab. Apparently QtWeb uses mouse gestures and this script will interfere with that. Not that I use gestures or anything - just saying, in case anyone stumbles into such issue.

However, QtWeb has a very fine built-in scrolling routine, available on middle-click. Directions are shown using standard cursors, speed is variable depending on the distance between original middle-click point and current cursor position. All directions are available, including NW, NE, SE, SW.
Now that'd be nice to see in an AHK script. ;)
fenchai
Posts: 155
Joined: 28 Mar 2016, 07:57

Re: DragToScroll - updated

15 Dec 2017, 18:16

guest3456 wrote:
fenchai wrote:I gave up on changing the settings... I changed all settings to the old version and your version still lagged. Scrolling is so much smoother on the old version but I like how customizable your new version is...

I guess we can't have good thing from both worlds...


i'd like to figure out why its lagging for you if possible

i'm not seeing any lag at all

what if you choose the exact same settings, with the same old icon, does it still lag? what version of Windows are you on?


check this out, https://www.youtube.com/watch?v=-kiIcHI ... e=youtu.be

I am on windows 10 btw
guest3456
Posts: 2121
Joined: 09 Oct 2013, 10:31

Re: DragToScroll - updated

15 Dec 2017, 20:03

fenchai wrote:check this out, https://www.youtube.com/watch?v=-kiIcHI ... e=youtu.be

I am on windows 10 btw


yes i see, it looks slower, i dont know if i would say laggy. but you are using different settings still. i wanted you to try with the new script but with the old settings.

so use the old cursor style ("cursorHand"), and turn off the 'keep cursor stationary' setting

and check the top of each of the scripts for the other settings too. it could be the 'scroll momentum' or it could be the 'scroll method'

here are some settings that i changed:
https://github.com/mmikeww/DragToScroll ... e3b2a7e1f1

but you should check your old script and the new script and make sure the settings are the same

fenchai
Posts: 155
Joined: 28 Mar 2016, 07:57

Re: DragToScroll - updated

15 Dec 2017, 20:28

guest3456 wrote:
fenchai wrote:check this out, https://www.youtube.com/watch?v=-kiIcHI ... e=youtu.be

I am on windows 10 btw


yes i see, it looks slower, i dont know if i would say laggy. but you are using different settings still. i wanted you to try with the new script but with the old settings.

so use the old cursor style ("cursorHand"), and turn off the 'keep cursor stationary' setting

and check the top of each of the scripts for the other settings too. it could be the 'scroll momentum' or it could be the 'scroll method'

here are some settings that i changed:
https://github.com/mmikeww/DragToScroll ... e3b2a7e1f1

but you should check your old script and the new script and make sure the settings are the same


That was useful! I changed the script to all the red lines (old code) and it works well! but something stopped working...

Setting("KeepCursorStationary", false)

As you can see, I have it on false and it still stays in the same position... changed to true/false, but still stays as stationary

here is the code

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

guest3456
Posts: 2121
Joined: 09 Oct 2013, 10:31

Re: DragToScroll - updated

16 Dec 2017, 02:25

fenchai wrote:
guest3456 wrote:so use the old cursor style ("cursorHand"), and turn off the 'keep cursor stationary' setting

That was useful! I changed the script to all the red lines (old code) and it works well! but something stopped working...

Setting("KeepCursorStationary", false)

As you can see, I have it on false and it still stays in the same position... changed to true/false, but still stays as stationary


you still didn't change back to the old cursor style:

Code: [Select all] [Download] GeSHi © Codebox Plus

; If the above ChangeMouseCursor setting is true, this determines what cursor style
; Choose either:
; "cursorHand" - the original DragToScroll hand icon
; "cursorScrollPointer" - the scrollbar and pointer icon (SYNTPRES.ico)
; this cursor will mostly stay stationary but you should
; still have the KeepCursorStationary set to 'true'
Setting("ChangedCursorStyle", "cursorScrollPointer")

fenchai
Posts: 155
Joined: 28 Mar 2016, 07:57

Re: DragToScroll - updated

16 Dec 2017, 06:37

guest3456 wrote:
fenchai wrote:
guest3456 wrote:so use the old cursor style ("cursorHand"), and turn off the 'keep cursor stationary' setting

That was useful! I changed the script to all the red lines (old code) and it works well! but something stopped working...

Setting("KeepCursorStationary", false)

As you can see, I have it on false and it still stays in the same position... changed to true/false, but still stays as stationary


you still didn't change back to the old cursor style:

Code: [Select all] [Download] GeSHi © Codebox Plus

; If the above ChangeMouseCursor setting is true, this determines what cursor style
; Choose either:
; "cursorHand" - the original DragToScroll hand icon
; "cursorScrollPointer" - the scrollbar and pointer icon (SYNTPRES.ico)
; this cursor will mostly stay stationary but you should
; still have the KeepCursorStationary set to 'true'
Setting("ChangedCursorStyle", "cursorScrollPointer")


I did, it seemed to not affect the speed of the script so I left it at cursorScrollPointer. Oh So New cursor is always stationary? damn I liked it following my drag... Is there anyway to change the old icon then?
guest3456
Posts: 2121
Joined: 09 Oct 2013, 10:31

Re: DragToScroll - updated

16 Dec 2017, 12:38

fenchai wrote:I did, it seemed to not affect the speed of the script so I left it at cursorScrollPointer.

ahhh ok

fenchai wrote:Oh So New cursor is always stationary? damn I liked it following my drag...

well if you look at the code, the new cursor is really just an alwaysontop gui with a picture. i didn't want it to move, so i didn't try to implement that. but since you asked, i just added that ability now. :) either download again or just add these two lines so you dont have to change all your settings:
https://github.com/mmikeww/DragToScroll ... 9bba485183

fenchai wrote:Is there anyway to change the old icon then?

if you want to change the old hand icon, you'd need have some icon files and convert them into hex code. if you look at the code, that was what was originally done. the icons are really stored as hex inside the script itself. and then the hex code is converted back into an icon, and then the system icons are temporarily replaced. you can find the relevant section of the code here:
https://github.com/mmikeww/DragToScroll ... .ahk#L1424

if you decide to do that, please share, and then i can add some other cursor options into the script

guest3456
Posts: 2121
Joined: 09 Oct 2013, 10:31

Re: DragToScroll - updated

16 Dec 2017, 12:49

Drugwash wrote:Without running this script I tried right-click + drag down in my QtWeb browser to see what happens - it closed last tab. Did it again, closed another tab. Apparently QtWeb uses mouse gestures and this script will interfere with that. Not that I use gestures or anything - just saying, in case anyone stumbles into such issue.

you don't have to use RButton with this script, you could use another mouse key, or even a keyboard key if you wanted:
https://github.com/mmikeww/DragToScroll ... ll.ahk#L35

Drugwash wrote:However, QtWeb has a very fine built-in scrolling routine, available on middle-click. Directions are shown using standard cursors, speed is variable depending on the distance between original middle-click point and current cursor position. All directions are available, including NW, NE, SE, SW.
Now that'd be nice to see in an AHK script. ;)

unless i'm misunderstanding, thats exactly what this DragToScroll script does

User avatar
Drugwash
Posts: 406
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania
Contact:

Re: DragToScroll - updated

16 Dec 2017, 13:18

Well, it's good that settings can be changed (in regard to button/key to hold down), I just tried to draw attention on the default implementation, should anyone find script's behavior faulty in conjunction with QtWeb and/or any other application that uses that particular mouse gesture.

[EDIT] I just tested the script and it cannot override QtWeb's default behavior, it briefly shows the drag icon an then bails out, leaving the browser to close the current tab instead of scrolling on right-click + drag down. Please try to test to confirm this behavior: QtWeb homepage.
[/EDIT]

QtWeb doesn't require a key/button to be held down in order to scroll - it's a "press once to get into scroll mode, press again to exit scroll mode". Fairly similar but not quite the same. Maybe this script could be improved to handle both scroll modes: on demand (with key/button down) and continuous (toggle scroll mode).
Last edited by Drugwash on 16 Dec 2017, 13:36, edited 1 time in total.
User avatar
boiler
Posts: 2120
Joined: 21 Dec 2014, 02:44

Re: DragToScroll - updated

16 Dec 2017, 13:24

guest3456 wrote:unless i'm misunderstanding, thats exactly what this DragToScroll script does

From what I saw, DragToScroll doesn't continuously scroll with speed based on distance between original middle-click point and current cursor position (like the standard middle-button click works with many programs, such as Chrome). DragToScroll requires you to continue to drag the mouse to keep scrolling (with a standard mouse, requiring you to pick it up and put it back down), correct? If it could be made to work as Drugwash described, it would fit better for how I would like to use it.

If DragToScroll is capable of this, I guess I couldn't figure out how to configure to behave like that.

Edit: After reading Drugwash's latest post, I guess there is a mode that I didn't implement that would have it work like that. I'll check it out.

Edit 2: Revisiting the readme file and the configuration settings, I don't see that there is a mode other than dragging. Am I wrong?
guest3456
Posts: 2121
Joined: 09 Oct 2013, 10:31

Re: DragToScroll - updated

16 Dec 2017, 13:36

boiler wrote:
guest3456 wrote:unless i'm misunderstanding, thats exactly what this DragToScroll script does

From what I saw, DragToScroll doesn't continuously scroll with speed based on distance between original middle-click point and current cursor position (like the standard middle-button click works with many programs, such as Chrome). DragToScroll requires you to continue to drag the mouse to keep scrolling (with a standard mouse, requiring you to pick it up and put it back down), correct? If it could be made to work as Drugwash described, it would fit better for how I would like to use it.

If DragToScroll is capable of this, I guess I couldn't figure out how to configure to behave like that.

Edit: After reading Drugwash's latest post, I guess there is a mode that I didn't implement that would have it work like that. I'll check it out.

Edit 2: Revisiting the readme file and the configuration settings, I don't see that there is a mode other than dragging. Am I wrong?


ahhhh yes i see... i just plugged in my normal mouse to test this on Chrome. hrmmm, yeah i don't believe there is any setting to replicate this behavior. i wonder how difficult it is to add

guest3456
Posts: 2121
Joined: 09 Oct 2013, 10:31

Re: DragToScroll - updated

16 Dec 2017, 13:43

Drugwash wrote:Well, it's good that settings can be changed (in regard to button/key to hold down), I just tried to draw attention on the default implementation, should anyone find script's behavior faulty in conjunction with QtWeb and/or any other application that uses that particular mouse gesture.

[EDIT] I just tested the script and it cannot override QtWeb's default behavior, it briefly shows the drag icon an then bails out, leaving the browser to close the current tab instead of scrolling on right-click + drag down. Please try to test to confirm this behavior: QtWeb homepage.
[/EDIT]

if QtWeb has built-in mouse gestures, then yes I wouldn't expect any external program (including AHK) to be able to override it.

Drugwash wrote:QtWeb doesn't require a key/button to be held down in order to scroll - it's a "press once to get into scroll mode, press again to exit scroll mode". Fairly similar but not quite the same. Maybe this script could be improved to handle both scroll modes: on demand (with key/button down) and continuous (toggle scroll mode).

good to know. i just tested it on Chrome as boiler suggested, and firefox, and both of those allow a middle click down and release, and then move the cursor to scroll, and then another middle click to cancel.

that feature does seem nice, but how would that work in conjunction with a normal right click? that would be an issue


Return to “Scripts and Functions”

Who is online

Users browsing this forum: gregster and 19 guests