Jump to content
CarlD

TalkTock -- Talking Clock

Recommended Posts

TalkTock is a talking clock. It's configurable via the opening screen, an .ini file, or the command line. The .ini offers the widest range of options, including language preferences. The package includes sample .ini files for Italian- and Russian-language clocks.

Links:

Source:

#cs
--------------------------------------
TalkTock.au3 -- Talking Clock
CLD rev.2021-01-18-a (freeware -- no warranties expressed or implied)

Usages
(1) TalkTock [/I #] [/C 12|24] [/V #] [/R #] [/S ["]voice name["]|hint] [/U S|M|H|D|W|T|Y=#] [/Q|/QQ]
    /I = Interval between time announcements (in minutes)
    /C = Clock style (12- or 24-hour)
    /V = Volume (range 1 to 100)
    /R = speaking Rate (range -10 to 10)
    /S "voice name"|hint (hint = unique substring of voice name)
    /T = Say time only (no prefix or postfix)
    /U S|M|H|D|W|T|Y=# = clock stops after # Secs|Mins|Hrs|Days|Wks|monThs|Yrs
    /Q = Quiet (time displayed on screen, not spoken)
    /QQ = NOT Quiet (overrides Quiet=1 setting in TalkTock.ini)

User-selected values are saved in TalkTock.ini.
Language preferences and other settings can be changed by editing
  TalkTock.ini in any text editor.

(2) TalkTock /?|?H|/SayHelp|/Kill
     /?|/H = Display on-screen help
     /SayHelp = Speak the help screen
     /Kill = Kill ALL running TalkTock.exe processes

(3) TalkTock /L
    List available voices

(4) TalkTock /UseFile [d:\path\]INI_filename
    Take settings from a specified settings file
      (must have TalkTock.ini format)

(5) TalkTock /RESET
    Create new TalkTock.ini with default settings
      (existing TalkTock.ini is backed up to TalkTock.IN_)

(6) TalkTock /SOURCE
    View AutoIt source code
--------------------------------------
#ce

#include <AutoItConstants.au3>
#include <ButtonConstants.au3>
#include <FileConstants.au3>
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <Misc.au3>
#include <MsgBoxConstants.au3>
#include <StaticConstants.au3>
#include <TrayConstants.au3>
#include <WindowsConstants.au3>

Opt("MustDeclareVars", 1)
Opt("TrayAutoPause", 0)
Opt("TrayMenuMode", 1)
Opt("TrayOnEventMode", 1)

; Icon by Ampeross (free for non-commercial use)
; http://www.iconarchive.com/show/qetto-2-icons-by-ampeross/timer-icon.html
FileInstall("X:\Ampeross-Qetto-2-Timer.ico", @TempDir, 1)
FileInstall("X:\ausource.txt", @TempDir, 1)

Global $sCMline = $CmdLineRaw
Global $sCurWin = WinGetTitle("[active]")

; Warning on multiple TalkTock processes
If ProcessList(@ScriptName)[0][0] > 1 Then
    If $CmdLine[0] = 0 Or ( StringInStr($sCMline, "kill") + StringInStr($sCMline, "reset") + StringInStr($sCMline, "source") + StringInStr($sCMline, "/?") + StringInStr($sCMline, "-?") + StringInStr($sCMline, "/h") + StringInStr($sCMline, "-h") + StringInStr($sCMline, "/L") + StringInStr($sCMline, "-L") = 0  ) Then ReStartTT()
EndIf

; Default interval, 12|24, volume, talk rate settings, etc.
Global $idFreq = 15     ; Default interval every 15 minutes
Global $vdT12or24 = 12  ; 12- or 24-hour time (Clock style)
Global $sdVoice = ""    ; TTS voice (""=use default voice)
Global $idVol = 80      ; Volume (range 0 to 100)
Global $idRate = 0      ; Speaking rate (range -10 to 10)
Global $idStop = 0      ; Clock stops = 0 (Never)
Global $sdUnits = "H"   ; Stop clock units (default = H = hours)
Global $bdQuiet = 0      ; Quiet operation (time shown on screen)
Global $idDisplay = 2   ; Duration of on-screen time display in secs.
;                      ;  (has effect only if $bQuiet = 1)
; ---------------------------------------------------------------
Global $bCanned = 1     ; "Canned" or custom interval
Global $bdTimeOnly = 0  ; Say time only (no prefix|postfix)
Global $bArgs = 0       ; If args, do not update .INI
;
; Default phrases
Global $sdHi = "Welcome to TalkTock, the Talking Clock"
Global $sdPause = "TalkTock paused"
Global $sdResume = "TalkTock resumed"
Global $sdStopSay = "Goodbye"
Global $sdIntro = "The time will be announced every"
Global $sdPrefix = "It's"
Global $sdPrefix1 = ""
Global $bdSayAMPM = 1
Global $sdHowFreq1 = "minnit" ; spelling altered to aid pronunciation
Global $sdHowFreq5 = "5 minutes at the 5-minute mark"
Global $sdHowFreq10 = "10 minutes at the 10-minute mark"
Global $sdHowFreq15 = "15 minutes on the quarter hour"
Global $sdHowFreq30 = "30 minutes on the half hour"
Global $sdHowFreq60 = "'our on the hour"; pronunciation
Global $sdHowFreqCustom = "minutes"
Global $sdMidnight = "midnight"
Global $sdMidday = "noon"
Global $sdBye = "Goodbye"

#cs
; Default phrases
Global $sdHi = ""
Global $sdPause = ""
Global $sdResume = ""
Global $sdStopSay = ""
Global $sdIntro = ""
Global $sdPrefix = ""
Global $sdPrefix1 = ""
Global $bdSayAMPM = 1
Global $sdHowFreq1 = ""
Global $sdHowFreq5 = ""
Global $sdHowFreq10 = ""
Global $sdHowFreq15 = ""
Global $sdHowFreq30 = ""
Global $sdHowFreq60 = ""
Global $sdHowFreqCustom = ""
Global $sdBye = ""
#ce

; Default GUI labels
Global $sgdTitle = "TalkTock - Talking Clock"
Global $sgdTop = "Say the time every"
Global $sgdMinute = "minute"
Global $sgdMinutes = "minutes"
Global $sgdQuarterHour = "quarter hour"
Global $sgdHalfHour = "half hour"
Global $sgdHour = "hour"
Global $sgdHours = "hours"
Global $sgdCustom = "Custom"
Global $sgdClock = "Clock style"
Global $sgd12hr_Label = "12-hour"
Global $sgd24hr_label = "24-hour"
Global $sgdQuiet_label = "Time is: "
Global $sgdSpeak_label = "spoken"
Global $sgdDisplay_label = "displayed"
Global $sgdExpires = "Clock stops "
Global $sgdExpNever = " Never"
Global $sgdExpAfter = " After "
Global $sgdExpSecs = "secs"
Global $sgdExpMins = "mins"
Global $sgdExpHours = "hours"
Global $sgdExpDays = "days"
Global $sgdExpWeeks = "weeks"
Global $sgdExpMons = "months"
Global $sgdExpYears = "years"
Global $sgdVolume_label = "Volume"
Global $sgdStart_button = "Start"
Global $sgdCancel_button = "Cancel"
Global $sgdPause = "Pause"
Global $sgdResume = "Resume"
Global $sgdExit = "Stop"

; Failsafe assignments
Global $sVoice = $sdVoice
Global $iFreq = $idFreq
Global $vT12or24 = $vdT12or24
If $vT12or24 <> 24 Then $vT12or24 = 12
Global $iVol = $idVol
Global $iRate = $idRate
Global $bQuiet = $bdQuiet
Global $iDisplay = $idDisplay
Global $iStop = $idStop
Global $iIter = -1
Global $sUnits = $sdUnits
Global $sStopFn = ""
Global $sHi = $sdHi
Global $sPause = $sdPause
Global $sResume = $sdResume
Global $sStopSay = $sdStopSay
Global $sIntro = $sdIntro
Global $sPrefix = $sdPrefix
Global $sPrefix1 = $sdPrefix1
Global $bSayAMPM = $bdSayAMPM
If $vT12or24 = 24 Then $bSayAMPM = 0
Global $sHowFreq1 = $sdHowFreq1
Global $sHowFreq5 = $sdHowFreq5
Global $sHowFreq10 = $sdHowFreq10
Global $sHowFreq15 = $sdHowFreq15
Global $sHowFreq30 = $sdHowFreq30
Global $sHowFreq60 = $sdHowFreq60
Global $sHowFreqCustom = $sdHowFreqCustom
Global $sMidnight = $sdMidnight
Global $sMidday = $sdMidday
Global $sBye = $sdBye

; GUI Labels
Global $sgPause = $sgdPause
Global $sgResume = $sgdResume
Global $sgExit = $sgdExit
Global $sgTitle = $sgdTitle
Global $sgTop = $sgdTop
Global $sgMinute = $sgdMinute
Global $sgMinutes = $sgdMinutes
Global $sgQuarterHour = $sgdQuarterHour
Global $sgHalfHour = $sgdHalfHour
Global $sgHour = $sgdHour
Global $sgHours = $sgdHours
Global $sgCustom = $sgdCustom
Global $sgClock = $sgdClock
Global $sg12hr_label = $sgd12hr_Label
Global $sg24hr_label = $sgd24hr_label
Global $sgQuiet_label = $sgdQuiet_label
Global $sgSpeak_label = $sgdSpeak_label
Global $sgDisplay_label = $sgdDisplay_label
Global $sgExpires = $sgdExpires
Global $sgExpNever = $sgdExpNever
Global $sgExpAfter = $sgdExpAfter
Global $sgExpSecs = $sgdExpSecs
Global $sgExpMins = $sgdExpMins
Global $sgExpHours = $sgdExpHours
Global $sgExpDays = $sgdExpDays
Global $sgExpWeeks = $sgdExpWeeks
Global $sgExpMons = $sgdExpMons
Global $sgExpYears = $sgdExpYears
Global $sgVolume_label = $sgdVolume_label
Global $sgStart_button = $sgdStart_button
Global $sgCancel_button = $sgdCancel_button

Global $sPad = "    "; | & $sPad |
Global $sHelp = "TalkTock -- The Talking Clock" & @CRLF & "CLD rev.2021-01-18 (freeware -- no warranties expressed or implied)" & @CRLF & @CRLF & "Usage:" & @CRLF & "(1) TalkTock.exe" & @CRLF & $sPad & "Choose options, then click ""Start""" & @CRLF & @CRLF & "(2) TalkTock.exe [/I #] [/C 12|24] [/V #]] [/R #] [/S [""]voice name[""]|hint] [/U S|M|H|D|W|T|Y=#] [/Q|/QQ]" & @CRLF & $sPad & "/I = Interval between time announcements (in minutes)" & @CRLF & $sPad & "/C = Clock style (12- or 24-hour)" & @CRLF & $sPad & "/V = Volume (range 1 to 100)" & @CRLF & $sPad & "/R = speaking Rate (range -10 to 10)" & @CRLF & $sPad & "/S ""voice name""|hint (hint = unique substring of voice name)" & @CRLF & $sPad & "/T = Say time only, no prefix or postfix (instant compatibility with any language)" & @CRLF & $sPad & "/U S|M|H|D|W|T|Y=# = clock stops after # Secs|Mins|Hrs|Days|Wks|monThs|Yrs" & @CRLF & $sPad & "/Q = Quiet (time displayed on screen, not spoken)" & @CRLF & $sPad & "/QQ = NOT Quiet (overrides Quiet=1 setting in TalkTock.ini)" & @CRLF & @CRLF & "User-selected values are saved in TalkTock.ini." & @CRLF & "Language preferences and other settings can be changed by editing" & @CRLF & "  TalkTock.ini in any text editor." & @CRLF & "" & @CRLF & "(3) TalkTock /?|/H|/SayHelp|/Kill" & @CRLF & $sPad & "/?|/H = Display on-screen help" & @CRLF & $sPad & "/SayHelp = Spoken command-line usage" & @CRLF & $sPad & "/Kill = Kill ALL running TalkTock.exe processes" & @CRLF & @CRLF & "(4) TalkTock /L" & @CRLF & $sPad & "List available voices" & @CRLF & @CRLF & "(5) TalkTock /UseFile [d:\path\]INI_filename" & @CRLF & $sPad & "Take settings from a specified settings file" & @CRLF & $sPad & "(must have TalkTock.ini format)" & @CRLF & @CRLF & "(6) TalkTock /RESET" & @CRLF & $sPad & "Create new TalkTock.ini with default settings" & @CRLF & $sPad & "(existing TalkTock.ini is backed up to TalkTock.IN_)" & @CRLF & @CRLF & "(7) TalkTock /SOURCE" & @CRLF & $sPad & "View AutoIt source code" & @CRLF

; Create TalkTock.ini (if not already present)
Global $sFini = @ScriptName
Global $sFini2 = ""; alternate .INI file
If StringInStr($sFini, ".") Then $sFini = StringTrimRight($sFini, StringLen($sFini) - StringInStr($sFini, ".", 0, -1) + 1)
$sFini = @ScriptDir & "\" & $sFini & ".ini"

;Create new (default) TalkTock.ini
If $CmdLine[0] = 1 Then
    If StringInStr(StringUpper($CmdLine[1]), "RESET") Then
        If FileExists($sFini) Then
            FileCopy($sFini, @ScriptDir & "\TalkTock.IN_", $FC_OVERWRITE)
            FileDelete($sFini)
        EndIf
    EndIf
EndIf

; Take settings from file not TalkTock.ini
If $CmdLine[0] = 2 Then
    If StringUpper($CmdLine[1]) = "/USEFILE" Or StringUpper($CmdLine[1]) = "-USEFILE" Then
        $sFini2 = $CmdLine[2]
        If FileExists($sFini2) Then $sFini = $sFini2
    EndIf
EndIf

If Not FileExists($sFini) Then
    Global $hIni = FileOpen($sFini, $FO_OVERWRITE + $FO_UTF8)
    If $hIni > -1 Then

        Global $sIniC = "Settings file for TalkTock.exe, Talking Clock" & @CRLF & ";" & @CRLF & "[TalkTock]" & @CRLF & ";; Interval between time announcements, in minutes" & @CRLF & "Interval=" & $idFreq & @CRLF & ";; 12- or 24-hour clock" & @CRLF & "ClockStyle=" & $vdT12or24 & @CRLF& ";; Say AM/PM? 1=Yes 0=No; applies to 12-hour clock only" & @CRLF & "SayAMPM=" & $bdSayAMPM & @CRLF& ";; TTS voice" & @CRLF & "Voice=default" & @CRLF & ";Voice=Microsoft George" & @CRLF& ";; Volume, range 1 to 100" & @CRLF & "Volume=" & $idVol & @CRLF& ";; Speaking rate, range -10 to 10" & @CRLF & "TalkRate=" & $idRate & @CRLF & ";; Clock stop timer units" & @CRLF & ";; S=secs M=mins H=hours D=days W=weeks T=months Y=years" & @CRLF & "ClockTimerUnits=" & $sdUnits & @CRLF& ";; Clock stops after how many timer units? (0 = clock never stops)" & @CRLF & "ClockStops=0" & @CRLF & ";; Quiet operation, time shown on screen (1=yes 0=no)" & @CRLF & "Quiet=0" & @CRLF & ";; Duration, in seconds, of on-screen time display" & @CRLF & ";; Fractional (decimal) values are allowed (e.g., Display=3.5)" & @CRLF & "Display=2.5" & @CRLF & @CRLF

        $sIniC &= "[Language]" & @CRLF & ";; Translate the phrases and labels below into your chosen language." & @CRLF & ";; Any language with a TTS function (a ""Voice"") in its language pack" & @CRLF & ";; should work. To use other languages, edit TalkTock.ini using the" & @CRLF & ";; UTF-8 character set" & @CRLF & ";" & @CRLF & ";; TimeOnly: 1=Yes (phrases set below will NOT be spoken); 0=No" & @CRLF & "TimeOnly=0" & @CRLF & ";" & @CRLF & "; Welcome and Intro messages" & @CRLF & ";; Comment out (prepend "";"") to suppress these messages" & @CRLF & "onStart=" & $sdHI & @CRLF & "Intro=" & $sdIntro & @CRLF & ";" & @CRLF & "; Interval descriptions" & @CRLF & "Freq1=" & $sdHowFreq1 & @CRLF & "Freq5=" & $sdHowFreq5 & @CRLF & "Freq10=" & $sdHowFreq10 & @CRLF & "Freq15=" & $sdHowFreq15 & @CRLF & "Freq30=" & $sdHowFreq30 & @CRLF & "Freq60=" & $sdHowFreq60 & @CRLF & "FreqCustom=" & $sdHowFreqCustom & @CRLF & ";; Spoken prefix" & @CRLF & "Prefix=" & $sdPrefix & @CRLF & ";; No prefix (just announce the time):" & @CRLF & ";Prefix=" & @CRLF & ";Prefix=It's" & @CRLF & ";Prefix=It's now" & @CRLF & ";Prefix=The time is" & @CRLF & ";; Singular prefix: Prefix1 defines the singular inflection" & @CRLF & ";; for ""one o'clock"" in applicable languages, e.g., Italian" & @CRLF & ";Prefix1=" & @CRLF & ";; Postfix at midnight (0000 hours) and midday (1200 hours)" & @CRLF & ";;  See also Postfix pairs, below" & @CRLF & "At0000Say=" & $sdMidnight & @CRLF & "At1200Say=" & $sdMidday & @CRLF & ";" & @CRLF

        $sIniC &= ";; Postfix pairs (optional)" & @CRLF & ";; ------------------------" & @CRLF & ";; Alternatives to saying ""AM/PM"" (or equivalent) after the time" & @CRLF & ";; If time falls within Range, TalkTock says" & @CRLF & ";;   Phrase after saying the time" & @CRLF & ";; You can set as many, or as few, of these pairs as you like" & @CRLF & ";; Note: Range# settings must have content (a time range hhmm-hhmm)" & @CRLF & ";;       Phrase# settings can be a phrase or empty (say nothing)" & @CRLF & ";Range1=0000-0000" & @CRLF & ";Phrase1=Midnight" & @CRLF& ";Range2=0001-0329" & @CRLF & ";Phrase2=A.M." & @CRLF& ";Range3=0330-1159" & @CRLF & ";Phrase3=in the morning" & @CRLF& ";Range4=1200-1200" & @CRLF & ";Phrase4=Noon" & @CRLF& ";Range5=1201-1659" & @CRLF & ";Phrase5=in the afternoon" & @CRLF& ";Range6=1700-1959" & @CRLF & ";Phrase6=in the evening" & @CRLF &  ";Range7=2000-2359" & @CRLF & ";Phrase7=at night" & @CRLF & ";; ------------------------" & @CRLF & ";" & @CRLF & "; Pause/Resume/Stop" & @CRLF & ";; Comment out (prepend "";"") to suppress these messages" & @CRLF & "onPause=" & $sdPause & @CRLF & "onResume=" & $sdResume & @CRLF & "onStop=" & $sdBye & @CRLF & @CRLF

        $sIniC &= "[GUI_Labels]" & @CRLF & "Title=" & $sgdTitle & @CRLF & "Top=" & $sgdTop & @CRLF & "Minute=" & $sgdMinute & @CRLF & "Minutes=" & $sgdMinutes & @CRLF & "QuarterHour=" & $sgdQuarterHour & @CRLF & "HalfHour=" & $sgdHalfHour & @CRLF & "Hour=" & $sgdHour & @CRLF & "Hours=" & $sgdHours & @CRLF & "CustomLabel=" & $sgdCustom & @CRLF & "ClockStyle=" & $sgdClock & @CRLF & "12-hour_Label=" & $sgd12hr_Label & @CRLF & "24-hour_Label=" & $sgd24hr_label & @CRLF & "Quiet_label=" & $sgdQuiet_label & @CRLF & "Speak_label=" & $sgdSpeak_label & @CRLF & "Display_label=" & $sgdDisplay_label & @CRLF & "ClockStop_Label=" & $sgdExpires & @CRLF & "ClockStopsNever_Label=" & $sgdExpNever & @CRLF & "ClockStopsAfter_Label=" & $sgdExpAfter & @CRLF & "ClockStopsAfterSecs_Label=" & $sgExpSecs & @CRLF & "ClockStopsAfterMins_Label=" & $sgExpMins & @CRLF & "ClockStopsAfterHours_Label=" & $sgExpHours & @CRLF & "ClockStopsAfterDays_Label=" & $sgdExpDays & @CRLF & "ClockStopsAfterWeeks_Label=" & $sgdExpWeeks & @CRLF & "ClockStopsAfterMons_Label=" & $sgdExpMons & @CRLF & "ClockStopsAfterYears_Label=" & $sgdExpYears & @CRLF & "Volume_Label=" & $sgdVolume_label & @CRLF & "ClockStop_Label=Clock stops" & @CRLF & "ClockStopsAfter_Label=After" & @CRLF & "ClockStopsHours_Label=hours" & @CRLF & "ClockStopsNever_Label=Never" & @CRLF & "Start_button=Start" & @CRLF & "Cancel_button=Cancel" & @CRLF & "Tray_pause=Pause" & @CRLF & "Tray_resume=Resume" & @CRLF & "Tray_exit=Stop" & @CRLF

        If Not FileWrite($hIni, $sIniC) Then MsgBox($MB_ICONWARNING, @ScriptName, "Error writing " & $sFini, 3)
        FileClose($hIni)
    EndIf
EndIf

Global $sFiniV = _IniFileReadFile($sFini)
If Not $sFiniV Then _ExitErr("Error reading " & $sFini)

; Read values from TalkTock.ini/alternate .ini
$iFreq = _IniFileRead("sFiniV", "TalkTock", "Interval", $idFreq)
$vT12or24 = _IniFileRead("sFiniV", "TalkTock", "ClockStyle", $vdT12or24)
$bSayAMPM = _IniFileRead("sFiniV", "TalkTock", "SayAMPM", $bdSayAMPM)
$sVoice = _IniFileRead("sFiniV", "TalkTock", "Voice", $sdVoice)
If StringUpper($sVoice) = "DEFAULT" Then $sVoice = ""
$iVol = _IniFileRead("sFiniV", "TalkTock", "Volume", $idVol)
$iRate = _IniFileRead("sFiniV", "TalkTock", "TalkRate", $idRate)
$iStop = _IniFileRead("sFiniV", "TalkTock", "ClockStops", $idStop)
$sUnits = _IniFileRead("sFiniV", "TalkTock", "ClockTimerUnits", $sdUnits)
$bQuiet = _IniFileRead("sFiniV", "TalkTock", "Quiet", $bdQuiet)
$iDisplay = _IniFileRead("sFiniV", "TalkTock", "Display", $idDisplay)

Global $bTimeOnly = _IniFileRead("sFiniV", "Language", "onStart", $bdTimeOnly)
$sHi = _IniFileRead("sFiniV", "Language", "onStart", "")
$sIntro = _IniFileRead("sFiniV", "Language", "Intro", "")
$sHowFreq1 = _IniFileRead("sFiniV", "Language", "Freq1", $sdHowFreq1)
$sHowFreq5 = _IniFileRead("sFiniV", "Language", "Freq5", $sdHowFreq5)
$sHowFreq10 = _IniFileRead("sFiniV", "Language", "Freq10", $sdHowFreq10)
$sHowFreq15 = _IniFileRead("sFiniV", "Language", "Freq15", $sdHowFreq15)
$sHowFreq30 = _IniFileRead("sFiniV", "Language", "Freq30", $sdHowFreq30)
$sHowFreq60 = _IniFileRead("sFiniV", "Language", "Freq60", $sdHowFreq60)
$sHowFreqCustom = _IniFileRead("sFiniV", "Language", "FreqCustom", $sdHowFreqCustom)
$sPrefix = _IniFileRead("sFiniV", "Language", "Prefix", "")
$sPrefix1 = _IniFileRead("sFiniV", "Language", "Prefix1", $sdPrefix1)
$sPause = _IniFileRead("sFiniV", "Language", "onPause", "")
$sResume = _IniFileRead("sFiniV", "Language", "onResume", "")
$sStopSay = _IniFileRead("sFiniV", "Language", "onStop", "")
$sBye = _IniFileRead("sFiniV", "Language", "onStop", "")

; GUI_Labels
$sgTitle = _IniFileRead("sFiniV", "GUI_Labels", "Title", $sgdTitle)
$sgTop = _IniFileRead("sFiniV", "GUI_Labels", "Top", $sgdTop)
$sgMinute = _IniFileRead("sFiniV", "GUI_Labels", "Minute", $sgdMinute)
$sgMinutes = _IniFileRead("sFiniV", "GUI_Labels", "Minutes", $sgdMinutes)
$sgQuarterHour = _IniFileRead("sFiniV", "GUI_Labels", "QuarterHour", $sgdHour)
$sgHalfHour = _IniFileRead("sFiniV", "GUI_Labels", "HalfHour", $sgdHours)
$sgHour = _IniFileRead("sFiniV", "GUI_Labels", "Hour", $sgdHour)
$sgHours = _IniFileRead("sFiniV", "GUI_Labels", "Hours", $sgdHours)
$sgCustom = _IniFileRead("sFiniV", "GUI_Labels", "CustomLabel", $sgdCustom)
$sgClock = _IniFileRead("sFiniV", "GUI_Labels", "ClockStyle", $sgdClock)
$sg12hr_label = _IniFileRead("sFiniV", "GUI_Labels", "12-hour_Label", $sgd12hr_Label)
$sg24hr_label = _IniFileRead("sFiniV", "GUI_Labels", "24-hour_Label", $sgd24hr_label)
$sgQuiet_label = _IniFileRead("sFiniV", "GUI_Labels", "Quiet_label", $sgdQuiet_label)
$sgSpeak_label = _IniFileRead("sFiniV", "GUI_Labels", "Speak_label", $sgdSpeak_label)
$sgDisplay_label = _IniFileRead("sFiniV", "GUI_Labels", "Display_label", $sgdDisplay_label)
;
$sgExpires = _IniFileRead("sFiniV", "GUI_Labels", "ClockStop_Label", $sgdExpires)
$sgExpNever = _IniFileRead("sFiniV", "GUI_Labels", "ClockStopsNever_Label", $sgdExpNever)
$sgExpAfter = _IniFileRead("sFiniV", "GUI_Labels", "ClockStopsAfter_Label", $sgdExpAfter)
$sgExpSecs = _IniFileRead("sFiniV", "GUI_Labels", "ClockStopsAfterSecs_Label", $sgdExpSecs)
$sgExpMins = _IniFileRead("sFiniV", "GUI_Labels", "ClockStopsAfterMins_Label", $sgdExpMins)
$sgExpHours = _IniFileRead("sFiniV", "GUI_Labels", "ClockStopsAfterHours_Label", $sgdExpHours)
$sgExpDays = _IniFileRead("sFiniV", "GUI_Labels", "ClockStopsAfterDays_Label", $sgdExpDays)
$sgExpWeeks = _IniFileRead("sFiniV", "GUI_Labels", "ClockStopsAfterWeeks_Label", $sgdExpWeeks)
$sgExpMons = _IniFileRead("sFiniV", "GUI_Labels", "ClockStopsAfterMons_Label", $sgdExpMons)
$sgExpYears = _IniFileRead("sFiniV", "GUI_Labels", "ClockStopsAfterYears_Label", $sgdExpYears)
;
Global $sgVolume = _IniFileRead("sFiniV", "GUI_Labels", "Volume_Label", $sgdVolume_label)
$sgStart_button = _IniFileRead("sFiniV", "GUI_Labels", "Start_button", $sgdStart_button)
$sgCancel_button = _IniFileRead("sFiniV", "GUI_Labels", "Cancel_button", $sgdCancel_button)
$sgPause = _IniFileRead("sFiniV", "GUI_Labels", "Tray_pause", $sgdPause)
$sgResume = _IniFileRead("sFiniV", "GUI_Labels", "Tray_resume", $sgdResume)
$sgExit = _IniFileRead("sFiniV", "GUI_Labels", "Tray_exit", $sgdExit)
;
Global $hTrayPA = TrayCreateItem($sgPause, -1, 0)
Global $hTrayEX = TrayCreateItem($sgExit, -1, 1)
TraySetClick(1)
TraySetState($TRAY_ICONSTATE_SHOW)
TrayItemSetOnEvent($hTrayPA, "_TrayPause")
TrayItemSetOnEvent($hTrayEX, "_TrayExit")

; Postfix pairs: get values
Global $aParts[100][2], $aFParts[100][2]
$aParts[0][0] = 0
If $bTimeOnly = 0 Then $aParts = PostfixPairsRead()

$sFiniV = ""
Global $oVox = ObjCreate("SAPI.spVoice")
If @error Then _ExitErr("SAPI error")
$oVox.Volume = $iVol
$oVox.Rate = $iRate

; Args so skip the GUI (except if arg = RESET)
If $CmdLine[0] > 0 Then
    $bArgs = 1
    If StringInStr($sCMline, "/s") Then $sVoice = _GetArgValue("/s")
    If StringInStr($sCMline, "-s") Then $sVoice = _GetArgValue("-s")
    Global $oVoices
    If $sVoice Then
        $oVoices = $oVox.GetVoices()
        For $vName in $oVoices
            If StringInStr($vName.GetDescription(), $sVoice) Then
                $oVox.Voice = $vName
                ExitLoop
            EndIf
        Next
    EndIf
    If StringInStr(StringUpper($CmdLine[1]), "RESET") Then
        Exit MsgBox($MB_OK, @ScriptName, "Default settings restored in " & $sFini)
    Else
        Exit MAIN()
    EndIf
EndIf

; GUI interface
; -------------
Global $hgTT = GUICreate($sgTitle, 638, 365, -1, -1, $WS_EX_APPWINDOW)
GUISetState(@SW_SHOW, $hgTT)
;#Region ### START Koda GUI section ### Form=TT1.kxf
;$GroupBox1 = GUICtrlCreateGroup("", -8, -32, 526, 822)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, 0xFFFFFF)

Global $Label1 = GUICtrlCreateLabel($sgTop & ":", 8, 16, 137, 24)
Global $hgA = GUICtrlCreateCheckbox($sgMinute, 16, 48, 113, 17)
If $iFreq = 1 Then
    GUICtrlSetState($hgA, $GUI_CHECKED)
Else
    GUICtrlSetState($hgA, $GUI_UNCHECKED)
EndIf

Global $hgB = GUICtrlCreateCheckbox("5 " & $sgMinutes, 16, 72, 113, 17)
If $iFreq = 5 Then
    GUICtrlSetState($hgB, $GUI_CHECKED)
Else
    GUICtrlSetState($hgB, $GUI_UNCHECKED)
EndIf

Global $hgC = GUICtrlCreateCheckbox("10 " & $sgMinutes, 16, 96, 113, 17)
If $iFreq = 10 Then
    GUICtrlSetState($hgC, $GUI_CHECKED)
Else
    GUICtrlSetState($hgC, $GUI_UNCHECKED)
EndIf

Global $hgD = GUICtrlCreateCheckbox($sgQuarterHour, 16, 120, 113, 17)
If $iFreq = 15 Then
    GUICtrlSetState($hgD, $GUI_CHECKED)
Else
    GUICtrlSetState($hgD, $GUI_UNCHECKED)
EndIf

Global $hgE = GUICtrlCreateCheckbox($sgHalfHour, 16, 144, 113, 17)
If $iFreq = 30 Then
    GUICtrlSetState($hgE, $GUI_CHECKED)
Else
    GUICtrlSetState($hgE, $GUI_UNCHECKED)
EndIf

Global $hgF = GUICtrlCreateCheckbox($sgHour, 16, 168, 113, 17)
If $iFreq = 60 Then
    GUICtrlSetState($hgF, $GUI_CHECKED)
Else
    GUICtrlSetState($hgF, $GUI_UNCHECKED)
EndIf

Global $hgX = GUICtrlCreateCheckbox($sgCustom & ":", 16, 192, 80, 17)
Global $hgXt = GUICtrlCreateInput("", 96, 192, 41, 28)
Global $Label2 = GUICtrlCreateLabel(" " & $sgMinutes, 144, 192, 60, 24)
If Not StringInStr("|1|5|10|15|30|60|", "|" & $iFreq & "|") Then
    GUICtrlSetState($hgX, $GUI_CHECKED)
    GUICtrlSetState($hgX, $GUI_ENABLE)
    GUICtrlSetState($hgXt, $GUI_ENABLE)
    GUICtrlSetData($hgXt, $iFreq)
Else
    GUICtrlSetState($hgX, $GUI_UNCHECKED)
    GUICtrlSetState($hgXt, $GUI_DISABLE)
EndIf

Global $Label3 = GUICtrlCreateLabel($sgClock & ":", 180, 16, 79, 24)
Global $hgK = GUICtrlCreateCheckbox($sg12hr_label, 182, 48, 97, 17)
If $vT12or24 = 12 Then
    GUICtrlSetState($hgK, $GUI_CHECKED)
Else
    GUICtrlSetState($hgK, $GUI_UNCHECKED)
    $bSayAMPM = 0
EndIf

Global $hgL = GUICtrlCreateCheckbox($sg24hr_label, 182, 72, 97, 17)
If $vT12or24 = 24 Then
    GUICtrlSetState($hgL, $GUI_CHECKED)
    $bSayAMPM = 0
Else
    GUICtrlSetState($hgL, $GUI_UNCHECKED)
EndIf

Global $Label4 = GUICtrlCreateLabel($sgQuiet_label, 182, 130)
Global $hgSpeak = GUICtrlCreateCheckbox($sgSpeak_label, 265, 130, 205, 17)
GUICtrlSetState($hgSpeak, $GUI_ENABLE)
Global $hgDisplay = GUICtrlCreateCheckbox($sgDisplay_label, 265, 155, 205, 17)
GUICtrlSetState($hgDisplay, $GUI_ENABLE)
If $bQuiet = 0 Then
    GUICtrlSetState($hgSpeak, $GUI_CHECKED)
    GUICtrlSetState($hgDisplay, $GUI_UNCHECKED)
Else
    GUICtrlSetState($hgSpeak, $GUI_UNCHECKED)
    GUICtrlSetState($hgDisplay, $GUI_CHECKED)
EndIf

; Clock stops
Global $Label5 = GUICtrlCreateLabel($sgExpires & ":", 390, 16, 90, 24)
Global $hgExpNever = GUICtrlCreateCheckbox($sgExpNever, 392, 48, 97, 17)
If $iStop = 0 Then
    GUICtrlSetState($hgExpNever, $GUI_CHECKED + $GUI_ENABLE)
Else
    GUICtrlSetState($hgExpNever, $GUI_UNCHECKED + $GUI_ENABLE)
EndIf

Global $hgExp = GUICtrlCreateCheckbox($sgExpAfter, 398, 72, 65, 17)
If $iStop > 0 Then
    GUICtrlSetState($hgExp, $GUI_CHECKED + $GUI_ENABLE)
Else
    GUICtrlSetState($hgExp, $GUI_UNCHECKED + $GUI_ENABLE)
EndIf
Global $hgExpAft = GUICtrlCreateInput("", 456, 64, 41, 28)
If $iStop > 0 Then
    GUICtrlSetState($hgExpAft, $GUI_ENABLE)
    GUICtrlSetData($hgExpAft, $iStop)
Else
    GUICtrlSetState($hgExpAft, $GUI_DISABLE)
EndIf

Global $hgExpUsecs = GUICtrlCreateRadio($sgExpSecs, 414, 96, 113, 17)
If $iStop > 0 And $sUnits = "S" Then
    GUICtrlSetState($hgExpUsecs, $GUI_CHECKED + $GUI_ENABLE)
Else
    GUICtrlSetState($hgExpUsecs, $GUI_UNCHECKED + $GUI_DISABLE)
EndIf

Global $hgExpUmins = GUICtrlCreateRadio($sgExpMins, 414, 120, 113, 17)
If $iStop > 0 And $sUnits = "M" Then
    GUICtrlSetState($hgExpUmins, $GUI_CHECKED + $GUI_ENABLE)
Else
    GUICtrlSetState($hgExpUmins, $GUI_UNCHECKED + $GUI_DISABLE)
EndIf

Global $hgExpUhours = GUICtrlCreateRadio($sgExpHours, 414, 144, 113, 17)
If $iStop > 0 And $sUnits = "H" Then
    GUICtrlSetState($hgExpUhours, $GUI_CHECKED + $GUI_ENABLE)
Else
    GUICtrlSetState($hgExpUhours, $GUI_UNCHECKED + $GUI_DISABLE)
EndIf

Global $hgExpUdays = GUICtrlCreateRadio($sgExpDays, 414, 168, 113, 17)
If $iStop > 0 And $sUnits = "D" Then
    GUICtrlSetState($hgExpUdays, $GUI_CHECKED + $GUI_ENABLE)
Else
    GUICtrlSetState($hgExpUdays, $GUI_UNCHECKED + $GUI_DISABLE)
EndIf

Global $hgExpUweeks = GUICtrlCreateRadio($sgExpWeeks, 414, 192, 113, 17)
If $iStop > 0 And $sUnits = "W" Then
    GUICtrlSetState($hgExpUweeks, $GUI_CHECKED + $GUI_ENABLE)
Else
    GUICtrlSetState($hgExpUweeks, $GUI_UNCHECKED + $GUI_DISABLE)
EndIf

Global $hgExpUmons = GUICtrlCreateRadio($sgExpMons, 414, 216, 113, 17)
If $iStop > 0 And $sUnits = "T" Then
    GUICtrlSetState($hgExpUmons, $GUI_CHECKED + $GUI_ENABLE)
Else
    GUICtrlSetState($hgExpUmons, $GUI_UNCHECKED + $GUI_DISABLE)
EndIf

Global $hgExpUyears = GUICtrlCreateRadio($sgExpYears, 414, 240, 113, 17)
If $iStop > 0 And $sUnits = "Y" Then
    GUICtrlSetState($hgExpUyears, $GUI_CHECKED + $GUI_ENABLE)
Else
    GUICtrlSetState($hgExpUyears, $GUI_UNCHECKED + $GUI_DISABLE)
EndIf

Global $iX = 8
GUICtrlCreateLabel($sgVolume_label, 8, 230+12)
Global $hgV = GUICtrlCreateSlider(8, 255+12, 360)
GUICtrlSetLimit($hgV, 100, 1)
GUICtrlSetData($hgV, $iVol)
GUICtrlSetState($hgV, $GUI_SHOW)
GUICtrlCreateLabel("0", $iX, 280, 360)
GUICtrlCreateLabel("20", $iX + 1*71, 280, 360)
GUICtrlCreateLabel("40", $iX + 2*70, 280, 360)
GUICtrlCreateLabel("60", $iX + 1 + 3*70, 280, 360)
GUICtrlCreateLabel("80", $iX - 2 + 4*69, 280, 360)
GUICtrlCreateLabel("100", $iX - 2 + 5*69, 280, 360)

GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $hgStart = GUICtrlCreateButton($sgStart_button, 534, 22, 92, 30, $BS_DEFPUSHBUTTON)
GUICtrlSetState($hgStart, $GUI_FOCUS)

Global $hgCancel = GUICtrlCreateButton($sgCancel_button, 534, 62, 92, 31)
GUISetState(@SW_SHOW)
; #EndRegion ### END Koda GUI section ###

If $bQuiet = 0 Then
    If $sHi Then _SayTxt($sHi)
EndIf

WHILE 1

Switch GUIGetMsg()
    Case $hgA
        $iFreq = 1
        GUICtrlSetState($hgA, $GUI_CHECKED)
        GUICtrlSetState($hgB, $GUI_UNCHECKED)
        GUICtrlSetState($hgC, $GUI_UNCHECKED)
        GUICtrlSetState($hgD, $GUI_UNCHECKED)
        GUICtrlSetState($hgE, $GUI_UNCHECKED)
        GUICtrlSetState($hgF, $GUI_UNCHECKED)
        GUICtrlSetState($hgX, $GUI_UNCHECKED)
        GUICtrlSetState($hgXt, $GUI_DISABLE)

    Case $hgB
        $iFreq = 5
        GUICtrlSetState($hgA, $GUI_UNCHECKED)
        GUICtrlSetState($hgB, $GUI_CHECKED)
        GUICtrlSetState($hgC, $GUI_UNCHECKED)
        GUICtrlSetState($hgD, $GUI_UNCHECKED)
        GUICtrlSetState($hgE, $GUI_UNCHECKED)
        GUICtrlSetState($hgF, $GUI_UNCHECKED)
        GUICtrlSetState($hgX, $GUI_UNCHECKED)
        GUICtrlSetState($hgXt, $GUI_DISABLE)

    Case $hgC
        $iFreq = 10
        GUICtrlSetState($hgA, $GUI_UNCHECKED)
        GUICtrlSetState($hgB, $GUI_UNCHECKED)
        GUICtrlSetState($hgC, $GUI_CHECKED)
        GUICtrlSetState($hgD, $GUI_UNCHECKED)
        GUICtrlSetState($hgE, $GUI_UNCHECKED)
        GUICtrlSetState($hgF, $GUI_UNCHECKED)
        GUICtrlSetState($hgX, $GUI_UNCHECKED)
        GUICtrlSetState($hgXt, $GUI_DISABLE)

    Case $hgD
        $iFreq = 15
        GUICtrlSetState($hgA, $GUI_UNCHECKED)
        GUICtrlSetState($hgB, $GUI_UNCHECKED)
        GUICtrlSetState($hgC, $GUI_UNCHECKED)
        GUICtrlSetState($hgD, $GUI_CHECKED)
        GUICtrlSetState($hgE, $GUI_UNCHECKED)
        GUICtrlSetState($hgF, $GUI_UNCHECKED)
        GUICtrlSetState($hgX, $GUI_UNCHECKED)
        GUICtrlSetState($hgXt, $GUI_DISABLE)

    Case $hgE
        $iFreq = 30
        GUICtrlSetState($hgA, $GUI_UNCHECKED)
        GUICtrlSetState($hgB, $GUI_UNCHECKED)
        GUICtrlSetState($hgC, $GUI_UNCHECKED)
        GUICtrlSetState($hgD, $GUI_UNCHECKED)
        GUICtrlSetState($hgE, $GUI_CHECKED)
        GUICtrlSetState($hgF, $GUI_UNCHECKED)
        GUICtrlSetState($hgX, $GUI_UNCHECKED)
        GUICtrlSetState($hgXt, $GUI_DISABLE)

    Case $hgF
        $iFreq = 60
        GUICtrlSetState($hgA, $GUI_UNCHECKED)
        GUICtrlSetState($hgB, $GUI_UNCHECKED)
        GUICtrlSetState($hgC, $GUI_UNCHECKED)
        GUICtrlSetState($hgD, $GUI_UNCHECKED)
        GUICtrlSetState($hgE, $GUI_UNCHECKED)
        GUICtrlSetState($hgF, $GUI_CHECKED)
        GUICtrlSetState($hgX, $GUI_UNCHECKED)
        GUICtrlSetState($hgXt, $GUI_DISABLE)

    Case $hgX
        $bCanned = 0
        GUICtrlSetState($hgA, $GUI_UNCHECKED)
        GUICtrlSetState($hgB, $GUI_UNCHECKED)
        GUICtrlSetState($hgC, $GUI_UNCHECKED)
        GUICtrlSetState($hgD, $GUI_UNCHECKED)
        GUICtrlSetState($hgE, $GUI_UNCHECKED)
        GUICtrlSetState($hgF, $GUI_UNCHECKED)
        GUICtrlSetState($hgX, $GUI_CHECKED)
        GUICtrlSetState($hgXt, $GUI_ENABLE)

    Case $hgXt
        $bCanned = 0
        $iFreq = GUICtrlRead($hgXt)

    Case $hgK
        $vT12or24 = 12
        $bSayAMPM = 0
        GUICtrlSetState($hgK, $GUI_CHECKED)
        GUICtrlSetState($hgL, $GUI_UNCHECKED)

    Case $hgL
        $vT12or24 = 24
        $bSayAMPM = 0
        GUICtrlSetState($hgK, $GUI_UNCHECKED)
        GUICtrlSetState($hgL, $GUI_CHECKED)

    Case $hgDisplay
        $bQuiet = 1
        GUICtrlSetState($hgSpeak, $GUI_UNCHECKED)
        GUICtrlSetState($hgDisplay, $GUI_CHECKED)

    Case $hgSpeak
        $bQuiet = 0
        GUICtrlSetState($hgSpeak, $GUI_CHECKED)
        GUICtrlSetState($hgDisplay, $GUI_UNCHECKED)

    Case $hgV
        $iVol = GUICtrlRead($hgV)
        GUICtrlSetState($hgV, $GUI_ENABLE)
        Global $aCartesian = MouseGetPos()
        ToolTip($iVol, $aCartesian[0], $aCartesian[1], "", 0, 2)
        Sleep(500)
        ToolTip("")
        GUICtrlSetState($hgV, $GUI_CHECKED)

    Case $hgExp
        GUICtrlSetState($hgExp, $GUI_CHECKED)
        GUICtrlSetState($hgExpNever, $GUI_UNCHECKED)
        GUICtrlSetState($hgExpAft, $GUI_ENABLE)
        GUICtrlSetState($hgExpUsecs, $GUI_UNCHECKED + $GUI_ENABLE)
        GUICtrlSetState($hgExpUmins, $GUI_UNCHECKED + $GUI_ENABLE)
        GUICtrlSetState($hgExpUhours, $GUI_CHECKED + $GUI_ENABLE)
        GUICtrlSetState($hgExpUdays, $GUI_UNCHECKED + $GUI_ENABLE)
        GUICtrlSetState($hgExpUweeks, $GUI_UNCHECKED + $GUI_ENABLE)
        GUICtrlSetState($hgExpUmons, $GUI_UNCHECKED + $GUI_ENABLE)
        GUICtrlSetState($hgExpUyears, $GUI_UNCHECKED + $GUI_ENABLE)

    Case $hgExpAft
        $iStop = GUICtrlRead($hgExpAft)
        If Not StringIsDigit($iStop) Then $iStop = 0
        Case $hgExpUsecs
        $sUnits = "S"
        Case $hgExpUmins
        $sUnits = "M"
    Case $hgExpUhours
        $sUnits = "H"
    Case $hgExpUdays
        $sUnits = "D"
    Case $hgExpUweeks
        $sUnits = "W"
    Case $hgExpUmons
        $sUnits = "T"
    Case $hgExpUyears
        $sUnits = "Y"

    Case $hgExpNever
        $iStop = 0
        GUICtrlSetState($hgExpNever, $GUI_CHECKED)
        GUICtrlSetState($hgExp, $GUI_UNCHECKED)
        GUICtrlSetState($hgExpAft, $GUI_DISABLE)
        GUICtrlSetState($hgExpUsecs, $GUI_UNCHECKED + $GUI_DISABLE)
        GUICtrlSetState($hgExpUmins, $GUI_UNCHECKED + $GUI_DISABLE)
        GUICtrlSetState($hgExpUhours, $GUI_CHECKED + $GUI_DISABLE)
        GUICtrlSetState($hgExpUdays, $GUI_UNCHECKED + $GUI_DISABLE)
        GUICtrlSetState($hgExpUweeks, $GUI_UNCHECKED + $GUI_DISABLE)
        GUICtrlSetState($hgExpUmons, $GUI_UNCHECKED + $GUI_DISABLE)
        GUICtrlSetState($hgExpUyears, $GUI_UNCHECKED + $GUI_DISABLE)

    Case $hgStart
        GUISetState(@SW_HIDE, $hgTT)
        MAIN()

    Case $hgCancel
        ContinueCase

    Case $GUI_EVENT_CLOSE
        ; _SayTxt($sBye)
        If Not $sFini2 Then WriteTTini()
        Exit
EndSwitch

WEND

; Function definitions
; --------------------
Func MAIN() ; TalkTock

    If $sFini2 = "" And $CmdLine[0] > 0 Then
    ; ----------------------------------------
        If StringInStr($CmdLine[1], "/L") Then Exit MsgBox($MB_OK, @ScriptName, _ListVoices())
        If StringInStr($CmdLine[1], "/source") Then Exit _ShowSource("txt")
        If StringInStr($CmdLine[1], "/?") = 1 Or StringInStr($CmdLine[1], "-?") = 1 Or StringInStr($CmdLine[1], "/h") = 1 Or StringInStr($CmdLine[1], "-h") = 1 Then Exit _ShowHelp()
        If StringInStr($CmdLine[1], "sayhelp") Then Exit _SayHelp()
        If StringInStr($CmdLine[1], "kill") Then
            Local $aP = ProcessList(@ScriptName)
            Local $iP = $aP[0][0] - 1
            If $iP > 0 Then
;               Local $sT = "Killing " & $iP & @ScriptName
;               _Splash($sT & " process(es)")
                _Splash("Killing " & StringTrimRight(@ScriptName, 4))
                Sleep(1000)
                SplashOff()
                While ProcessClose(@ScriptName)
                    Sleep(100)
                WEnd
                Exit
            Else
                _ExitErr("No running " & StringTrimRight(@ScriptName, 4) & " processes")
            EndIf
        EndIf

        If StringInStr($sCMline, "/i") Then $iFreq = _GetArgValue("/i")
        If StringInStr($sCMline, "-i") Then $iFreq = _GetArgValue("-i")
        If StringInStr($sCMline, "/c") Then $vT12or24 = _GetArgValue("/c")
        If StringInStr($sCMline, "-c") Then $vT12or24 = _GetArgValue("-c")
        If StringInStr($sCMline, "/v") Then $iVol = _GetArgValue("/v")
        If StringInStr($sCMline, "-v") Then $iVol = _GetArgValue("-v")
        If StringInStr($sCMline, "/q") Or StringInStr($sCMline, "-q") Then $bQuiet = 1
        If StringInStr($sCMline, "/qq") Or StringInStr($sCMline, "-qq") Then $bQuiet = 0
        If StringInStr($sCMline, "/t") Or StringInStr($sCMline, "-t") Then
            $bTimeOnly = 1
            $bSayAMPM = 0
        EndIf
        If StringInStr($sCMline, "/r") Then $iRate = _GetArgValue("/r")
        If StringInStr($sCMline, "-r") Then $iRate = _GetArgValue("-r")
        Local $sU = "H"
        If StringInStr($sCMline, "/u ") Then $sU = _GetArgValue("/u")
        If StringInStr($sCMline, "-u ") Then $sU = _GetArgValue("-u")
        If StringInStr($sU, "=") Then
            Local $aU = StringSplit($sU, "=")
            $sUnits = $aU[1]
            If $aU[0] > 1 Then $iStop = $aU[2]
            If Not $iStop Then $iStop = 0
            Switch $sU
                Case "S"
                    $sUnits = "seconds"
                Case "M"
                    $sUnits = "minutes"
                Case "H"
                    $sUnits = "hours"
                Case "D"
                    $sUnits = "days"
                Case "W"
                    $sUnits = "weeks"
                Case "T"
                    $sUnits = "months"
                Case "Y"
                    $sUnits = "years"
            EndSwitch
        EndIf
        If StringInStr($sCMline, "/usefile") Then $sFini = _GetArgValue("/usefile")
        If StringInStr($sCMline, "-usefile") Then $sFini = _GetArgValue("-usefile")
    EndIf
; --------------------

If $bTimeOnly = 1 Then
    $sHi = ""
#cs
    $sIntro = ""
    $sHowFreq1 = ""
    $sHowFreq5 = ""
    $sHowFreq10 = ""
    $sHowFreq15 = ""
    $sHowFreq30 = ""
    $sHowFreq60 = ""
    $sHowFreqCustom = ""
#ce
    $sPrefix = ""
    $sPrefix1 = ""
    $sMidnight = ""
    $sMidday = ""
    $sPause = ""
    $sResume = ""
    $sStopSay = ""
    $sBye = ""
EndIf

#cs; debug
;Exit MsgBox(0,"", _
MsgBox(0,"", _
"$bTimeOnly = " & $bTimeOnly & @CRLF & _
"$iFreq = " & $iFreq & @CRLF & _
"$vT12or24 = " & $vT12or24 & @CRLF & _
"$sVoice = " & $sVoice & @CRLF & _
"$iVol = " & $iVol & @CRLF & _
"$iRate = " & $iRate & @CRLF & _
"$iStop = " & $iStop & @CRLF & _
"$sUnits = " & $sUnits & @CRLF & _
"$bQuiet = " & $bQuiet & @CRLF & _
"$iDisplay = " & $iDisplay & @CRLF)
#ce; debug

; Failsafe defaults
    If Not StringIsDigit(String($iFreq)) Then $iFreq = 15
    If Not $vT12or24 = "24" Then $vT12or24 = 12
    If Not StringIsDigit(String($iVol)) Then $iVol = 80
    If $iVol > 100 Then $iVol = 100
    If String(Abs($iRate)) <> String($iRate) Then $iRate = 0
    If $iRate < -10 Or $iRate > 10 Then $iRate = 0
    If Not StringIsDigit(String($iStop)) Then $iStop = 0
    If Not StringInStr("|S|M|H|D|W|T|Y|", ("|" & $sUnits & "|")) Then $sUnits = "H"

    Local $sAllFreqs = "|1|5|10|15|30|60|", $sHowFreq = ""
    If StringInStr($sAllFreqs, "|" & $iFreq & "|") < 1 Then $bCanned = 0
    If Not $bCanned Then
        If StringIsDigit(String($iFreq)) Then
            $iFreq = Int($iFreq)
            If $iFreq < 1 Then Exit _ShowHelp()
        Else
        EndIf
    EndIf

    If $bCanned Then
        Switch $iFreq
            Case 1
                $sHowFreq = $sHowFreq1
            Case 5
                $sHowFreq = $sHowFreq5
            Case 10
                $sHowFreq = $sHowFreq10
            Case 15
                $sHowFreq = $sHowFreq15
            Case 30
                $sHowFreq = $sHowFreq30
            Case 60
                $sHowFreq = $sHowFreq60
            EndSwitch
    Else
        $sHowFreq = $iFreq & " " & $sHowFreqCustom
    EndIf

    If Not $sFini2 Then
        If Not $bArgs Then WriteTTini()
    EndIf

    If $bQuiet = 0 Then
        If $sIntro Then _SayTxt($sIntro & " " & $sHowFreq)
    Else
        $sHowFreq = StringReplace($sHowFreq, "minnit", " minute")
        $sHowFreq = StringReplace($sHowFreq, "'", "h")
        If StringLen($sHowFreq) > 10 Then $sHowFreq = @CRLF & $sHowFreq
        If $sHowFreq Then
            If $sIntro Then _Splash($sIntro & " " & $sHowFreq)
        EndIf
        Sleep(2000)
        SplashOff()
    EndIf

    If $iStop > 0 Then $iIter = _SetTimer($iStop, $sUnits)

    If $bCanned Then
        While 1
            Do
                Sleep(200)
            Until @SEC = 00 And Mod(@MIN, $iFreq) = 0
            _SayTime($vT12or24)
            _CheckTimer()
            Sleep(45000)
        WEnd
    Else ; Custom interval
        Local $iMin, $iNext
        While 1
            $iMin = @MIN
            _CheckTimer()
            If $iFreq = 60 Then Sleep(60500)
            $iNext = StringFormat("%02i", Mod($iMin + $iFreq, 60))
            Do
                Sleep(100)
            Until Int(@MIN) = Int($iNext) And Int(@SEC) = 0
            _SayTime($vT12or24)
        WEnd
    EndIf

EndFunc   ;==>MAIN
; ---------------

Func _GetArgValue($sArg)
; Get value (if any) following /SWitch (arg)
    Local $sVal = ""
    If $CmdLine[0] > 1 Then
        For $i = 1 To $CmdLine[0]
            If $sArg = $CmdLine[$i] Then
                If $CmdLine[0] > $i Then
                    $sVal = StringStripWS($CmdLine[$i + 1], 1)
                    If StringInStr($sVal, "/") = 1 Or StringInStr($sVal, "-") = 1 Then
                        If StringInStr($sArg, "r") = 2 And StringInStr($sVal, "-") And StringIsDigit(StringTrimLeft($sVal, 1)) Then
                            Return $sVal
                        Else
                            Return ""
                        EndIf
                    EndIf
                EndIf
            EndIf
        Next
    EndIf
    Return $sVal
EndFunc  ;==>_GetArgValue

Func _SetTimer($iN, $sUnits = "H")
    If StringLen($sUnits) > 1 Then
        $sUnits = StringLeft($sUnits, 3)
        If $sUnits = "mon" Then $sUnits = "T"
        $sUnits = StringUpper(StringLeft($sUnits, 1))
    EndIf
    Local $iM = 0
    Switch $sUnits
        Case "S"
            $iM = 0.16
        Case "M"
            $iM = 1
        Case "H"
            $iM = 60
        Case "D"
            $iM = 1440
        Case "W"
            $iM = 10080
        Case "T"
            $iM = 43200
        Case "Y"
            $iM = 525600
    EndSwitch
    Return Ceiling(($iM * $iN) / $iFreq)
EndFunc   ;==>_SetTimer

Func _CheckTimer()
    If $iIter > -1 Then $iIter -= 1
    If $iIter = 0 Then Exit MsgBox($MB_OK, StringTrimRight(@ScriptName, 4), StringTrimRight(@ScriptName, 4) & " quitting...", 5)
    Return
EndFunc   ;==>_CheckTimer

Func _ExitErr($sMg, $iSecs = 0)
    Exit MsgBox($MB_OK + $MB_ICONERROR, @ScriptName, $sMg, $iSecs)
EndFunc   ;==>_ExitErr

Func _IniFileRead($sVarName, $sSection, $sKey, $sDefault)
#cs; -----------------------------------------------
     IniRead with default text encoding
     @error codes:
     1 = Variable $sVarName Not Declared
     2 = Error reading contents of $sVarName
     3 = Section not found
     4 = Key not found
     5 = Key not found in section
#ce; -----------------------------------------------
    If Not IsDeclared($sVarName) Then
        If $sDefault Then
            Return $sDefault
        Else
            Return SetError(1, "Variable " & $sVarName & " is not declared", "")
        EndIf
    EndIf
    Local $sFc = Eval($sVarName)
    If Not $sFc Then
        If $sDefault Then
            Return $sDefault
        Else
            Return SetError(2, "Error reading INI file contents", "")
        EndIf
    EndIf
    Local $sCrLf = @LF
    $sFc = StringReplace($sFc, @CRLF, $sCrLf)
    Local $iXsec = StringInStr(StringUpper($sFc), $sCrLf & "[" & StringUpper($sSection) & "]")
    If $iXsec < 1 Then
        If $sDefault Then
            Return $sDefault
        Else
            Return SetError(3, "Section not found", "")
        EndIf
    EndIf
    $iXsec += StringLen($sCrLf & "[" & StringUpper($sSection) & "]")
    Local $sSecC = $sCrLf & StringTrimLeft($sFc, $iXsec)
    If StringInStr($sSecC, $sCrLf & "[") And StringInStr($sSecC, "]" & $sCrLf) > StringInStr($sSecC, $sCrLf & "[") Then _
$sSecC = StringTrimRight($sSecC, StringLen($sSecC) - StringInStr($sSecC, $sCrLf & "["))
    If Not StringInStr(StringUpper($sSecC), StringUpper($sKey) & "=") Then
        If $sDefault Then
            Return $sDefault
        Else
            Return SetError(4, "Key not found", "")
        EndIf
    EndIf
    Local $sVal0 = StringTrimLeft($sSecC, StringInStr($sSecC, $sCrLf & $sKey & "="))
    $sVal0 = StringTrimRight($sVal0, 1 + StringLen($sVal0) - StringInStr($sVal0, String($sCrLf)))
    Local $sValue = StringTrimLeft($sVal0, StringInStr($sVal0, "="))
    If Not $sValue Then $sValue = $sDefault
    Return SetError(0, 0, $sValue)
EndFunc  ;==>_IniFileRead

Func _IniFileReadFile($sFn)
#cs; ------------------------------------------------
     Read INI file contents into a (string) variable
     @error codes:
     1 = $sVarName Is Not Declared
     2 = Error reading $sVarName
     3 = Section does not exit
     4 = Key does not exit
#ce; ------------------------------------------------
    If Not FileExists($sFn) Then Return SetError(1, 0, "")
    Local $h = FileOpen($sFn)
    If $h = -1 Then Return SetError(2, 0, "")
    Local $sFc = FileRead($h)
    If Not FileClose($h) Then Return SetError(3, 0, "")
    If StringRight($sFc, 1) = Chr(26) Then $sFc = StringTrimRight($sFc, 1)
    Return @CRLF & $sFc
EndFunc  ;==>_IniFileReadFile

Func _ListVoices()
    $oVox = ObjCreate("SAPI.spVoice")
    If @error Then Exit _ExitErr("Error creating SAPI object", 10)
    $oVoices = $oVox.GetVoices()
    Local $sVlist = ""
    For $vName in $oVoices
        $sVlist &= $vName.GetDescription() & @CRLF
    Next
    Return $sVlist
EndFunc  ;==>_ListVoices

Func _PauseVoice($iBeats = 1)
    If StringIsDigit(String($iBeats)) Then
        $iBeats = Int($iBeats)
        Sleep($iBeats * 100)
    EndIf
    Return
EndFunc   ;==>_PauseVoice

Func _SayHelp()
    _SayTxt("Welcome to TalkTock, The Talking Clock.")
    _PauseVoice(1)
    _SayTxt("To get started, command START, space, forward slash, M,I,N, space, TalkTock, Enter. Choose your settings, and click Start.")
    _PauseVoice(1)
    _SayTxt("For command-line help, command TalkTock, space, forward slash, question mark, and hit Enter.")
    _PauseVoice(1)
    _SayTxt("To view and customize all available TalkTock settings, open TalkTock dot I,N,I, in any text editor.")
    _PauseVoice(1)
    _SayTxt("I hope you enjoy TalkTock!")
    Return
EndFunc   ;==>_SayHelp

Func _SayTime($vTime12or24 = 12)
    Local $h = Int(@HOUR)
    Local $sAMPM = ""
    Local $sPostfix = PostfixPairsSet()
    If $vTime12or24 = "12" Then
        If $bSayAMPM Then
            Select
                Case $h = 0
                    If @MIN = "00" Then
                        $sAMPM = $sMidnight
                    Else
                        $sAMPM = "AM"
                    EndIf
                Case $h < 12
                    $sAMPM = "AM"
                Case $h = 12
                    If @MIN = "00" Then
                        $sAMPM = $sMidday
                    Else
                        $sAMPM = "PM"
                    EndIf
                Case Else
                    $sAMPM = "PM"
            EndSelect
        EndIf
        If $h > 11 Then $h = Mod($h, 12)
        If $h = 0 Then $h = 12
    EndIf
    If $sPrefix1 And Int($h) = 1 Then $sPrefix = $sPrefix1
    If Not $sPostfix Then $sPostfix = $sAMPM
    Local $sTime = $sPrefix & " " & $h & ":" & @MIN & " " & $sPostfix
    If $bQuiet > 0 Then
        _Splash($sTime)
        If $iDisplay < 1 Then $iDisplay = 1
        Sleep(Int(1000 * $iDisplay))
        SplashOff()
    Else
        _SayTxt($sTime)
    EndIf
    Return
EndFunc   ;==>_SayTime

Func _SayTxt($sIn)
; Text-to-Speech
    Local $iRC = -1
    If $sIn Then
        $oVox.Speak($sIn)
        $iRC = StringLen($sIn)
    EndIf
    Return $iRC
EndFunc   ;==>_SayTxt

Func _ShowHelp()
    MsgBox($MB_OK, @ScriptName & " - Talking Clock", $sHelp)
EndFunc   ;==>_ShowHelp

Func _ShowSource($postfx) ; Show source code
    Local $Ext
    If Not $postfx Then
        $Ext = "txt"
    Else
        $Ext = $postfx
    EndIf
    Local $TmpFile = @TempDir & "\ausource." & $Ext
    If FileExists($TmpFile) Then
        If FileGetAttrib($TmpFile) = "R" Then FileSetAttrib($TmpFile, "-R")
    EndIf
    Select
        Case $Ext = "txt"
            FileInstall("X:\ausource.txt", $TmpFile, 1)
        Case $Ext = "pdf"
        ;FileInstall("X:\ausource.pdf", $TmpFile, 1)
    EndSelect
    Sleep(50)
    ShellExecute($TmpFile, "", @TempDir, "open")
EndFunc   ;==>_ShowSource

Func _Splash($sTxt)
    SplashTextOn(@ScriptName, $sTxt, 650, 150, -1, -1, 32, "", 14, 600)
    Return
EndFunc   ;==>_Splash

Func _TmpFile($sDir = @TempDir, $sExt = "tmp", $iLen = 8, $sPre = "")
; Generate a non-existent 8.3 filename
; Returns null string on failure
    Local $aA = StringSplit("ABCDEFGHIJKLMNPQRSTUVWXYZ123456789", "")
    Local $sX = "nul", $itr = 0
    If $sPre Then $iLen -= StringLen($sPre)
    While FileExists($sX)
        $itr += 1
        $sX = $sPre
        For $i = 1 To $iLen
            $sX &= $aA[Random(1, $aA[0])]
        Next
        $sX = $sDir & "\" & $sX & "." & $sExt
        If $itr > 50 Then
            $sX = ""
            ExitLoop
        EndIf
    WEnd
    Return $sX
EndFunc   ;==>_TmpFile

Func _TrayPause()
    If TrayItemGetText($hTrayPA) = $sgPause Then
        TrayItemSetText($hTrayPA, $sgResume)
        If $bQuiet = 0 Then
            _SayTxt($sPause)
        Else
            _Splash($sPause)
            Sleep(1500)
            SplashOff()
        EndIf
    Else
        TrayItemSetText($hTrayPA, $sgPause)
        If $bQuiet = 0 Then
            _SayTxt($sResume)
        Else
            _Splash($sResume)
            Sleep(1500)
            SplashOff()
        EndIf
        Return
    EndIf
    Do
        Sleep(200)
    Until TrayItemGetState($hTrayPA) Or TrayItemGetState($hTrayEX)
EndFunc   ;==>_TrayPause

Func _TrayExit()
    If Not $sFini2 Then
        If Not $bArgs Then WriteTTini()
    EndIf
    If $bQuiet = 0 Then
        _SayTxt($sBye)
    Else
        _Splash($sBye)
        Sleep(1000)
        SplashOff()
    EndIf
    Exit
EndFunc   ;==>_TrayExit

Func PostfixPairsRead()
    $aFParts[0][0] = 0
    Local $sValPt = "", $sValSp = ""
    For $n = 1 To 99
        $sValPt = _IniFileRead("sFiniV", "Language", "Range" & $n, "")
        If $sValPt Then
            $sValSp = _IniFileRead("sFiniV", "Language", "Phrase" & $n, "")
            $aFParts[$n][0] = $sValPt
            $aFParts[$n][1] = $sValSp
        Else
            $aFParts[0][0] = $n - 1
            ExitLoop
        EndIf
    Next
    Return $aFParts
EndFunc   ;==>PostfixPairsRead

Func PostfixPairsSet()
    Local $vTime = String(@HOUR & @MIN)
    Local $sPostfix = "", $aPtt
    If $bTimeOnly = 0 And $aParts[0][0] > 0 Then
        For $z = 1 To $aParts[0][0]
            $aPtt = StringSplit($aParts[$z][0], "-")
            If $vTime >= $aPtt[1] And $vTime <= $aPtt[2] Then ExitLoop
        Next
        $sPostfix = $aParts[$z][1]
    EndIf
    Return $sPostfix
EndFunc   ;==>PostfixPairsSet

Func WriteTTini()
    IniWrite($sFini, "TalkTock", "Interval", $iFreq)
    IniWrite($sFini, "TalkTock", "ClockStyle", $vT12or24)
    IniWrite($sFini, "TalkTock", "SayAMPM", $bSayAMPM)
    If $sVoice = "" Then $sVoice = "default"
    IniWrite($sFini, "TalkTock", "Voice", $sVoice)
    IniWrite($sFini, "TalkTock", "Volume", $iVol)
    IniWrite($sFini, "TalkTock", "TalkRate", $iRate)
    IniWrite($sFini, "TalkTock", "ClockStops", $iStop)
    IniWrite($sFini, "TalkTock", "ClockTimerUnits", $sUnits)
    IniWrite($sFini, "TalkTock", "Quiet", $bQuiet)
    IniWrite($sFini, "TalkTock", "Display", $iDisplay)
EndFunc   ;==>WriteTTini

Func RestartTT()
    Local $hgRE = GUICreate(@ScriptName, 350, 150, -1, -1, $ES_CENTER)
    GUISetState(@SW_HIDE, $hgRE)
    GUICtrlCreateLabel(@ScriptName & " is running. What would you like to do?", 18, 22, 337, 24)
    Local $hgREStart = GUICtrlCreateButton("Restart", 20, 55, 70, -1, $BS_DEFPUSHBUTTON)
    Local $hgREQuit = GUICtrlCreateButton("Quit", 105, 55, 70, -1, -1)
    Local $hgRECancel = GUICtrlCreateButton("Cancel", 190, 55, 70, -1, -1)
;----------
    Local $aTTp = ProcessList(@ScriptName)
    Local $iThis = @AutoItPID
    GUISetState(@SW_SHOW, $hgRE)
    While 1
        Switch GUIGetMsg($hgRE)
            Case $hgREStart
                For $q = 1 To $aTTp[0][0]
                    If $aTTp[$q][1] <> $iThis Then ProcessClose($aTTp[$q][1])
                Next
                GUIDelete($hgRE)
                ExitLoop
            Case $hgREQuit
                For $q = 1 To $aTTp[0][0]
                    If $aTTp[$q][1] <> $iThis Then ProcessClose($aTTp[$q][1])
                Next
                ContinueCase
            Case $hgRECancel
                ContinueCase
            Case $GUI_EVENT_CLOSE
                Exit
        EndSwitch
    WEnd
;----------
EndFunc  ;==>ReStartTT

Settings file (TalkTock.ini):

Settings file for TalkTock.exe, Talking Clock
;
[TalkTock]
;; Interval between time announcements, in minutes
Interval=15
;; 12- or 24-hour clock
ClockStyle=12
;; Say AM/PM? 1=Yes 0=No; applies to 12-hour clock only
SayAMPM=1
;; TTS voice
Voice=default
;Voice=Microsoft George
;; Volume, range 1 to 100
Volume=80
;; Speaking rate, range -10 to 10
TalkRate=0
;; Clock stop timer units
;; S=secs M=mins H=hours D=days W=weeks T=months Y=years
ClockTimerUnits=H
;; Clock stops after how many timer units? (0 = clock never stops)
ClockStops=0
;; Quiet operation, time shown on screen (1=yes 0=no)
Quiet=0
;; Duration, in seconds, of on-screen time display
;; Fractional (decimal) values are allowed (e.g., Display=3.5)
Display=2.5

[Language]
;; Translate the phrases and labels below into your chosen language.
;; Any language with a TTS function (a "Voice") in its language pack
;; should work. To use other languages, edit TalkTock.ini using the
;; UTF-8 character set
;
;; TimeOnly: 1=Yes (phrases set below will NOT be spoken); 0=No
TimeOnly=0
;
; Welcome and Intro messages
;; Comment out (prepend ";") to suppress these messages
onStart=Welcome to TalkTock, the Talking Clock
Intro=The time will be announced every
;
; Interval descriptions
Freq1=minnit
Freq5=5 minutes at the 5-minute mark
Freq10=10 minutes at the 10-minute mark
Freq15=15 minutes on the quarter hour
Freq30=30 minutes on the half hour
Freq60='our on the hour
FreqCustom=minutes
;; Spoken prefix
Prefix=It's
;; No prefix (just announce the time):
;Prefix=
;Prefix=It's
;Prefix=It's now
;Prefix=The time is
;; Singular prefix: Prefix1 defines the singular inflection
;; for "one o'clock" in applicable languages, e.g., Italian
;Prefix1=
;; Postfix at midnight (0000 hours) and midday (1200 hours)
;;  See also Postfix pairs, below
At0000Say=midnight
At1200Say=noon
;
;; Postfix pairs (optional)
;; ------------------------
;; Alternatives to saying "AM/PM" (or equivalent) after the time
;; If time falls within Range, TalkTock says
;;   Phrase after saying the time
;; You can set as many, or as few, of these pairs as you like
;; Note: Range# settings must have content (a time range hhmm-hhmm)
;;       Phrase# settings can be a phrase or empty (say nothing)
;Range1=0000-0000
;Phrase1=Midnight
;Range2=0001-0329
;Phrase2=A.M.
;Range3=0330-1159
;Phrase3=in the morning
;Range4=1200-1200
;Phrase4=Noon
;Range5=1201-1659
;Phrase5=in the afternoon
;Range6=1700-1959
;Phrase6=in the evening
;Range7=2000-2359
;Phrase7=at night
;; ------------------------
;
; Pause/Resume/Stop
;; Comment out (prepend ";") to suppress these messages
onPause=TalkTock paused
onResume=TalkTock resumed
onStop=Goodbye

[GUI_Labels]
Title=TalkTock - Talking Clock
Top=Say the time every
Minute=minute
Minutes=minutes
QuarterHour=quarter hour
HalfHour=half hour
Hour=hour
Hours=hours
CustomLabel=Custom
ClockStyle=Clock style
12-hour_Label=12-hour
24-hour_Label=24-hour
Quiet_label=Time is: 
Speak_label=spoken
Display_label=displayed
ClockStop_Label=Clock stops 
ClockStopsNever_Label= Never
ClockStopsAfter_Label= After 
ClockStopsAfterSecs_Label=secs
ClockStopsAfterMins_Label=mins
ClockStopsAfterHours_Label=hours
ClockStopsAfterDays_Label=days
ClockStopsAfterWeeks_Label=weeks
ClockStopsAfterMons_Label=months
ClockStopsAfterYears_Label=years
Volume_Label=Volume
ClockStop_Label=Clock stops
ClockStopsAfter_Label=After
ClockStopsHours_Label=hours
ClockStopsNever_Label=Never
Start_button=Start
Cancel_button=Cancel
Tray_pause=Pause
Tray_resume=Resume
Tray_exit=Stop

Enjoy!

Edited by CarlD
Update

Share this post


Link to post
Share on other sites
29 minutes ago, argumentum said:

I'd like to run it but the EXE is quite large and the source would not have what it needs to run as expected.
Would you modify the source and include all the files in a ZIP ?

Not sure what mods to the source file you need, but this ZIP should have everything. Please let me know if you need anything else.

Also, if there's a way to make the EXE smaller, I'd like to know about it. I'm already compiling with UPX. Thanks.

Edited by CarlD

Share this post


Link to post
Share on other sites
7 minutes ago, argumentum said:

my compile is less than 900 kb, yours is over 2,000 kb. Maybe I'm missing "source.pdf" ?

You're right, argumentum. I sometimes include a pdf of my source that has syntax highlighting, but I didn't mean to include it here, precisely because it adds so much "weight". I've taken it out now and the compressed EXE is only 740 KB. Many thanks for pointing this out!

Share this post


Link to post
Share on other sites

Hi,

Someone reported this thread with no comments as to why they felt it was necessary to do so - and I can see no reason why a report was required. If you report a thread, please do give the Mods some idea of why you have done so - unless it is so obvious that even we can see it for ourselves!

Thanks for everyone's cooperation.

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
11 hours ago, Melba23 said:

Someone reported this thread ...

That's odd.  Clicked in error, maybe?

Share this post


Link to post
Share on other sites

Today's updates include code economies in the main routine and elsewhere, but no change to how it works.

Share this post


Link to post
Share on other sites

Added option to "splash" the time announcement to the screen (in addition to, not instead of, spoken time). It's best to delete TalkTock.ini before running the new version.

Edited by CarlD

Share this post


Link to post
Share on other sites

Option to splash time to screen is now an alternative to spoken time -- i.e., silent operation. Please delete (or rename) TalkTock.ini before running the new version.

Share this post


Link to post
Share on other sites

Today: Tidied up the source, fixed code-page issues relating to Italian-language examples; added a code window showing the default .INI file, to give a sense of the available options.

Share this post


Link to post
Share on other sites

Latest revisions:

  • Reorganized GUI screen
  • Added option /L to list available voices
  • Added option /S "voice name" to select a voice (can also just edit "Voice=" setting in .INI)

Delete or rename TalkTock.ini before running the new version.

Share this post


Link to post
Share on other sites

Latest revisions:

  • Added user-defined function _IniFileRead() to preserve character encoding of TalkTock.ini settings for Language and GUI Labels. (Func IniRead() imports all settings as Ascii.)
  • TalkTock.ini is English only. Added TockTock.it.ini and TockTock.ru.ini as sample Italian- and Russian-language settings files.

Delete or rename TalkTock.ini before running the new version.

Share this post


Link to post
Share on other sites
  • Fixed error in _IniFileRead()
  • Added options to ListVoices utility. Command ListVoices.exe /? for info.
Edited by CarlD

Share this post


Link to post
Share on other sites
  • Temp file creation error -- fixed
  • GUI screen errors -- fixed
  • Simplified .INI file

 

Edited by CarlD

Share this post


Link to post
Share on other sites

Removed TalkTock.ru.ini (Russian-language settings) from TalkTock.zip. Russian-language clock has stopped working, for some mysterious reason.

Edited by CarlD

Share this post


Link to post
Share on other sites

Tweaks/corrections to GUI screen, func _IniFileRead()

 

Edited by CarlD
Update

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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By UEZ
      Nothing special - just another analogue clock.  -> Read https://en.wikipedia.org/wiki/Swiss_railway_clock for more information.

       
      Requires Windows7+ OS!
       
       
      Widget style GUI:
      ;The Hilfiker / MobaTime Swiss Railway Clock ;Coded by UEZ build 2019-07-07 ;Thanks to Eukalyptus for the _CreateBrushedAluminum() function! #pragma Compile(Icon, "GDI+ Swiss Railway Clock.ico") #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so /pe /rm #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_stripped.au3" #AutoIt3Wrapper_UseX64=n Break(0) #include <GDIPlus.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPISysWin.au3> ProcessSetPriority(@AutoItPID, $PROCESS_LOW) _GDIPlus_Startup() Global $hGUI, $iFPS = 0, $iShowFPS = 0, $bExit Global $iW, $iH, $iX, $iY, $sTitle = "GDI+ Swiss Railway Clock v1.16" $iW = IniRead(@ScriptDir & "\GDI+ Swiss Railway Clock.ini", "Settings", "GUI_Size", 200) $iW = $iW < 100 ? 100 : $iW > 800 ? 800 : $iW $iH = $iW $iX = IniRead(@ScriptDir & "\GDI+ Swiss Railway Clock.ini", "Settings", "GUI_PosX", -1) $iY = IniRead(@ScriptDir & "\GDI+ Swiss Railway Clock.ini", "Settings", "GUI_PosY", -1) Global Const $fRad = ACos(-1) / 180, $fDeg = 180 / ACos(-1), $iTimer = 30, $ULW_ALPHA = 2, $SC_DRAGMOVE = 0xF012, $fDeltaShadow = 20 Global $hBitmap, $hHBitmap, $hCanvas, $hBitmap_Clock, $hBrush_Shadow, $hBrush_Update, $hPen_Update, $fDiameter = $iW, $fShadowAngle, $fMin_next, _ $fRadius = $fDiameter / 2, $fSec, $fMin, $fHr, $fAmplitude = 3, $fSize, $hOld Global $tSize = DllStructCreate($tagSIZE), $tSource = DllStructCreate($tagPOINT), $tBlend = DllStructCreate($tagBLENDFUNCTION) $tSize.X = $iW $tSize.Y = $iH $tBlend.Alpha = 255 $tBlend.Format = 1 Global Const $hScrDC = _WinAPI_GetDC($hGUI), $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) AutoItSetOption("GUIOnEventMode", 1) GDIPlus_SwissRailwayClockWidget() AutoItSetOption("GUIOnEventMode", 0) _GDIPlus_Shutdown() Func GDIPlus_SwissRailwayClockWidget() $bExit = False $hGUI = GUICreate($sTitle, $iW, $iH, $iX, $iY, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED)) GUISetState(@SW_SHOW, $hGUI) ;create canvas elements $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW + $fDeltaShadow, $iH + $fDeltaShadow) $hCanvas = _GDIPlus_ImageGetGraphicsContext($hBitmap) Local Const $iAlpha = 0x0D / $iW * 200 $hBrush_Shadow = _GDIPlus_BrushCreateSolid(BitShift(0x0D + $iAlpha, -24) + 0x202020) $hPen_Update = _GDIPlus_PenCreate(0xFFA02020) $hBrush_Update = _GDIPlus_BrushCreateSolid(0) _GDIPlus_GraphicsSetSmoothingMode($hCanvas, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetPixelOffsetMode($hCanvas, $GDIP_PIXELOFFSETMODE_HIGHQUALITY) $hBitmap_Clock = GenerateClockBg($fDiameter) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit_About") $fMin_next = @MIN GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN") GUIRegisterMsg($WM_TIMER, "Draw") ;$WM_TIMER = 0x0113 Local $iID = DllCall("User32.dll", "uint_ptr", "SetTimer", "hwnd", $hGUI, "uint_ptr", 1, "uint", $iTimer, "ptr", 0)[0] Do If $bExit Then ExitLoop Until Not Sleep(100) ;release resources GUIRegisterMsg($WM_TIMER, "") DllCall("user32.dll", "bool", "KillTimer", "hwnd", $hGUI, "uint_ptr", $iID) GUIRegisterMsg($WM_LBUTTONDOWN, "") _GDIPlus_PenDispose($hPen_Update) _GDIPlus_BrushDispose($hBrush_Shadow) _GDIPlus_BrushDispose($hBrush_Update) _GDIPlus_GraphicsDispose($hCanvas) _GDIPlus_ImageDispose($hCanvas) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_DeleteDC($hMemDC) IniWrite(@ScriptDir & "\GDI+ Swiss Railway Clock.ini", "Settings", "GUI_Size", WinGetPos($hGUI)[2]) IniWrite(@ScriptDir & "\GDI+ Swiss Railway Clock.ini", "Settings", "GUI_PosX", WinGetPos($hGUI)[0]) IniWrite(@ScriptDir & "\GDI+ Swiss Railway Clock.ini", "Settings", "GUI_PosY", WinGetPos($hGUI)[1]) GUIDelete($hGUI) EndFunc ;==>GDIPlus_SwissRailwayClockWidget Func Draw($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam _GDIPlus_GraphicsClear($hCanvas, 0x00000000) _GDIPlus_GraphicsDrawImageRect($hCanvas, $hBitmap_Clock, 0, 0, $fDiameter + $fDeltaShadow, $fDiameter + $fDeltaShadow) UpdateClock($hCanvas, $fDiameter) $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) $hOld = _WinAPI_SelectObject($hMemDC, $hHBitmap) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, DllStructGetPtr($tSize), $hMemDC, DllStructGetPtr($tSource), 0, DllStructGetPtr($tBlend), $ULW_ALPHA) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hHBitmap) EndFunc ;==>Draw Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) Switch $hWnd Case $hGUI _SendMessage($hWnd, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndSwitch EndFunc ;==>_WM_LBUTTONDOWN Func _Exit_About() $bExit = True EndFunc ;==>_Exit_About Func UpdateClock($hGfx, $fDiameter) Static $bBounce = 0, $f = 0 Local $m1 = $fDiameter * 0.015 ;hour $fHr = 30 * (@HOUR + @MIN / 60) _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius) _GDIPlus_GraphicsRotateTransform($hGfx, $fHr) _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius) Local $iWidth1 = $fDiameter * 0.0375, _ $iHeight1 = $fDiameter / 2.5, _ $iWidth12 = $iWidth1 / 2, _ $fPosY = $fDiameter * 0.2, $iWidth2, $iWidth22, $fPosY2 _GDIPlus_BrushSetSolidColor($hBrush_Update, 0xFF101010) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Shadow, _ "float", $fRadius - $iWidth12 + Cos(($fShadowAngle - $fHr) * $fRad) * $m1, _ "float", $fPosY + Sin(($fShadowAngle - $fHr) * $fRad) * $m1, _ "float", $iWidth1, "float", $iHeight1) ;~ DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Update, _ ;~ "float", $fRadius - $iWidth12, _ ;~ "float", $fPosY, _ ;~ "float", $iWidth1, "float", $iHeight1) Local $tPoints = DllStructCreate("float p[8]"), $factor = $iW / 160 ; 1----2 ; | | ; 4----3 ;1 $tPoints.p(1) = $fRadius - $iWidth12 $tPoints.p(2) = $fPosY ;2 $tPoints.p(3) = $tPoints.p(1) + $iWidth1 $tPoints.p(4) = $fPosY ;3 $tPoints.p(5) = $tPoints.p(3) + $factor $tPoints.p(6) = $fPosY + $iHeight1 ;4 $tPoints.p(7) = $tPoints.p(1) - $factor $tPoints.p(8) = $tPoints.p(6) DllCall($__g_hGDIPDll, "int", "GdipFillPolygon", "handle", $hGfx, "handle", $hBrush_Update, _ "struct*", $tPoints, "int", 4, "int", "FillModeAlternate") _GDIPlus_GraphicsResetTransform($hGfx) ;min If $fMin_next <> @MIN Then $bBounce = 1 Switch $bBounce Case 1 $fMin = (6 * Mod(($fMin_next + 1), 60)) + Sin($f * 1.9) * $fAmplitude If $fAmplitude = 0 Then $fMin_next = @MIN $f = 0 $fAmplitude = 3 $bBounce = 0 Else $fAmplitude -= 0.5 $fAmplitude = $fAmplitude <= 0 ? 0 : $fAmplitude $f += 1 EndIf Case Else $fMin = (6 * @MIN) EndSwitch _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius) _GDIPlus_GraphicsRotateTransform($hGfx, $fMin) _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius) $iWidth1 = $fDiameter * 0.03 $iHeight1 = $fRadius $iWidth12 = $iWidth1 / 2 $fPosY = $fDiameter * 0.1 DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Shadow, _ "float", $fRadius - $iWidth12 + Cos(($fShadowAngle - $fMin) * $fRad) * $m1, _ "float", $fPosY + Sin(($fShadowAngle - $fMin) * $fRad) * $m1, _ "float", $iWidth1, "float", $iHeight1) ;~ DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Update, _ ;~ "float", $fRadius - $iWidth12, _ ;~ "float", $fPosY, _ ;~ "float", $iWidth1, "float", $iHeight1) ;1 $tPoints.p(1) = $fRadius - $iWidth12 $tPoints.p(2) = $fPosY ;2 $tPoints.p(3) = $tPoints.p(1) + $iWidth1 $tPoints.p(4) = $fPosY ;3 $tPoints.p(5) = $tPoints.p(3) + $factor $tPoints.p(6) = $fPosY + $iHeight1 ;4 $tPoints.p(7) = $tPoints.p(1) - $factor $tPoints.p(8) = $tPoints.p(6) DllCall($__g_hGDIPDll, "int", "GdipFillPolygon", "handle", $hGfx, "handle", $hBrush_Update, _ "struct*", $tPoints, "int", 4, "int", "FillModeAlternate") _GDIPlus_GraphicsResetTransform($hGfx) ;sec $fSec = 6 * (@SEC * 1.02564 + @MSEC / 1000) If $fSec >= 360 Then $fSec = 0 _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius) _GDIPlus_GraphicsRotateTransform($hGfx, $fSec) _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius) $fPosY = $fDiameter * 0.27 $fPosY2 = $fDiameter * 0.19 $iWidth1 = $fDiameter * 0.0095 $iHeight1 = $fRadius * 1.3 - $fPosY $iWidth12 = $iWidth1 / 2 $iWidth2 = $fDiameter * 0.083333 $iWidth22 = $iWidth2 / 2 ;shadow seconds DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Shadow, _ "float", $fRadius + Cos(($fShadowAngle - $fSec) * $fRad) * $m1, _ "float", $fPosY + Sin(($fShadowAngle - $fSec) * $fRad) * $m1, _ "float", $iWidth1 + $fDiameter * 0.006667, "float", $iHeight1 + $fDiameter * 0.006667) DllCall($__g_hGDIPDll, "int", "GdipFillEllipse", "handle", $hGfx, "handle", $hBrush_Shadow, _ "float", $fRadius - $iWidth22 + Cos(($fShadowAngle - $fSec) * $fRad) * $m1, _ "float", $fPosY2 + Sin(($fShadowAngle - $fSec) * $fRad) * $m1, _ "float", $iWidth2, "float", $iWidth2) ;seconds _GDIPlus_BrushSetSolidColor($hBrush_Update, 0xFFC01010) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Update, _ "float", $fRadius - $iWidth12, _ "float", $fPosY, _ "float", $iWidth1, "float", $iHeight1) DllCall($__g_hGDIPDll, "int", "GdipFillEllipse", "handle", $hGfx, "handle", $hBrush_Update, _ "float", $fRadius - $iWidth22, _ "float", $fPosY2, _ "float", $iWidth2, "float", $iWidth2) _GDIPlus_GraphicsResetTransform($hGfx) ;button in the center DllCall($__g_hGDIPDll, "int", "GdipFillEllipse", "handle", $hGfx, "handle", $hBrush_Update, _ "float", $fRadius - $iWidth1, _ "float", $fRadius - $iWidth1, _ "float", 2 * $iWidth1, "float", 2 * $iWidth1) DllCall($__g_hGDIPDll, "int", "GdipDrawEllipse", "handle", $hGfx, "handle", $hPen_Update, _ "float", $fRadius - $iWidth1, _ "float", $fRadius - $iWidth1, _ "float", 2 * $iWidth1, "float", 2 * $iWidth1) EndFunc ;==>UpdateClock Func GenerateClockBg($fDiameter, $iBGColor = 0xF8FFFFFF) Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($fDiameter + $fDeltaShadow, $fDiameter + $fDeltaShadow), $hGfx = _GDIPlus_ImageGetGraphicsContext($hBitmap), _ $hBrush = _GDIPlus_BrushCreateSolid($iBGColor), $fBorderSize = $fDiameter * 0.03333, _ $hEffect = _GDIPlus_EffectCreateBlur($fDiameter / 50, 1), $hPen = _GDIPlus_PenCreate(0xA0000000, $fBorderSize) _GDIPlus_GraphicsSetSmoothingMode($hGfx, 4) _GDIPlus_GraphicsSetPixelOffsetMode($hGfx, 4) _GDIPlus_GraphicsSetTextRenderingHint($hGfx, 4) Local Const $fSize = $fDiameter * 0.942 - $fBorderSize / 2 Local Const $hLBrush = _GDIPlus_LineBrushCreate($fBorderSize, $fBorderSize, $fSize, $fSize, 0xFCFFFFFF, 0xF8F0F0F0, 3) _GDIPlus_LineBrushSetSigmaBlend($hLBrush, 0.33333) _GDIPlus_LineBrushSetGammaCorrection($hLBrush) Local Const $hMatrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($hMatrix, -$fSize, -$fSize, True) _GDIPlus_MatrixRotate($hMatrix, 90, True) _GDIPlus_MatrixTranslate($hMatrix, $fSize, $fSize, True) _GDIPlus_LineBrushMultiplyTransform($hLBrush, $hMatrix, True) _GDIPlus_MatrixDispose($hMatrix) _GDIPlus_GraphicsFillEllipse($hGfx, $fBorderSize, $fBorderSize, $fSize, $fSize, $hLBrush) ;~ Local Const $hPath = _GDIPlus_PathCreate() ;~ _GDIPlus_PathAddEllipse($hPath, $fBorderSize, $fBorderSize, $fSize, $fSize) ;~ Local $hLBrush = _GDIPlus_PathBrushCreateFromPath($hPath) ;~ _GDIPlus_PathBrushSetCenterColor($hLBrush, 0xF8F0F0FF) ;~ _GDIPlus_PathBrushSetCenterPoint($hLBrush, $fSize * 0.70, $fSize * 0.70) ;~ _GDIPlus_PathBrushSetSurroundColor($hLBrush, 0xFBFFFFFF) ;~ _GDIPlus_PathBrushSetGammaCorrection($hLBrush, True) ;~ _GDIPlus_GraphicsFillPath($hGfx, $hPath, $hLBrush) ;~ _GDIPlus_PathDispose($hPath) Local $fShadow_vx = $fDiameter * 0.0095, $fShadow_vy = $fDiameter * 0.01 $fShadowAngle = ATan($fShadow_vy / $fShadow_vx) * $fDeg If $fShadow_vx < 0 And $fShadow_vy >= 0 Then $fShadowAngle += 180 If $fShadow_vx < 0 And $fShadow_vy < 0 Then $fShadowAngle -= 180 _GDIPlus_GraphicsDrawEllipse($hGfx, $fBorderSize + $fShadow_vx, $fBorderSize + $fShadow_vy, $fSize, $fSize, $hPen) _GDIPlus_BitmapApplyEffect($hBitmap, $hEffect) _GDIPlus_BrushSetSolidColor($hBrush) _GDIPlus_PenSetColor($hPen, 0xF0000000) Local Const $hBitmap_Texture = _CreateBrushedAluminum($fDiameter, $fDiameter, $fShadowAngle) Local Const $hTexture = _GDIPlus_TextureCreate($hBitmap_Texture) DllCall($__g_hGDIPDll, "int", "GdipSetPenBrushFill", "ptr", $hPen, "ptr", $hTexture) _GDIPlus_GraphicsDrawEllipse($hGfx, $fBorderSize, $fBorderSize, $fSize, $fSize, $hPen) _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius) _GDIPlus_GraphicsRotateTransform($hGfx, -6) _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius) Local $iWidth1 = $fDiameter * 0.026667, $iHeight1 = $fDiameter / 10, $iWidth12 = $iWidth1 / 2, $fPosY = $fDiameter * 0.083333, _ $iWidth2 = $fDiameter * 0.013333, $iHeight2 = $fDiameter * 0.0416667, $iWidth22 = $iWidth2 / 2 For $i = 0 To 59 _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius) _GDIPlus_GraphicsRotateTransform($hGfx, 6) _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius) Switch Mod($i, 5) Case 0 _GDIPlus_GraphicsFillRect($hGfx, $fRadius - $iWidth12, $fPosY, $iWidth1, $iHeight1, $hBrush) Case Else _GDIPlus_GraphicsFillRect($hGfx, $fRadius - $iWidth22, $fPosY, $iWidth2, $iHeight2, $hBrush) EndSwitch Next _GDIPlus_GraphicsResetTransform($hGfx) Local Const $hBitmap_Logo = _GDIPlus_BitmapCreateFromMemory(_Au3_Icon()) Local Const $hBitmap_Logo_Scaled = _GDIPlus_ImageResize($hBitmap_Logo, $fDiameter * 0.125, $fDiameter * 0.125) Local $aDim = _GDIPlus_ImageGetDimension($hBitmap_Logo_Scaled) _GDIPlus_GraphicsDrawImageRect($hGfx, $hBitmap_Logo_Scaled, $fRadius - $aDim[0] / 2, $fRadius / 2, $aDim[0], $aDim[1]) _GDIPlus_ImageDispose($hBitmap_Logo) _GDIPlus_ImageDispose($hBitmap_Logo_Scaled) Local Const $hFamily = _GDIPlus_FontFamilyCreate("Segoe Script"), $hFont = _GDIPlus_FontCreate($hFamily, $fDiameter * 0.025), $hFormat = _GDIPlus_StringFormatCreate() _GDIPlus_StringFormatSetAlign($hFormat, 1) _GDIPlus_StringFormatSetLineAlign($hFormat, 1) _GDIPlus_BrushSetSolidColor($hBrush, 0xE0000000) _GDIPlus_GraphicsDrawStringEx($hGfx, "Clock coded by" & @CRLF & "UEZ", $hFont, _GDIPlus_RectFCreate($fRadius - $fRadius * 0.2, $fRadius + $fRadius * 0.2, $fRadius * 0.4, $fRadius * 0.4), $hFormat, $hBrush) _GDIPlus_ImageDispose($hBitmap_Texture) _GDIPlus_BrushDispose($hTexture) _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_EffectDispose($hEffect) _GDIPlus_PenDispose($hPen) _GDIPlus_BrushDispose($hBrush) _GDIPlus_BrushDispose($hLBrush) _GDIPlus_GraphicsDispose($hGfx) Return $hBitmap EndFunc ;==>GenerateClockBg Func _CreateBrushedAluminum($iW, $iH, $fLightAngle = 40, $iBlurDist = 12, $fBlurTrans = 0.6666, $fRed = 0.8, $fGreen = 0.9, $fBlue = 1, $iLightColor = 0xF0FFFFFF, $fLightSigma = 0.5, $fLightScale = 0.83) ;coded by Eukalyptus! $iBlurDist = Ceiling($iBlurDist) $iBlurDist += 1 - Mod($iBlurDist, 2) Local $iOverSize = 0 For $i = 1 To $iBlurDist Step 2 $iOverSize += $i + $i + 1 Next Local $iWO = $iW + $iOverSize ;========================================= ; Add Noise ;========================================= Local $iNoiseSize = 40 Local $hBmp_Noise = _GDIPlus_BitmapCreateFromScan0($iNoiseSize, $iNoiseSize) Local $hGfx_Noise = _GDIPlus_ImageGetGraphicsContext($hBmp_Noise) Local $tData = _GDIPlus_BitmapLockBits($hBmp_Noise, 0, 0, $iNoiseSize, $iNoiseSize, BitOR($GDIP_ILMREAD, $GDIP_ILMWRITE), $GDIP_PXF32ARGB) Local $iStride = DllStructGetData($tData, "Stride") Local $iWidth = DllStructGetData($tData, "Width") Local $iHeight = DllStructGetData($tData, "Height") Local $pScan0 = DllStructGetData($tData, "Scan0") Local $tPixel = DllStructCreate("dword[" & $iWidth * $iHeight & "];", $pScan0) Local $iAmp For $row = 0 To $iHeight - 1 For $col = 0 To $iWidth - 1 $iAmp = Random(0, 0xFF, 1) DllStructSetData($tPixel, 1, BitOR(0xFF000000, BitShift($iAmp, -16), BitShift($iAmp, -8), $iAmp), $row * $iWidth + $col + 1) Next Next _GDIPlus_BitmapUnlockBits($hBmp_Noise, $tData) ;========================================= ; Create Full NoiseBitmap ;========================================= Local $hBmp_Full = _GDIPlus_BitmapCreateFromScan0($iWO, $iH) Local $hGfx_Full = _GDIPlus_ImageGetGraphicsContext($hBmp_Full) _GDIPlus_GraphicsSetSmoothingMode($hGfx_Full, 4) _GDIPlus_GraphicsSetInterpolationMode($hGfx_Full, 3) Local $iXOff, $iYOff, $iSizeX, $iSizeY For $y = 0 To $iH Step $iNoiseSize / 2 For $x = 0 To $iWO Step $iNoiseSize / 2 $iXOff = Random(0, $iNoiseSize / 2, 1) $iYOff = Random(0, $iNoiseSize / 2, 1) $iSizeX = $iNoiseSize - $iXOff $iSizeY = $iNoiseSize - $iYOff _GDIPlus_GraphicsDrawImageRectRect($hGfx_Full, $hBmp_Noise, $iXOff, $iYOff, $iSizeX, $iSizeY, $x, $y, $iSizeX, $iSizeY) Next Next _GDIPlus_GraphicsDispose($hGfx_Noise) _GDIPlus_BitmapDispose($hBmp_Noise) ;========================================= ; MotionBlur ;========================================= Local $hBmp_Full2 = _GDIPlus_BitmapCreateFromScan0($iWO, $iH) Local $hGfx_Full2 = _GDIPlus_ImageGetGraphicsContext($hBmp_Full2) _GDIPlus_GraphicsSetSmoothingMode($hGfx_Full2, 4) _GDIPlus_GraphicsSetInterpolationMode($hGfx_Full, 3) Local $tColorMatrix = DllStructCreate("float[5]; float[5]; float[5]; float[5]; float[5];") DllStructSetData($tColorMatrix, 1, 1, 1) DllStructSetData($tColorMatrix, 2, 1, 2) DllStructSetData($tColorMatrix, 3, 1, 3) DllStructSetData($tColorMatrix, 4, $fBlurTrans, 4) DllStructSetData($tColorMatrix, 5, 1, 5) Local $hImgAttrib = _GDIPlus_ImageAttributesCreate() DllCall($__g_hGDIPDll, "int", "GdipSetImageAttributesColorMatrix", "ptr", $hImgAttrib, "int", 1, "int", 1, "struct*", $tColorMatrix, "struct*", 0, "int", 0) For $i = 1 To $iBlurDist Step 2 DllCall($__g_hGDIPDll, "int", "GdipDrawImageRectRect", "ptr", $hGfx_Full2, "ptr", $hBmp_Full, _ "float", $i, "float", 0, "float", $iWO, "float", $iH, _ "float", 0, "float", 0, "float", $iWO, "float", $iH, _ "int", 2, "ptr", $hImgAttrib, "ptr", 0, "ptr", 0) If $i >= $iBlurDist Then DllStructSetData($tColorMatrix, 1, $fRed, 1) DllStructSetData($tColorMatrix, 2, $fGreen, 2) DllStructSetData($tColorMatrix, 3, $fBlue, 3) DllStructSetData($tColorMatrix, 4, 1, 4) DllCall($__g_hGDIPDll, "int", "GdipSetImageAttributesColorMatrix", "ptr", $hImgAttrib, "int", 1, "int", 1, "struct*", $tColorMatrix, "struct*", 0, "int", 0) EndIf DllCall($__g_hGDIPDll, "int", "GdipDrawImageRectRect", "ptr", $hGfx_Full, "ptr", $hBmp_Full2, _ "float", $i + 1, "float", 0, "float", $iWO, "float", $iH, _ "float", 0, "float", 0, "float", $iWO, "float", $iH, _ "int", 2, "ptr", $hImgAttrib, "ptr", 0, "ptr", 0) Next _GDIPlus_ImageAttributesDispose($hImgAttrib) _GDIPlus_GraphicsDispose($hGfx_Full2) _GDIPlus_BitmapDispose($hBmp_Full2) _GDIPlus_GraphicsDispose($hGfx_Full) ;========================================= ; Add Light ;========================================= Local $hBmp_Alu = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local $hGfx_Alu = _GDIPlus_ImageGetGraphicsContext($hBmp_Alu) _GDIPlus_GraphicsSetSmoothingMode($hGfx_Alu, 4) _GDIPlus_GraphicsSetInterpolationMode($hGfx_Alu, 3) _GDIPlus_GraphicsDrawImage($hGfx_Alu, $hBmp_Full, -$iOverSize, 0) _GDIPlus_BitmapDispose($hBmp_Full) Local $tPointF1 = DllStructCreate("float; float;") Local $tPointF2 = DllStructCreate("float; float;") DllStructSetData($tPointF2, 2, $iH * $fLightScale) $aResult = DllCall($__g_hGDIPDll, "int", "GdipCreateLineBrush", "struct*", $tPointF1, "struct*", $tPointF2, "uint", 0, "uint", $iLightColor, "int", 0, "handle*", 0) If @error Or Not IsArray($aResult) Then Return SetError(1, 4, False) Local $hBrush = $aResult[6] _GDIPlus_LineBrushSetSigmaBlend($hBrush, $fLightSigma) _GDIPlus_LineBrushSetGammaCorrection($hBrush) DllCall($__g_hGDIPDll, "int", "GdipRotateLineTransform", "ptr", $hBrush, "float", $fLightAngle, "int", 0) _GDIPlus_GraphicsFillRect($hGfx_Alu, 0, 0, $iW, $iH, $hBrush) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGfx_Alu) Return $hBmp_Alu EndFunc ;==>_CreateBrushedAluminum ;Code below was generated by: 'File to Base64 String' Code Generator v1.20 Build 2018-02-02 Func _Au3_Icon($bSaveBinary = False, $sSavePath = @ScriptDir) Local $Au3_Icon $Au3_Icon &= 'iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAP0ElEQVR4XtWZW4hs6VXHf+v79qWquruquqtvZ/r0uc8540yScTIQQ0JkDOYyGhIkhhAxxhdR8mDAgAg+6FsE9UVffNMH8S0ERAwS1DFeEo3m6owzmUySc+Zc+15VXZd9+dZyp6ro4pDTORlGIfnDn703TW/+//X9v/Wt3i3PPfccP85w/GhBgLqkS23ixhpRfau6bgItIPpRN5Ag0Xl88jYrxu/E+KA492E0vJd44d245BKQ/H8bkAe80wMOEE5HA5c8SpQ822yv/ubW9vnfffyxR3+vs7r6YcS9HewZnP9ZXPwE0Py/NuCBJj65iERvQPybcNFP4JKzuPgq+CeR6GnwV3FJB4juM+mSNj55Ehe97/LFC5947PL2ey5tb755daW1+fiVc295+qk3fuTShfPPPnb10d+J60sfI6o9BbRer4EIaOLis1Nh6dtBfs6ljY82ljqfiNLFX8X597uk/ksrG4/8ftJo/lq62P51XPQOJHoc3DV8egZYxLkLcW3xQ088fvWTj2ysXItjnxRlGY6Ojmxvb98iJwtnz6xeXO80tx+9tP0Rcf6tuHhzLuS1YwmJLiHuslRVbzQbjydJsrXSbl4RIVlpLZ0xM71+e+cbC41a+8zayuVxlo9CCPnX/vslt7S89iEzy4/7R/+MT7+Lhq2V5dbbO63Ftbwog/feDYdDt7e3R71eo9vt2tbWlkZRRC1NFkHWQDpACmQ/bBuVWUyaiN+Kk9oH2q3mO/Ky0HNn1p9sNxeaBpiBmpl3TlTNqouoqkmFoKp5XuT1NKlVFS5ffOXm54ui2EFIr17afudCLV1SM5mBity+fRuAzc1NVC1EkfN3dg+/9e1vf/ePMfssYXz9hzXQJKo/BTyKlovrZ7Y+fPXi1luryubOOeKqPBpKQiilLAMhBAwEw7x3RN9jFImPIhTR8TjPQghFvZY2s7wYpkmc' $Au3_Icon &= 'Ag5ARFBVuXHjBp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TDYdgOdBD3C4h2wcCrx1M/8kn7j2Y/gxwM03Tz2RZdouHo4GLOuA2EGliNBGpY3qM8+uAoeV3MBvjXBucTJ5dfIcwGgIGlIDxOjAx8DrhgQioEdUjxCmmEQDlaDATGTPF+JRKv24Dbp71GX9M8L84Jo46QVTs6gAAAABJRU5ErkJggg==' Local $bString = _WinAPI_Base64Decode($Au3_Icon) If @error Then Return SetError(1, 0, 0) $bString = Binary($bString) If $bSaveBinary Then Local Const $hFile = FileOpen($sSavePath & "\au3-icon2.png", 18) If @error Then Return SetError(2, 0, $bString) FileWrite($hFile, $bString) FileClose($hFile) EndIf Return $bString EndFunc ;==>_Au3_Icon Func _WinAPI_Base64Decode($sB64String) Local $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "ptr", 0, "dword*", 0, "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(1, 0, "") Local $bBuffer = DllStructCreate("byte[" & $aCrypt[5] & "]") $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "struct*", $bBuffer, "dword*", $aCrypt[5], "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(2, 0, "") Return DllStructGetData($bBuffer, 1) EndFunc ;==>_WinAPI_Base64Decode  
      Download: GDI+ Swiss Railway Clock v1.16 (Widget).au3
       
       
      GUI version (discontinued):
      ;the Hilfiker / MobaTime Swiss Railway Clock ;coded by UEZ build 2018-03-01 ;thanks to Eukalyptus for the _CreateBrushedAluminum() function! #Pragma Compile(Icon, "GDI+ Swiss Railway Clock.ico") #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so /pe /rm #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_stripped.au3" #AutoIt3Wrapper_UseX64=n Break(0) #include <GDIPlus.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> ProcessSetPriority(@AutoItPID, $PROCESS_LOW) _GDIPlus_Startup() Global $hGUI, $iFPS = 0, $iShowFPS = 0, $bExit Global Const $iW = 512, $iH = $iW, $iWh = $iW / 2, $iHh = $iH / 2, $sTitle = "GDI+ Swiss Railway Clock v1.1" Global Const $fRad = ACos(-1) / 180, $fDeg = 180 / ACos(-1), $iTimer = 30, $fDeltaShadow = $iW * 0.020 Global $hDC, $hCanvas, $hBitmap_Clock, $hBrush_Shadow, $hBrush_Update, $hPen_Update, $fDiameter = $iW, $hDC_backbuffer, $fShadowAngle, $fMin_next, _ $fRadius = $fDiameter / 2, $fSec, $fMin, $fHr, $fAmplitude = 3 AutoItSetOption("GUIOnEventMode", 1) GDIPlus_SwissRailwayClock() AutoItSetOption("GUIOnEventMode", 0) _GDIPlus_Shutdown() Func GDIPlus_SwissRailwayClock() $bExit = False $hGUI = GUICreate($sTitle, $iW + $fDeltaShadow, $iH + $fDeltaShadow, -1, -1, -1, $WS_EX_TOPMOST) GUISetBkColor(0xFFFFFF, $hGUI) GUISetState(@SW_SHOW, $hGUI) ;~ GUISetCursor(16, 1) ;create canvas elements $hDC = _WinAPI_GetDC($hGUI) Local Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW + $fDeltaShadow, $iH + $fDeltaShadow) $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC) Local Const $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap) $hCanvas = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) $hBrush_Shadow = _GDIPlus_BrushCreateSolid(0x14A0A0A0) $hPen_Update = _GDIPlus_PenCreate(0xFFA02020) $hBrush_Update = _GDIPlus_BrushCreateSolid(0) _GDIPlus_GraphicsSetSmoothingMode($hCanvas, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetPixelOffsetMode($hCanvas, $GDIP_PIXELOFFSETMODE_HIGHQUALITY) $fDiameter = $fDiameter < 128 ? 128 : $fDiameter > 1024 ? 1024 : $fDiameter $hBitmap_Clock = GenerateClockBg($fDiameter) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit_About") $fMin_next = @MIN GUIRegisterMsg($WM_TIMER, "Draw") ;$WM_TIMER = 0x0113 Local $iID = DllCall("User32.dll", "uint_ptr", "SetTimer", "hwnd", $hGUI, "uint_ptr", 1, "uint", $iTimer, "ptr", 0)[0] Do If $bExit Then ExitLoop Until Not Sleep(100) ;release resources GUIRegisterMsg($WM_TIMER, "") DllCall("user32.dll", "bool", "KillTimer", "hwnd", $hGUI, "uint_ptr", $iID) _GDIPlus_PenDispose($hPen_Update) _GDIPlus_BrushDispose($hBrush_Shadow) _GDIPlus_BrushDispose($hBrush_Update) _GDIPlus_GraphicsDispose($hCanvas) _WinAPI_SelectObject($hDC_backbuffer, $DC_obj) _WinAPI_DeleteDC($hDC_backbuffer) _WinAPI_DeleteObject($hHBitmap) _WinAPI_ReleaseDC($hGUI, $hDC) GUIDelete($hGUI) EndFunc ;==>GDIPlus_SwissRailwayClock Func Draw($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam _GDIPlus_GraphicsDrawImageRect($hCanvas, $hBitmap_Clock, 0, 0, $fDiameter + $fDeltaShadow, $fDiameter + $fDeltaShadow) UpdateClock($hCanvas, $fDiameter) _WinAPI_BitBlt($hDC, 0, 0, $iW + $fDeltaShadow, $iH + $fDeltaShadow, $hDC_backbuffer, 0, 0, $SRCCOPY) EndFunc Func _Exit_About() $bExit = True EndFunc ;==>_Exit_About Func UpdateClock($hGfx, $fDiameter) Static $bBounce = 0, $f = 0 Local $m1 = $fDiameter * 0.015 ;hour $fHr = 30 * (@HOUR + @MIN / 60) _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius) _GDIPlus_GraphicsRotateTransform($hGfx, $fHr) _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius) Local $iWidth1 = $fDiameter * 0.0375, _ $iHeight1 = $fDiameter / 2.5, _ $iWidth12 = $iWidth1 / 2, _ $fPosY = $fDiameter * 0.2, $iWidth2, $iWidth22, $fPosY2 _GDIPlus_BrushSetSolidColor($hBrush_Update, 0xFF101010) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Shadow, _ "float", $fRadius - $iWidth12 + Cos(($fShadowAngle - $fHr) * $fRad) * $m1, _ "float", $fPosY + Sin(($fShadowAngle - $fHr) * $fRad) * $m1, _ "float", $iWidth1, "float", $iHeight1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Update, _ "float", $fRadius - $iWidth12, _ "float", $fPosY, _ "float", $iWidth1, "float", $iHeight1) _GDIPlus_GraphicsResetTransform($hGfx) ;min If $fMin_next <> @MIN Then $bBounce = 1 Switch $bBounce Case 1 $fMin = (6 * Mod(($fMin_next + 1), 60)) + Sin($f * 1.9) * $fAmplitude If $fAmplitude = 0 Then $fMin_next = @MIN $f = 0 $fAmplitude = 3 $bBounce = 0 Else $fAmplitude -= 0.5 $fAmplitude = $fAmplitude <= 0 ? 0 : $fAmplitude $f += 1 EndIf Case Else $fMin = (6 * @MIN) EndSwitch _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius) _GDIPlus_GraphicsRotateTransform($hGfx, $fMin) _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius) $iWidth1 = $fDiameter * 0.03 $iHeight1 = $fRadius $iWidth12 = $iWidth1 / 2 $fPosY = $fDiameter * 0.1 DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Shadow, _ "float", $fRadius - $iWidth12 + Cos(($fShadowAngle - $fMin) * $fRad) * $m1, _ "float", $fPosY + Sin(($fShadowAngle - $fMin) * $fRad) * $m1, _ "float", $iWidth1, "float", $iHeight1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Update, _ "float", $fRadius - $iWidth12, _ "float", $fPosY, _ "float", $iWidth1, "float", $iHeight1) _GDIPlus_GraphicsResetTransform($hGfx) ;sec $fSec = 6 * (@SEC * 1.02564 + @MSEC / 1000) If $fSec >= 360 Then $fSec = 0 _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius) _GDIPlus_GraphicsRotateTransform($hGfx, $fSec) _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius) $fPosY = $fDiameter * 0.27 $fPosY2 = $fDiameter * 0.19 $iWidth1 = $fDiameter * 0.0095 $iHeight1 = $fRadius * 1.3 - $fPosY $iWidth12 = $iWidth1 / 2 $iWidth2 = $fDiameter * 0.083333 $iWidth22 = $iWidth2 / 2 ;shadow seconds DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Shadow, _ "float", $fRadius + Cos(($fShadowAngle - $fSec) * $fRad) * $m1, _ "float", $fPosY + Sin(($fShadowAngle - $fSec) * $fRad) * $m1, _ "float", $iWidth1 + $fDiameter * 0.006667, "float", $iHeight1 + $fDiameter * 0.006667) DllCall($__g_hGDIPDll, "int", "GdipFillEllipse", "handle", $hGfx, "handle", $hBrush_Shadow, _ "float", $fRadius - $iWidth22 + Cos(($fShadowAngle - $fSec) * $fRad) * $m1, _ "float", $fPosY2 + Sin(($fShadowAngle - $fSec) * $fRad) * $m1, _ "float", $iWidth2, "float", $iWidth2) ;seconds _GDIPlus_BrushSetSolidColor($hBrush_Update, 0xFFC01010) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Update, _ "float", $fRadius - $iWidth12, _ "float", $fPosY, _ "float", $iWidth1, "float", $iHeight1) DllCall($__g_hGDIPDll, "int", "GdipFillEllipse", "handle", $hGfx, "handle", $hBrush_Update, _ "float", $fRadius - $iWidth22, _ "float", $fPosY2, _ "float", $iWidth2, "float", $iWidth2) _GDIPlus_GraphicsResetTransform($hGfx) ;button in the center DllCall($__g_hGDIPDll, "int", "GdipFillEllipse", "handle", $hGfx, "handle", $hBrush_Update, _ "float", $fRadius - $iWidth1, _ "float", $fRadius - $iWidth1, _ "float", 2 * $iWidth1, "float", 2 * $iWidth1) DllCall($__g_hGDIPDll, "int", "GdipDrawEllipse", "handle", $hGfx, "handle", $hPen_Update, _ "float", $fRadius - $iWidth1, _ "float", $fRadius - $iWidth1, _ "float", 2 * $iWidth1, "float", 2 * $iWidth1) EndFunc Func GenerateClockBg($fDiameter) Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($fDiameter + $fDeltaShadow, $fDiameter + $fDeltaShadow), $hGfx = _GDIPlus_ImageGetGraphicsContext($hBitmap), _ $hBrush = _GDIPlus_BrushCreateSolid(0xFF000000), $fBorderSize = $fDiameter * 0.03333, _ $hEffect = _GDIPlus_EffectCreateBlur($fDiameter / 50, 0), $hPen = _GDIPlus_PenCreate(0xA0000000, $fBorderSize) _GDIPlus_GraphicsSetSmoothingMode($hGfx, 4) _GDIPlus_GraphicsSetPixelOffsetMode($hGfx, 4) _GDIPlus_GraphicsSetTextRenderingHint($hGfx, 4) _GDIPlus_GraphicsClear($hGfx, 0xFFFFFFFF) Local Const $fSize = $fDiameter * 0.95 - $fBorderSize / 2 Local $fShadow_vx = $fDiameter * 0.0095, $fShadow_vy = $fDiameter * 0.01 $fShadowAngle = ATan($fShadow_vy / $fShadow_vx) * $fDeg If $fShadow_vx < 0 And $fShadow_vy >= 0 Then $fShadowAngle += 180 If $fShadow_vx < 0 And $fShadow_vy < 0 Then $fShadowAngle -= 180 _GDIPlus_GraphicsDrawEllipse($hGfx, $fBorderSize + $fShadow_vx, $fBorderSize + $fShadow_vy, $fSize, $fSize, $hPen) _GDIPlus_BitmapApplyEffect($hBitmap, $hEffect) _GDIPlus_PenSetColor($hPen, 0xF0000000) Local Const $hBitmap_Texture = _CreateBrushedAluminum($fDiameter, $fDiameter, $fShadowAngle) Local Const $hTexture = _GDIPlus_TextureCreate($hBitmap_Texture) DllCall($__g_hGDIPDll, "int", "GdipSetPenBrushFill", "ptr", $hPen, "ptr", $hTexture) _GDIPlus_GraphicsDrawEllipse($hGfx, $fBorderSize, $fBorderSize, $fSize, $fSize, $hPen) _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius) _GDIPlus_GraphicsRotateTransform($hGfx, -6) _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius) Local $iWidth1 = $fDiameter * 0.026667, $iHeight1 = $fDiameter / 10, $iWidth12 = $iWidth1 / 2, $fPosY = $fDiameter * 0.083333, _ $iWidth2 = $fDiameter * 0.013333, $iHeight2 = $fDiameter * 0.0416667, $iWidth22 = $iWidth2 / 2 For $i = 0 to 59 _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius) _GDIPlus_GraphicsRotateTransform($hGfx, 6) _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius) Switch Mod($i, 5) Case 0 _GDIPlus_GraphicsFillRect($hGfx, $fRadius - $iWidth12, $fPosY, $iWidth1, $iHeight1, $hBrush) Case Else _GDIPlus_GraphicsFillRect($hGfx, $fRadius - $iWidth22, $fPosY, $iWidth2, $iHeight2, $hBrush) EndSwitch Next _GDIPlus_GraphicsResetTransform($hGfx) Local Const $hBitmap_Logo = _GDIPlus_BitmapCreateFromMemory(_Au3_Icon()) Local Const $hBitmap_Logo_Scaled = _GDIPlus_ImageResize($hBitmap_Logo, $fDiameter * 0.08, $fDiameter * 0.08) Local $aDim = _GDIPlus_ImageGetDimension($hBitmap_Logo_Scaled) _GDIPlus_GraphicsDrawImageRect($hGfx, $hBitmap_Logo_Scaled, $fRadius - $aDim[0] / 2, $fRadius / 1.75, $aDim[0], $aDim[1]) _GDIPlus_ImageDispose($hBitmap_Logo) _GDIPlus_ImageDispose($hBitmap_Logo_Scaled) Local Const $hFamily = _GDIPlus_FontFamilyCreate("Segoe Script"), $hFont = _GDIPlus_FontCreate($hFamily, $fDiameter * 0.025), $hFormat = _GDIPlus_StringFormatCreate() _GDIPlus_StringFormatSetAlign($hFormat, 1) _GDIPlus_StringFormatSetLineAlign($hFormat, 1) ;~ _GDIPlus_BrushSetSolidColor($hBrush, 0xFF400000) _GDIPlus_GraphicsDrawStringEx($hGfx, "Clock by" & @CRLF & "UEZ", $hFont, _GDIPlus_RectFCreate($fRadius - $fRadius * 0.2, $fRadius + $fRadius * 0.2, $fRadius * 0.4, $fRadius * 0.4), $hFormat, $hBrush) _GDIPlus_ImageDispose($hBitmap_Texture) _GDIPlus_BrushDispose($hTexture) _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_EffectDispose($hEffect) _GDIPlus_PenDispose($hPen) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGfx) Return $hBitmap EndFunc Func _CreateBrushedAluminum($iW, $iH, $fLightAngle = 40, $iBlurDist = 12, $fBlurTrans = 0.6666, $fRed = 0.8, $fGreen = 0.9, $fBlue = 1, $iLightColor = 0xF0FFFFFF, $fLightSigma = 0.5, $fLightScale = 0.83) ;coded by Eukalyptus! $iBlurDist = Ceiling($iBlurDist) $iBlurDist += 1 - Mod($iBlurDist, 2) Local $iOverSize = 0 For $i = 1 To $iBlurDist Step 2 $iOverSize += $i + $i + 1 Next Local $iWO = $iW + $iOverSize ;========================================= ; Add Noise ;========================================= Local $iNoiseSize = 40 Local $hBmp_Noise = _GDIPlus_BitmapCreateFromScan0($iNoiseSize, $iNoiseSize) Local $hGfx_Noise = _GDIPlus_ImageGetGraphicsContext($hBmp_Noise) Local $tData = _GDIPlus_BitmapLockBits($hBmp_Noise, 0, 0, $iNoiseSize, $iNoiseSize, BitOR($GDIP_ILMREAD, $GDIP_ILMWRITE), $GDIP_PXF32ARGB) Local $iStride = DllStructGetData($tData, "Stride") Local $iWidth = DllStructGetData($tData, "Width") Local $iHeight = DllStructGetData($tData, "Height") Local $pScan0 = DllStructGetData($tData, "Scan0") Local $tPixel = DllStructCreate("dword[" & $iWidth * $iHeight & "];", $pScan0) Local $iAmp For $row = 0 To $iHeight - 1 For $col = 0 To $iWidth - 1 $iAmp = Random(0, 0xFF, 1) DllStructSetData($tPixel, 1, BitOR(0xFF000000, BitShift($iAmp, -16), BitShift($iAmp, -8), $iAmp), $row * $iWidth + $col + 1) Next Next _GDIPlus_BitmapUnlockBits($hBmp_Noise, $tData) ;========================================= ; Create Full NoiseBitmap ;========================================= Local $hBmp_Full = _GDIPlus_BitmapCreateFromScan0($iWO, $iH) Local $hGfx_Full = _GDIPlus_ImageGetGraphicsContext($hBmp_Full) _GDIPlus_GraphicsSetSmoothingMode($hGfx_Full, 4) _GDIPlus_GraphicsSetInterpolationMode($hGfx_Full, 3) Local $iXOff, $iYOff, $iSizeX, $iSizeY For $y = 0 To $iH Step $iNoiseSize / 2 For $x = 0 To $iWO Step $iNoiseSize / 2 $iXOff = Random(0, $iNoiseSize / 2, 1) $iYOff = Random(0, $iNoiseSize / 2, 1) $iSizeX = $iNoiseSize - $iXOff $iSizeY = $iNoiseSize - $iYOff _GDIPlus_GraphicsDrawImageRectRect($hGfx_Full, $hBmp_Noise, $iXOff, $iYOff, $iSizeX, $iSizeY, $x, $y, $iSizeX, $iSizeY) Next Next _GDIPlus_GraphicsDispose($hGfx_Noise) _GDIPlus_BitmapDispose($hBmp_Noise) ;========================================= ; MotionBlur ;========================================= Local $hBmp_Full2 = _GDIPlus_BitmapCreateFromScan0($iWO, $iH) Local $hGfx_Full2 = _GDIPlus_ImageGetGraphicsContext($hBmp_Full2) _GDIPlus_GraphicsSetSmoothingMode($hGfx_Full2, 4) _GDIPlus_GraphicsSetInterpolationMode($hGfx_Full, 3) Local $tColorMatrix = DllStructCreate("float[5]; float[5]; float[5]; float[5]; float[5];") DllStructSetData($tColorMatrix, 1, 1, 1) DllStructSetData($tColorMatrix, 2, 1, 2) DllStructSetData($tColorMatrix, 3, 1, 3) DllStructSetData($tColorMatrix, 4, $fBlurTrans, 4) DllStructSetData($tColorMatrix, 5, 1, 5) Local $hImgAttrib = _GDIPlus_ImageAttributesCreate() DllCall($__g_hGDIPDll, "int", "GdipSetImageAttributesColorMatrix", "ptr", $hImgAttrib, "int", 1, "int", 1, "struct*", $tColorMatrix, "struct*", 0, "int", 0) For $i = 1 To $iBlurDist Step 2 DllCall($__g_hGDIPDll, "int", "GdipDrawImageRectRect", "ptr", $hGfx_Full2, "ptr", $hBmp_Full, _ "float", $i, "float", 0, "float", $iWO, "float", $iH, _ "float", 0, "float", 0, "float", $iWO, "float", $iH, _ "int", 2, "ptr", $hImgAttrib, "ptr", 0, "ptr", 0) If $i >= $iBlurDist Then DllStructSetData($tColorMatrix, 1, $fRed, 1) DllStructSetData($tColorMatrix, 2, $fGreen, 2) DllStructSetData($tColorMatrix, 3, $fBlue, 3) DllStructSetData($tColorMatrix, 4, 1, 4) DllCall($__g_hGDIPDll, "int", "GdipSetImageAttributesColorMatrix", "ptr", $hImgAttrib, "int", 1, "int", 1, "struct*", $tColorMatrix, "struct*", 0, "int", 0) EndIf DllCall($__g_hGDIPDll, "int", "GdipDrawImageRectRect", "ptr", $hGfx_Full, "ptr", $hBmp_Full2, _ "float", $i + 1, "float", 0, "float", $iWO, "float", $iH, _ "float", 0, "float", 0, "float", $iWO, "float", $iH, _ "int", 2, "ptr", $hImgAttrib, "ptr", 0, "ptr", 0) Next _GDIPlus_ImageAttributesDispose($hImgAttrib) _GDIPlus_GraphicsDispose($hGfx_Full2) _GDIPlus_BitmapDispose($hBmp_Full2) _GDIPlus_GraphicsDispose($hGfx_Full) ;========================================= ; Add Light ;========================================= Local $hBmp_Alu = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local $hGfx_Alu = _GDIPlus_ImageGetGraphicsContext($hBmp_Alu) _GDIPlus_GraphicsSetSmoothingMode($hGfx_Alu, 4) _GDIPlus_GraphicsSetInterpolationMode($hGfx_Full, 3) _GDIPlus_GraphicsDrawImage($hGfx_Alu, $hBmp_Full, -$iOverSize, 0) _GDIPlus_BitmapDispose($hBmp_Full) Local $tPointF1 = DllStructCreate("float; float;") Local $tPointF2 = DllStructCreate("float; float;") DllStructSetData($tPointF2, 2, $iH * $fLightScale) $aResult = DllCall($__g_hGDIPDll, "int", "GdipCreateLineBrush", "struct*", $tPointF1, "struct*", $tPointF2, "uint", 0, "uint", $iLightColor, "int", 0, "handle*", 0) If @error Or Not IsArray($aResult) Then Return SetError(1, 4, False) Local $hBrush = $aResult[6] _GDIPlus_LineBrushSetSigmaBlend($hBrush, $fLightSigma) _GDIPlus_LineBrushSetGammaCorrection($hBrush) DllCall($__g_hGDIPDll, "int", "GdipRotateLineTransform", "ptr", $hBrush, "float", $fLightAngle, "int", 0) _GDIPlus_GraphicsFillRect($hGfx_Alu, 0, 0, $iW, $iH, $hBrush) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGfx_Alu) Return $hBmp_Alu EndFunc ;==>_CreateBrushedAluminum ;Code below was generated by: 'File to Base64 String' Code Generator v1.20 Build 2018-02-02 Func _Au3_Icon($bSaveBinary = False, $sSavePath = @ScriptDir) Local $Au3_Icon $Au3_Icon &= 'iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAP0ElEQVR4XtWZW4hs6VXHf+v79qWquruquqtvZ/r0uc8540yScTIQQ0JkDOYyGhIkhhAxxhdR8mDAgAg+6FsE9UVffNMH8S0ERAwS1DFeEo3m6owzmUySc+Zc+15VXZd9+dZyp6ro4pDTORlGIfnDn703TW/+//X9v/Wt3i3PPfccP85w/GhBgLqkS23ixhpRfau6bgItIPpRN5Ag0Xl88jYrxu/E+KA492E0vJd44d245BKQ/H8bkAe80wMOEE5HA5c8SpQ822yv/ubW9vnfffyxR3+vs7r6YcS9HewZnP9ZXPwE0Py/NuCBJj65iERvQPybcNFP4JKzuPgq+CeR6GnwV3FJB4juM+mSNj55Ehe97/LFC5947PL2ey5tb755daW1+fiVc295+qk3fuTShfPPPnb10d+J60sfI6o9BbRer4EIaOLis1Nh6d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Tdzn7v+b39/U+L889j4VtT8Q+HfOUbL3zq7Ob6J800VlWbfR3W3b193z06/EPEfwoXP+ai+BdWO+0PFEXIq/3wBjAwVGazd29U0q+YFYGghjFF7KDmApVGGQ2PbWOtI1WzIC8Vg1Bp94fdwau37+78KdhzaHgFLbpA4OEgwmzNmPR8RCZDVuj2elG3e/S5NIn/KMuLQyR+Ucv80zs7ey+BbVVinIjUVpcXL816O82613Zd' $Au3_Icon &= 'gMTEOQcCqIo4RlkpVRu2Uk129w8DneWxeO9v3N79l+pCnuVfxvRfCdkLwIDXAPnSf33tU+fOnvktEXNFUUi1af3e3sHXNRQfA746P0+p4eJlxJ9D5I3OR09fPnfml6vD5m6rubCdRC4FAUDNdDTOe977ej2NUjOjdzxgNBwVh73h3/ooGXrvk2w8esE0PI9Nus11oM9rhHzhi//xtpXV1c+msW92uz0ODw6fA/1t4Es8GDEu3kDcFRclP6Ua2nGcbMdxvI4hzossLdQvAeRFeS/Liv00jddUtej2Bs9pKP4TDYdgOdBD3C4h2wcCrx1M/8kn7j2Y/gxwM03Tz2RZdouHo4GLOuA2EGliNBGpY3qM8+uAoeV3MBvjXBucTJ5dfIcwGgIGlIDxOjAx8DrhgQioEdUjxCmmEQDlaDATGTPF+JRKv24Dbp71GX9M8L84Jo46QVTs6gAAAABJRU5ErkJggg==' Local $bString = _WinAPI_Base64Decode($Au3_Icon) If @error Then Return SetError(1, 0, 0) $bString = Binary($bString) If $bSaveBinary Then Local Const $hFile = FileOpen($sSavePath & "\au3-icon2.png", 18) If @error Then Return SetError(2, 0, $bString) FileWrite($hFile, $bString) FileClose($hFile) EndIf Return $bString EndFunc ;==>_Au3_Icon Func _WinAPI_Base64Decode($sB64String) Local $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "ptr", 0, "dword*", 0, "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(1, 0, "") Local $bBuffer = DllStructCreate("byte[" & $aCrypt[5] & "]") $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "struct*", $bBuffer, "dword*", $aCrypt[5], "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(2, 0, "") Return DllStructGetData($bBuffer, 1) EndFunc ;==>_WinAPI_Base64Decode  
      If you want to run in x64 mode please use AutoIt version 3.3.14.3 since the bug in function _GDIPlus_EffectCreate() has been fixed!
       
    • By natedog102
      This small UDF helps you save any text to speech to a .wav file. 
      UDF:
      #AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 #include-once ; #INDEX# ======================================================================================================================= ; Title .........: _TTStoWav() ; AutoIt Version : 3.3.14.2 ; Language ......: English ; Author(s) .....: natedog102 ; Modifiers .....: ; Forum link ....: https://www.autoitscript.com/forum/topic/191573-tts-text-to-speech-to-wav-file-using-sapi/ ; Description ...: TTS to .wav file using SAPI ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _TTStoWav ; Description ...: TTS to .wav file using SAPI ; Syntax.........: _TTStoWav($sText, $sLocation[, $iRate = 1[, $iVolume = 100]]) ; Parameters ....: $sText - String you want converted to a .wav ; $sLocation - Save location + file name, example: "C:\folder\sample.wav" ; $iRate - TTS speak rate between -10 and 10 ; $iVolume - Volume of the TTS between 0 and 100 ; Return values .: Success - Returns one ; Failure - Returns zero ; Author ........: natedog102 ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _TTStoWav($sText, $sLocation, $iRate = 1, $iVolume = 100) $oFileStream = ObjCreate("SAPI.SpFileStream") If @error Then Return 0 EndIf $oFileStream.Format.Type = 39 $oFileStream.Open($sLocation, 3) $oSpeech = ObjCreate('SAPI.SpVoice') If @error Then Return 0 EndIf $oSpeech.AudioOutputStream = $oFileStream $oSpeech.Rate = $iRate $oSpeech.Volume = $iVolume $oSpeech.Speak($sText, 3) $oSpeech.WaitUntilDone(10000) $oFileStream.Close() Return 1 EndFunc ;==>_TTStoWav And here's example usage:
      _TTStoWav("This is a test", "C:\folder-must-exist\sample2.wav") I have never made a UDF before so I don't know if I coded it correctly or if I followed all the recommended guidelines. Apologies if I haven't.
      DOWNLOAD:
       _TTStoWav.au3
    • By golfinhu
      Hi, ppl.

      I am developing a GUI with a fix sidebar, based on the style of windows 10 ... I have 3 problems at the moment.
      1 - How do I put the close and minimize buttons on my window? (I want my window not to have the top bar). I tried to draw with gdi plus but I could not.
      2 - My watch flashes when the time is updated. I tried to do with _GDIPlus_GraphicsDrawString but the strings get overlapped.
      3 - I can not leave my transparent buttons to put them in the sidebar (as in this photo below)

      If anyone can help me I would appreciate it very much.
      thanks a lot
       
      GUI.au3
    • By Chimp
      Just for fun
      Idea from here:
      http://codegolf.stackexchange.com/questions/73259/output-the-current-time-in-ascii-art
      Edit:
      Also added an analogue experimental version in post #11
      #include <GUIConstants.au3> HotKeySet("{ESC}", "End") Local $hClock, $sDelim = ";", $aChar, $sScanLines, $aScanLine[6], $aFont[13] = [ _ ' ___ ; / _ \ ; | | | | ; | | | | ; | |_| | ; \___/ ', _ ; 0 ' __ ; /_ | ; | | ; | | ; | | ; |_| ', _ ; 1 ' ___ ; |__ \ ; ) | ; / / ; / /_ ; |____| ', _ ; 2 ' ____ ; |___ \ ; __) | ; |__ < ; ___) | ; |____/ ', _ ; 3 ' _ _ ; | || | ; | || |_ ; |__ _| ; | | ; |_| ', _ ; 4 ' _____ ; | ____| ; | |__ ; |___ \ ; ___) | ; |____/ ', _ ; 5 ' __ ; / / ; / /_ ; | _ \ ; | (_) | ; \___/ ', _ ; 6 ' ______ ; |____ | ; / / ; / / ; / / ; /_/ ', _ ; 7 ' ___ ; / _ \ ; | (_) | ; > _ < ; | (_) | ; \___/ ', _ ; 8 ' ___ ; / _ \ ; | (_) | ; \__, | ; / / ; /_/ ', _ ; 9 ' ; _ ;(_); _ ;(_); ', _ ; : " ; ; __ _ _ __ ;/ _` | ' \;\__,_|_|_|_|; ", _ ; am " ; ; _ __ _ __ ;| '_ \ ' \;| .__/_|_|_|;|_|"]; pm Global $hAsciiClock = GUICreate("Ascii clock", 390, 80, 10, 10, $WS_POPUPWINDOW, BitOR($WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE, $WS_EX_COMPOSITED)) $hClock = GUICtrlCreateLabel("", 0, 0, 390, 80, -1, $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 7, 0, 0, "Courier new") GUISetState() While 1 $sTime = StringFormat("%02s", @HOUR - (12 * (@HOUR > 12))) & "A" & @MIN & "A" & @SEC & Hex(11 + Number(@HOUR > 12), 1) For $x = 1 To StringLen($sTime) $achar = StringSplit($aFont[Dec(StringMid($sTime, $x, 1))], $sDelim, 3) For $i = 0 To 5 If $x = StringLen($sTime) Then ; last char (am or pm) $aScanLine[$i] = StringFormat('%-65s', $aScanLine[$i]) & $achar[$i] Else $aScanLine[$i] &= $achar[$i] EndIf Next Next For $i = 0 To 5 $sScanLines &= $aScanLine[$i] & @CRLF $aScanLine[$i] = "" Next GUICtrlSetData($hClock, $sScanLines) $sScanLines = "" Sleep(1000) WEnd Func End() If WinActive("[ACTIVE]") = $hAsciiClock Then Exit EndFunc ;==>End  
    • By Kanashius
      This is a simple TTS-UDF.
      If you like it, please leave me a comment, also if you have any suggestions to make it better or if you found bugs.
       
      TTS UDF.au3
×
×
  • Create New...