yousif Posted January 3, 2008 Share Posted January 3, 2008 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 Link to comment Share on other sites More sharing options...
Zedna Posted January 3, 2008 Share Posted January 3, 2008 Try this: replace $sleep_time=10000 with Global $sleep_time=10000 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
yousif Posted January 3, 2008 Author Share Posted January 3, 2008 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. Link to comment Share on other sites More sharing options...
Zedna Posted January 3, 2008 Share Posted January 3, 2008 expandcollapse popupHotKeySet("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 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
yousif Posted January 4, 2008 Author Share Posted January 4, 2008 Thank you very much Zedna. The program is working like i wanted. My compliments for the implementation. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now