Sign in to follow this  
Followers 0
romulous

Help with Auto-Scroll Script

10 posts in this topic

#1 ·  Posted (edited)

Hi everyone,

I've come up with the following script:

HotKeySet ( "{F10}", "_begin" ); Hotkey to begin script is F10
HotKeySet ( "{F11}", "_pause" ); Hotkey to pause script is F11 
HotKeySet ( "{F12}", "_exit" ); Hotkey to exit script is F12

Global $Paused

Func _begin(); Begins script
    While 1; This will make the script loop
        MouseWheel ( "down", 1 ); Roll mouse wheeel once
    WEnd
EndFunc

Func _exit(); Exits script
    Exit; Exits
EndFunc

Func _pause(); Pauses script
    $Paused = NOT $Paused
    While $Paused
        sleep ( 100 )
        ToolTip ( 'Script is "Paused"', 0, 0 )
    WEnd
    ToolTip ( "" )
EndFunc

Basically, it is meant to be a mouse auto-scroll script for long, spam filled groups in Forte Agent newsreader (scrolling through a newsgroup with a lot of messages in it is painful in Agent, it's slow and with no keys to skip sections there is a chance all the mousing will give you RSI) - basically what I want is to roll the mouse wheel once, and have the window underneath it continually scroll until I tell it to stop. I couldn't find any scripts for this in the examples forum, and I could find no other program through google that could do the same thing. The script is not 100% complete, and I need some help with a few things:

1. Obviously, as soon as you run the script, it exits. I know why (it's because all the code is inside functions, and AutoIt thus skips everything and exits) - what is the best way to keep the script running when it is started? The reason why I put the 'begin' code in a function was i. readability, ii. I only want the scrip to run when a certain window is active (see #3) - at the moment, the script runs on everything but I figured putting that code inside a function was the best way to begin.

2. I've assigned the hotkeys temporarily to F10, F11 and F12 - is it possible to assign the 'begin' hotkey to the mouse scroll wheel?

3. I would prefer the script to only activate when Forte Agent is the foreground window - how do I tell AutoIt to only activate if Agent is the active window? Process name is agent.exe, window title is "Agent - {insert name of currently opened newsgroup here}"

That's about it for the moment I think.

Thanks,

CM

Edited by romulous

Share this post


Link to post
Share on other sites



...what is the best way to keep the script running when it is started?...

While 1
    Sleep(99)
WEndoÝ÷ Ú«¨µéÚoÝ÷ ÚÚò¶¬jëh×6HotKeySet("{F10}", "_begin"); Hotkey to begin script is F10
HotKeySet("{F11}", "_pause"); Hotkey to pause script is F11
HotKeySet("{F12}", "_exit"); Hotkey to exit script is F12
Global $Paused

While 1
    Sleep(99)
WEnd

Func _begin(); Begins script
    If WinActive("Agent -") Then
        While 1; This will make the script loop
            MouseWheel("down", 1); Roll mouse wheeel once
        WEnd
    EndIf
EndFunc   ;==>_begin

Func _exit(); Exits script
    Exit; Exits
EndFunc   ;==>_exit

Func _pause(); Pauses script
    $Paused = Not $Paused
    While $Paused
        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    WEnd
    ToolTip("")
EndFunc   ;==>_pause

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

or maybe this

HotKeySet("{F10}", "_begin"); Hotkey to begin script is F10
HotKeySet("{F11}", "_pause"); Hotkey to pause script is F11
HotKeySet("{F12}", "_exit"); Hotkey to exit script is F12
Global $Paused

While 1
    Sleep(99)
WEnd

Func _begin(); Begins script
    While 1; This will make the script loop
        If WinActive("Agent -") Then
            MouseWheel("down", 1); Roll mouse wheeel once
        Else
            ExitLoop
        EndIf
    WEnd
EndFunc   ;==>_begin

Func _exit(); Exits script
    Exit; Exits
EndFunc   ;==>_exit

Func _pause(); Pauses script
    $Paused = Not $Paused
    While $Paused
        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    WEnd
    ToolTip("")
EndFunc   ;==>_pause


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Hi! Correct me if I'm wrong, but I always thought that all scroll mouse drivers supported

"AutoScroll" --- Please try CLICKING your mouse wheel, and see what happens,

I think that could be just what you want.

(I get a circular icon with up/down triangles, and in this state moving my mouse up/down

screen scrolls up/down with speed proportional to mouse position)

whim

Share this post


Link to post
Share on other sites

......is it possible to assign the 'begin' hotkey to the mouse scroll wheel?...

See this post for the files needed...

http://www.autoitscript.com/forum/index.ph...st&p=458286

...and the first post in that thread points you to other threads that you may need.


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

...

"AutoScroll" --- Please try CLICKING your mouse wheel, and see what happens,

I think that could be just what you want...

...but not apps make use of it. I use 3 apps at work that ignore it. I have no idea if the reader that the OP mentioned ignores it and I meant to mention exactly what you did - but senility won out.

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

@herewasplato

Playing around with it, I noticed that too.

For instance, it works on the AutoIt Help main screen,

but not on the index. Thought I should post it anyway

though, I personally love scripting, but only if it serves

a usefull purpose ...

Share this post


Link to post
Share on other sites

Thanks everyone, I will try out your replies. Yes, I have tried auto-scroll with my mouse natively, but Agent does not support it. So my only options (scrolling through a group really is painful in Agent) are either a script or else a pre-written program by someone else.

Regards,

CM

Share this post


Link to post
Share on other sites

Hi again,

One further question - there seems to be two versions of hook.dll on this board. One by LarryDalooza in this topic: http://www.autoitscript.com/forum/index.ph...mp;#entry458286 (link posted by herewasplato above) and the other by tobamai in this topic: http://www.autoitscript.com/forum/index.ph...mp;#entry402567 (link referred to from the topic that herewasplato posted to above - actually posted by LarryDalooza and then crossed out)

Downloaded both, both are binary different. Which is the correct version to use?

Thanks.

Share this post


Link to post
Share on other sites

I'm not sure - I've not used any version - perhaps other know.


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0