buzz44 Posted April 5, 2005 Share Posted April 5, 2005 (edited) this is my code expandcollapse popup$hm = 1 While 1 If NOT ProcessExists("wmplayer.exe") Then $MousePos_1 = MouseGetPos() Sleep(5) $MousePos_2 = MouseGetPos() If $MousePos_2[0] = $MousePos_1[0] Or $MousePos_2[1] = $MousePos_1[1] Then $begin = TimerInit() While 1 $dif = TimerDiff($begin) If $hm = 1 Then If $dif > 5000 AND $dif < 6000 Then Run('C:\Program Files\Windows Media Player\wmplayer.exe "C:\Documents and Settings\burrup.BURRUP2ND\Desktop\test.wav"') WinWaitActive ("Windows Media Player") Sleep(2000) Send("!{ENTER}") Exitloop endIf test2() EndIf If $hm = 0 Then exitloop EndIf Wend EndIf Else test3() EndIf Wend Func test2() $MousePos_7 = MouseGetPos() Sleep(5) $MousePos_8 = MouseGetPos() If $MousePos_8[0] <> $MousePos_7[0] Or $MousePos_8[1] <> $MousePos_7[1] Then $hm = 0 EndIf EndFunc Func test3() $MousePos_3 = MouseGetPos() Sleep(5) $MousePos_4 = MouseGetPos() If $MousePos_4[0] <> $MousePos_3[0] Or $MousePos_4[1] <> $MousePos_3[1] Then ProcessClose("wmplayer.exe") $hm = 1 EndIf EndFunc For testing purposes its set to 5 seconds. When you cease to move the mouse it opens media player and puts it to full screen. When you move the mouse again it closes it and the whole process starts again. I done this because all the screen savers I have look crappy, but WMP visualisations look good. In the final version, when you dont move your mouse for 10 minutes it will start, and because its at full screen you have a new screen saver! Im sure my syntax is correct, but I'm pretty sure the problem is the Timer. After the script has run through once the timer just keeps going. I need to be able to set it back to "0" or the script wont work at all There are ways of getting around this but it will be messy, does anyone know of a way to overcome this problem? Thanks (Sorry for the messy code) Edited April 5, 2005 by burrup qq Link to comment Share on other sites More sharing options...
CyberSlug Posted April 5, 2005 Share Posted April 5, 2005 Just call $begin = TimerInit() again to reset the timer. Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
buzz44 Posted April 5, 2005 Author Share Posted April 5, 2005 (edited) Yeah it does, I guess that isnt the problem, after some further testing I now know the following.If I started the script, and move the mouse around before 5 seconds have passed then stop the mouse moving, the time only = something like .03xxxxxx. What is supposed to have is every time the mouse stops moving the timer starts, When you move the mouse nothing happens, and when you stop the mouse again the timer should start again by calling $begin = TimerInt(). To test this I added a HotkeySet("{ESC}","Exit") Displaying a msg box containing the variable $dif, each time I conduct these test it always =< .05xxxxxxxSee code below and test for yourlsef please.expandcollapse popup$hm = 1 While 1 If NOT ProcessExists("wmplayer.exe") Then $MousePos_1 = MouseGetPos() Sleep(5) $MousePos_2 = MouseGetPos() If $MousePos_2[0] = $MousePos_1[0] Or $MousePos_2[1] = $MousePos_1[1] Then $begin = TimerInit() While 1 $dif = TimerDiff($begin) TrayTip ( "", $dif,10) If $hm = 1 Then If $dif > 5000 AND $dif < 5500 Then Run('C:\Program Files\Windows Media Player\wmplayer.exe "C:\Documents and Settings\burrup.BURRUP2ND\Desktop\test.wav"') WinWaitActive ("Windows Media Player") Sleep(2000) Send("!{ENTER}") Exitloop endIf test2() EndIf If $hm = 0 Then exitloop EndIf Wend EndIf Else test3() EndIf Wend Func test2() $MousePos_7 = MouseGetPos() Sleep(5) $MousePos_8 = MouseGetPos() If $MousePos_8[0] <> $MousePos_7[0] Or $MousePos_8[1] <> $MousePos_7[1] Then $hm = 0 EndIf EndFunc Func test3() $MousePos_3 = MouseGetPos() Sleep(5) $MousePos_4 = MouseGetPos() If $MousePos_4[0] <> $MousePos_3[0] Or $MousePos_4[1] <> $MousePos_3[1] Then ProcessClose("wmplayer.exe") $hm = 1 EndIf EndFuncRun the script and see what I mean. Edited April 5, 2005 by burrup qq Link to comment Share on other sites More sharing options...
buzz44 Posted April 5, 2005 Author Share Posted April 5, 2005 Ok, I got the timer to reset back to 0 everytime you move the mouse but now it wont open WMP. expandcollapse popup$hm = 1 $aa = 1 While 1 If NOT ProcessExists("wmplayer.exe") Then $MousePos_1 = MouseGetPos() Sleep(5) $MousePos_2 = MouseGetPos() If $MousePos_2[0] = $MousePos_1[0] Or $MousePos_2[1] = $MousePos_1[1] Then If $aa = 1 Then $begin = TimerInit() $aa = 0 EndIf While 1 $dif = TimerDiff($begin) TrayTip("",$dif,0) If $hm = 1 Then If $dif > 5000 AND $dif < 6000 Then Run('C:\Program Files\Windows Media Player\wmplayer.exe "C:\Documents and Settings\burrup.BURRUP2ND\Desktop\test.wav"') WinWaitActive ("Windows Media Player") Sleep(2000) Send("!{ENTER}") Exitloop endIf test2() EndIf If $hm = 0 Then exitloop EndIf Wend Else $aa = 1 EndIf Else test3() EndIf Wend Func test2() $MousePos_7 = MouseGetPos() Sleep(5) $MousePos_8 = MouseGetPos() If $MousePos_8[0] <> $MousePos_7[0] Or $MousePos_8[1] <> $MousePos_7[1] Then $hm = 0 EndIf EndFunc Func test3() $MousePos_3 = MouseGetPos() Sleep(5) $MousePos_4 = MouseGetPos() If $MousePos_4[0] <> $MousePos_3[0] Or $MousePos_4[1] <> $MousePos_3[1] Then ProcessClose("wmplayer.exe") $hm = 1 EndIf EndFunc When the number in the traytip reachs > 5000 WMP is supposed to start but it doesnt =( qq Link to comment Share on other sites More sharing options...
buzz44 Posted April 5, 2005 Author Share Posted April 5, 2005 (edited) Dont worry everyone, I have now finished and fixed it. expandcollapse popup#NoTrayIcon $NWMP = 1 $Time = 1 While 1 If Not ProcessExists("wmplayer.exe") Then $MousePos_1 = MouseGetPos() Sleep(5) $MousePos_2 = MouseGetPos() If $MousePos_2[0] = $MousePos_1[0] Or $MousePos_2[1] = $MousePos_1[1] Then $NWMP = 1 If $Time = 1 Then $Begin = TimerInit() $Time = 0 EndIf While 1 $Dif = TimerDiff($Begin) If $NWMP = 1 Then If $Dif > 600000 Then Run('C:\Program Files\Windows Media Player\wmplayer.exe "C:\Documents and Settings\burrup.BURRUP2ND\Desktop\test.wav"') WinWaitActive("Windows Media Player") Sleep(2000) Send("!{ENTER}") ExitLoop EndIf _WMP() EndIf If $NWMP = 0 Then ExitLoop EndIf WEnd Else $Time = 1 EndIf Else _NWMP() EndIf WEnd Func _WMP() $MousePos_3 = MouseGetPos() Sleep(5) $MousePos_4 = MouseGetPos() If $MousePos_4[0] <> $MousePos_3[0] Or $MousePos_4[1] <> $MousePos_3[1] Then $NWMP = 0 EndIf EndFunc Func _NWMP() $MousePos_3 = MouseGetPos() Sleep(5) $MousePos_4 = MouseGetPos() If $MousePos_4[0] <> $MousePos_3[0] Or $MousePos_4[1] <> $MousePos_3[1] Then ProcessClose("wmplayer.exe") $NWMP = 1 $Begin = TimerInit() EndIf EndFunc Its a new screen saver =). The file test.wav is a blank 60 sec file, I have it set to repeat, so nothing plays but you still get the visualisation, and the Sleep(600000) is equivilant to 10 mins. Edited April 5, 2005 by burrup qq 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