Jump to content

1) How to keep this in position we move it to?


Recommended Posts

1) I've come a long way to modifying a script to my liking by looking at the code of various examples in the forums for countdown timers. Mine is as small as I need. I've played around with the settings and have everything pretty much as I need it expect for the position. The code wizard allowed me to choose to make the window movable, but I suspect that the timer refreshing after each second is why it keeps popping back to the default position of the center of the screen after each second passes. Can this be fixed so that wherever we move countdown timer to, it will stay put there?

2) Also, would it be possible to add a simple computer beep so that the seconds also count down as metronome-like beeps?

#NoTrayIcon; AutoIt's icon doesn't show in systray
HotKeySet("{ESC}", "Terminate");  calls the Function to terminate (see below) upon pressing the ESC key.


$iTimer = TimerInit()
$iT = 10
While 1
    SplashTextOn("Countdown:   " & $iT, "", 110, 0,"-1","-1",16,"","","")  ;  Make sure a "SplashOff()" is at end to turn off the splash screen.
    While TimerDiff($iTimer) <= 1000
        Sleep(10)
    WEnd
    $iT -= 1
    If $iT < 0 Then ExitLoop
    $iTimer = TimerInit()
WEnd

; ===== Sound: ====
;SoundPlay(@ScriptDir & "\alarm.wav")
Beep(750, 100)
Sleep(50)
Beep(700, 50)
Sleep(50)
Beep(750, 100)
Sleep(50)
Beep(700, 50)
Sleep(50)
; =================

SplashOff(); turns off SplashTextOn(...) above.
Sleep(3000)

Func Terminate();  called by "HotKeySet" above.
    Exit 0
EndFunc

Thank you. Much appreciated. :)

Edited by Diana (Cda)
Link to comment
Share on other sites

$iTimer = TimerInit()
$iT = 10
$splash = SplashTextOn("", "", 110, 0,"-1","-1",16,"","","")   ;  Make sure a "SplashOff()" is at end to turn off the splash screen.

While 1
    ControlSetText("","",$splash,"Countdown:   " & $iT)
    While TimerDiff($iTimer) <= 1000
        Sleep(10)
    WEnd
    $iT -= 1
    If $iT < 0 Then ExitLoop
    $iTimer = TimerInit()
WEndoÝ÷ ÚÚºÚ"µÍÌÍÜÜÚHÜÚ^Û   ][ÝÉ][ÝË    ][ÝÉ][ÝËLL  ][ÝËLI][ÝË  ][ÝËLI][ÝËM ][ÝÉ][ÝË    ][ÝÉ][ÝË    ][ÝÉ][ÝÊHÈXZÙHÝHH    ][ÝÔÜÚÙ
I][ÝÈÈ][ÈÙHÜÚØÜY[Ü    ÌÍÚUHLÈÝHBPÛÛÛÙ]^
    ][ÝÉ][ÝË    ][ÝÉ][ÝË    ÌÍÜÜÚ  ][ÝÐÛÝ[ÝÛ ][ÝÈ  [È ÌÍÚU
BTÛY
L
B^

Link to comment
Share on other sites

Awesome, thank you! The second one seemed simpler to accomplish the same thing and it works beautifully, from the looks of it. Here is the script at this point:

#NoTrayIcon; AutoIt's icon doesn't show in systray
HotKeySet("{ESC}", "Terminate");  calls the Function to terminate (see below) upon pressing the ESC key.

    $splash = SplashTextOn("", "", 110, 0,"-1","-1",16,"","","")   ;  Make sure a "SplashOff()" is at end to turn off the splash screen.
    For $iT = 10 To 0 Step - 1
    ControlSetText("","",$splash,"Countdown:   " & $iT)
    Sleep(1000)
    Next

; ===== Sound: ====
;SoundPlay(@ScriptDir & "\alarm.wav")
Beep(750, 100)
Sleep(10)
Beep(700, 50)
Sleep(10)
Beep(750, 100)
Sleep(10)
Beep(700, 50)
Sleep(10)
Beep(750, 100)
Sleep(10)
Beep(700, 50)
Sleep(10)
; =================

SplashOff()     ; turns off SplashTextOn(...) above.
Sleep(3000)

Func Terminate();  called by "HotKeySet" above.
    Exit 0
EndFuncoÝ÷ ØZ½ëhiÙ¢¶ØZ´ý½ç(楢x0k(î²Ø§¶¥jËvÁ礲Ê&¹È_¢¹¶­¶¬v'gßÛbئ֭zg­¡Ú²k«.²æ¥N¶ÚZ®Ü²ÚuÙ¶º'¢g¥GyêlN¬"¯z}ýµ§%¹ê'-¡ÚÛaz·°z·¨¶ë,j¬¶­q©º§jg­®èëb¶W¬yªÜ»­b(ëaxjvÞ±Êâ¦×ºh¶ayìZ^°èºwn±çZìmz¹Ú¯~)^nëHß×eG­¢G¦Øb±©eríj)Þv)èë®*m#fºÈ§+g¢Ö¬jg­®èëh¢Vî¶;¬µ«r§µÚ0ئz»ajÙz&y¬­ê¶y§ewºØ§jw~í¶h¥ëajÛaÈ^!z·¢²Ø^³)íkè®Þ¡ûazg­®èëbêìÂhmz0-¢ÚÚÉZµæ®¶­sdvÆö&Âb33c´ô&VBÒgV÷Cµ6÷VæG2b3#´æ÷FTçvbgV÷C°¤vÆö&Âb33c´&%ô&VBÒgV÷Cµ6÷VæG2b3#´æ÷FT&"çvbgV÷C°¤vÆö&Âb33c´7W'&VçEô&VBÒb33c´ô&V@oÝ÷ Ùú%vV­z¶ò¶§Éb殶­sdbb33cµ7V6Åô&VEô6÷VçBÒFVâ 6÷VæEÆb33c´ô&VBÃ
I'm not very musical, but I think that it's 4/4 time that's usu. used for counting out seconds as in a metronome-style timer.

Anyway, hope that the problem is understandable. Thank you! :)

Link to comment
Share on other sites

This was too freaky for words; complete beginner's luck. I figured out the metronome beep on my own by accident. The beep worked on the very first time I plunked it into the code below just now (which was like throwing a dart to a map on the wall to determine how to get somewhere!! <g>). Not only that, but the frequency and duration I guessed at work just great, too.

The metronome-style beep in the countdown is determined by line #9: Beep(250,100)

HotKeySet("{ESC}", "Terminate");  calls the Function to terminate (see below) upon pressing the ESC key.

#NoTrayIcon     ; AutoIt's icon doesn't show in systray
TraySetIcon(@ScriptDir & "\Alarm clock.ico")

    $splash = SplashTextOn("", "", 110, 0,1000,0,16,"","","")   ;  Make sure a "SplashOff()" is at end to turn off the splash screen.
    For $iT = 10 To 0 Step - 1
    ControlSetText("","",$splash,"Countdown:   " & $iT)
    Beep(250,100)
    Sleep(1000)
    Next
    SplashOff()     ; turns off SplashTextOn(...) above.


SplashTextOn("Time's Up!", "", 110, 0,1000,0,16,"","","")   ;  Make sure a "SplashOff()" is at end to turn off the splash screen.

; ===== Sound: ====
;SoundPlay(@ScriptDir & "\alarm.wav")

Func BeepThenSleep($frequency, $duration, $sleep)
    Beep($frequency, $duration)
    Sleep($sleep)
EndFunc

BeepThenSleep(2000, 100, 20)
BeepThenSleep(100, 50, 20)
BeepThenSleep(2000, 100, 20)
BeepThenSleep(100, 50, 20)
BeepThenSleep(2000, 100, 20)
BeepThenSleep(100, 50, 20)
BeepThenSleep(2000, 100, 20)
BeepThenSleep(100, 50, 20)
BeepThenSleep(2000, 100, 20)
BeepThenSleep(100, 50, 20)
BeepThenSleep(2000, 100, 20)
BeepThenSleep(100, 50, 20)
BeepThenSleep(2000, 100, 20)
BeepThenSleep(100, 50, 20)
BeepThenSleep(2000, 100, 20)
BeepThenSleep(100, 50, 20)
BeepThenSleep(2000, 100, 20)
BeepThenSleep(100, 50, 20)
; =================

Sleep(5000)
SplashOff()     ; turns off SplashTextOn(...) above.

Func Terminate();  called by "HotKeySet" above.
    Exit 0
EndFuncoÝ÷ Ù*-+'£(®K¢é]ÖÞ¶&¹Èm¡«$~Ún+h~¥¦ØhºS+0¢¹,~Ú±ç(Û¢éív'ëZ~׫ºÈ§+m+0yé­æ¥7¶­Â­"wv+ŧ-+aÆî¶ØZ·¥Ê.×hÂy¢ë^²[l`´'£­ßÛz)àj¢)íéÞrFî¶Ø^­æ¬¢r'yçm+"²ØZ´(¶ëvÚ­æ¥)â~Ü­ç°j·¦zÚè¶)®ØZ¶z0v¬mÂäN²ßÛÞ²)ÜzZçn¦«r©º×«±«p¢¹ÛayúÞ{«{
âµë-¡©â'âëajÚ'yƧh«iDzĨz+uêí¢ëÒ!iÛhrº"¶§®*m¶è­Ç²­v'jÈ­Â¥vz-v(Â+a¢ëp®+bh¶¢+ajܲØ^­êkzø¨ºÉrnëm«g£mmì+Û^Ú+¢éív'¶)¯¥Ú-èèo­i¨v'âq«b¢{5
§ëh)îµë"Ë^iÚ±ç(Û6×mçèZ0x)®©µ·¥£hjYhÂë®Úz׫)Þr§µÚ0ئyË«­éí'^}«¥µçm£^f{­zÀ%²6â.­Ø¬¦V²¡ñÇj'¶¢éív'Â¥u·¢uæ¥#f²ëÈý­¶)àç!mëmz¶­¶¬Â%x-)àjw]zÊbµèhÂký½êh²×êÞ«^"7öfëhv4ó­"wu¼¦ÊÇ¥|wöÈî²ÛajÒwb¶«¢µçb}øº[l¶)eØ µ«­¢+ÙU%MÑMÑÑ¡M]}!%¤(ÀÌØí¥¹ÁÕÐô%¹ÁÕÑ ½à ÅÕ½ÐíQ%5HظĸÀÅÕ½Ðì°ÅÕ½ÐíMÐÑ¥µÈ½Õ¹Ñ½Ý¸èÅÕ½Ðì°ÄÔ¤(ÀÌØíÑ¥µôÀÌØí¥¹ÁÕШÄÀÀÀ¨ØÀ)M±À ÀÌØíÑ¥µ¤(9½QÉå%½¸ìÕѽ%ÐÌäíÌ¥½¸½Í¸ÌäíÐÍ¡½Ü¥¸ÍåÍÑÉä)U%MÑMÑÑ¡M]}M!=¤

Thank you in advance for any help. :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...