Sign in to follow this  
Followers 0
yousif

scroll for a program

5 posts in this topic

Hi all. I ve made this small program to scroll through my document during reading it. It will spare me a lot of mouse clicks. The only problem is that i cant get it out from sleep can anyone help me with this please? Thanks in advance.

HotKeySet("1", "slow_down")
HotKeySet("2", "speed_up")


sleep(4000)
$original_window = WinGetTitle("", "")
$new_window=$original_window
$sleep_time=10000
while $new_window=$original_window 
    send("{DOWN}",0)
    sleep($sleep_time)
    $new_window = WinGetTitle("", "")
WEnd

Func slow_down()
;MsgBox(0,"test",$sleep_time)
    $sleep_time=$sleep_time/2
    TrayTip("Speed", $sleep_time, 5, 1)
    
EndFunc


Func speed_up()
;MsgBox(0,"test",$sleep_time)
    $sleep_time=$sleep_time*2
    TrayTip("Speed", $sleep_time, 5, 1)
EndFunc

Share this post


Link to post
Share on other sites



Try this:

replace

$sleep_time=10000

with

Global $sleep_time=10000
Hi Zedna. Thank you very much for your fast reply. Actually i realize now that i didnt describe the problem well. The problem at the moment is when i press 1 which corresponds to decreasing the sleep time, it first finish the original sleep command which is 10 sec. What i want to do is when i redefine the sleep time it sleeps the new time and not the old time. The code in the current form is working fine but this problem is quite annoying.

Share this post


Link to post
Share on other sites

HotKeySet("1", "slow_down")
HotKeySet("2", "speed_up")

Global $IsBreak = 0

sleep(4000)
$original_window = WinGetTitle("", "")
$new_window=$original_window
$sleep_time=10000
while $new_window=$original_window 
    send("{DOWN}",0)
    MySleep($sleep_time)
    $new_window = WinGetTitle("", "")
WEnd

Func slow_down()
;MsgBox(0,"test",$sleep_time)
    $sleep_time=$sleep_time/2
    TrayTip("Speed", $sleep_time, 5, 1)
    $IsBreak = 1
EndFunc


Func speed_up()
;MsgBox(0,"test",$sleep_time)
    $sleep_time=$sleep_time*2
    TrayTip("Speed", $sleep_time, 5, 1)
    $IsBreak = 1
EndFunc

Func MySleep($msec)
    For $i = 1 To $msec/100
        Sleep(100)
        If $IsBreak = 1 Then
            $IsBreak = 0
            Return
        EndIf
    Next
EndFunc

Share this post


Link to post
Share on other sites

Thank you very much Zedna. The program is working like i wanted. My compliments for the implementation.

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