Jump to content

Search the Community

Showing results for tags 'tts'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Location


WWW


Interests

Found 3 results

  1. 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. Links: ReadMe TalkTock.zip (executable, .ini file and ReadMe) Source: #cs -------------------------------------- TalkTock.au3 -- Talking Clock CLD rev.2020-07-08-c (freeware -- no warranties expressed or implied) Usages: (1) TalkTock interval [12|24] [volume] [rate] [[S|M|H|D|W|T|Y=#] [/Q] interval = number of minutes between time announcements 12|24 = 12|24-hour clock (default is 12-hour) volume = volume level (range 1 to 100; default is 80) rate = speaking rate (range -10 to 10; default is 0) x=# = clock stops after # secs|mins|hrs|days|wks|mos|yrs /Q = Quiet: time displayed on screen, not spoken Arguments must be in the order shown above. To skip an argument (i.e., accept the default value), use "." (dot/period/full stop) in its place. For example: TalkTock 5 24 . . H=0 /Q 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|/S "voice name" /L = List available voices /S "voice name" = Set voice to use (quotes are mandatory) (alternatively, edit Voice= setting in TalkTock.ini) (4) TalkTock /source View AutoIt source code -------------------------------------- #ce #include <AutoItConstants.au3> #include <ButtonConstants.au3> #include <Date.au3> #include <FileConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <StaticConstants.au3> #include <TrayConstants.au3> #include <WindowsConstants.au3> #pragma compile(AutoItExecuteAllowed, True) 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) ; Default interval, 12|24, volume, talk rate settings, etc. Local $idFreq = 15 ; Default interval every 15 minutes Local $vdT12or24 = 12 ; 12- or 24-hour time (Clock style) Local $sdVoice = "" ; TTS voice (""=use default voice) Local $idVol = 80 ; Volume (range 0 to 100) Local $idRate = 0 ; Speaking rate (range -10 to 10) Local $idStop = 0 ; Clock stops = 0 (Never) Local $sdUnits = "H" ; Stop clock units (default = H = hours) Local $idDisplay = 0 ; Duration of on-screen time display ; ; 0 = Time is spoken ; --------------------------------------------------------------- Local $bCanned = 1 ; "Canned" or custom interval ; ; Default phrases Local $sdHi = "Welcome to TalkTock, the Talking Clock" Local $sdPause = "TalkTock paused" Local $sdResume = "TalkTock resumed" Local $sdIntro = "The time will be announced every " Local $sdPrefix = "It's" Local $sdPrefix1 = "" Local $bdSayAMPM = 1 Local $sdHowFreq1 = "minnit" ; spelling altered to aid pronunciation Local $sdHowFreq5 = "5 minutes at the 5-minute mark" Local $sdHowFreq10 = "10 minutes at the 10-minute mark" Local $sdHowFreq15 = "15 minutes on the quarter hour" Local $sdHowFreq30 = "30 minutes on the half hour" Local $sdHowFreq60 = "'our on the hour"; pronunciation Local $sdHowFreqCustom = "minutes" Local $sdBye = "Goodbye" ; Default GUI labels Local $sgdTitle = "TalkTock - Talking Clock" Local $sgdTop = "Say the time every" Local $sgdMinute = "minute" Local $sgdMinutes = "minutes" Local $sgdQuarterHour = "quarter hour" Local $sgdHalfHour = "half hour" Local $sgdHour = "hour" Local $sgdHours = "hours" Local $sgdCustom = "Custom" Local $sgdClock = "Clock style" Local $sgd12hr_Label = "12-hour" Local $sgd24hr_label = "24-hour" Local $sgdQuiet_label = "Quiet (time on screen)" Local $sgdExpires = "Clock stops " Local $sgdExpNever = " Never" Local $sgdExpAfter = " After " Local $sgdExpSecs = "secs" Local $sgdExpMins = "mins" Local $sgdExpHours = "hours" Local $sgdExpDays = "days" Local $sgdExpWeeks = "weeks" Local $sgdExpMons = "months" Local $sgdExpYears = "years" Local $sgdVolume_label = "Volume" Local $sgdStart_button = "Start" Local $sgdCancel_button = "Cancel" Local $sgdPause = "Pause" Local $sgdResume = "Resume" Local $sgdExit = "Stop" ; Failsafe assignments Local $sVoice = $sdVoice Local $iFreq = $idFreq Local $vT12or24 = $vdT12or24 If $vT12or24 <> 24 Then $vT12or24 = 12 Local $iVol = $idVol Local $iRate = $idRate Local $iDisplay = $idDisplay Local $iStop = $idStop Local $sUnits = $sdUnits Local $sStopFn = "" Local $sHi = $sdHi Local $sPause = $sdPause Local $sResume = $sdResume Local $sIntro = $sdIntro Local $sPrefix = $sdPrefix Local $sPrefix1 = $sdPrefix1 Local $bSayAMPM = $bdSayAMPM If $vT12or24 = 24 Then $bSayAMPM = 0 Local $sHowFreq1 = $sdHowFreq1 Local $sHowFreq5 = $sdHowFreq5 Local $sHowFreq10 = $sdHowFreq10 Local $sHowFreq15 = $sdHowFreq15 Local $sHowFreq30 = $sdHowFreq30 Local $sHowFreq60 = $sdHowFreq60 Local $sHowFreqCustom = $sdHowFreqCustom Local $sBye = $sdBye ; GUI Labels Local $sgPause = $sgdPause Local $sgResume = $sgdResume Local $sgExit = $sgdExit Local $sgTitle = $sgdTitle Local $sgTop = $sgdTop Local $sgMinute = $sgdMinute Local $sgMinutes = $sgdMinutes Local $sgQuarterHour = $sgdQuarterHour Local $sgHalfHour = $sgdHalfHour Local $sgHour = $sgdHour Local $sgHours = $sgdHours Local $sgCustom = $sgdCustom Local $sgClock = $sgdClock Local $sg12hr_label = $sgd12hr_Label Local $sg24hr_label = $sgd24hr_label Local $sgQuiet_label = $sgdQuiet_label Local $sgExpires = $sgdExpires Local $sgExpNever = $sgdExpNever Local $sgExpAfter = $sgdExpAfter Local $sgExpSecs = $sgdExpSecs Local $sgExpMins = $sgdExpMins Local $sgExpHours = $sgdExpHours Local $sgExpDays = $sgdExpDays Local $sgExpWeeks = $sgdExpWeeks Local $sgExpMons = $sgdExpMons Local $sgExpYears = $sgdExpYears Local $sgVolume_label = $sgdVolume_label Local $sgStart_button = $sgdStart_button Local $sgCancel_button = $sgdCancel_button Local $sHelp = "Usage:" & @CRLF & @CRLF & "TalkTock interval [12|24] [volume] [rate] [S|M|H|D|W|T|Y=#] [/Q]" & @CRLF & " interval = minutes between time announcements (whole number)" & @CRLF & " 12|24 = 12-hour|24-hour time (default is 12)" & @CRLF & " volume, range 1 to 100 (default is 80)" & @CRLF & " speaking rate, range -10 to 10 (default is 0)" & @CRLF & " S|M|H|D|W|T|Y=# clock stops after # secs|mins|hrs|days|wks|mos|yrs" & @CRLF & " (default = H=0 = clock never stops)" & @CRLF & " /Q = quiet: time displayed on screen, not spoken" & @CRLF & @CRLF & "For example: TalkTock 15 24 90 -1 H=8 /Q" & @CRLF & "= tell time every 15 minutes, 24-hour clock, volume 90, speaking rate -1, stop clock after 8 hours, time displayed not spoken" & @CRLF & @CRLF & "Arguments must be stated in the order shown above. To skip an argument (i.e., accept the default value), use ""."" (dot/period/full stop) in its place. For example:" & @CRLF & "TalkTock 5 24 . . H=0 /Q" & @CRLF & "= use default values for volume setting and speaking rate" & @CRLF & @CRLF & "User-selected values are saved in TalkTock.ini" & @CRLF & "Language preferences and other settings can be changed by editing TalkTock.ini in any text editor." & @CRLF & @CRLF & "TalkTock /?|/H|/SayHelp|/Kill" & @CRLF & " /?|/H[elp] = show this on-screen help" & @CRLF & " /SayHelp = speak the help screen" & @CRLF & " /Kill = Kill all running " & "TalkTock.exe processes" & @CRLF & @CRLF & "TalkTock /L|/S ""voice name""" & @CRLF & " /L = List available voices" & @CRLF & " /S ""voice name"" = Set voice to use (quotes are mandatory)" & @CRLF & " (alternatively, edit Voice= setting in TalkTock.ini)" & @CRLF&@CRLF & "TalkTock /source" & @CRLF & " View AutoIt source code" & @CRLF ; Create TalkTock.ini Local $sFini = @ScriptName If StringInStr($sFini, ".") Then $sFini = StringTrimRight($sFini, StringLen($sFini) - StringInStr($sFini, ".", 0, -1) + 1) $sFini = @ScriptDir & "\" & $sFini & ".ini" If Not FileExists($sFini) Then $hIni = FileOpen($sFini, $FO_OVERWRITE + $FO_ANSI) If $hIni > -1 Then Local $sIniC = "[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 & ";; Duration, in seconds, of on-screen time display" & @CRLF & ";; Fractional (decimal) values are allowed (e.g., Display=3.5)" & @CRLF & ";; Display=0 means time is spoken" & @CRLF & "Display=0" & @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 employ other languages, edit TalkTock.ini using the" & @CRLF & ";; UTF-8 character set" & @CRLF& ";; Welcome" & @CRLF & "onStart=" & $sdHi & @CRLF& "Intro=" & $sdIntro & @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 & ";Prefix=The time is" & @CRLF & ";Prefix=It's now" & @CRLF & ";; Say nothing (just announce the time):" & @CRLF & ";Prefix=" & @CRLF & ";; Prefix1 defines the singular inflection for ""one o'clock""" & @CRLF & ";; in applicable languages, e.g., Italian" & @CRLF & ";Prefix1=" & @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 & ";onPause=" & $sdPause & @CRLF & ";onResume=" & $sdResume & @CRLF & ";onStopSay=" & $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 & "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 ; Read values from TalkTock.ini $iFreq = IniRead($sFini, "TalkTock", "Interval", $iFreq) $vT12or24 = IniRead($sFini, "TalkTock", "ClockStyle", $vdT12or24) $bSayAMPM = IniRead($sFini, "TalkTock", "SayAMPM", $bdSayAMPM) $sVoice = IniRead($sFini, "TalkTock", "Voice", $sdVoice) If StringUpper($sVoice) = "DEFAULT" Then $sVoice = "" $iVol = IniRead($sFini, "TalkTock", "Volume", $idVol) $iRate = IniRead($sFini, "TalkTock", "TalkRate", $idRate) $iStop = IniRead($sFini, "TalkTock", "ClockStops", $idStop) $sUnits = IniRead($sFini, "TalkTock", "ClockTimerUnits", $sdUnits) $iDisplay = IniRead($sFini, "TalkTock", "Display", $idDisplay) Global $sFiniV = _IniFileReadFile($sFini) If Not $sFiniV Then _ExitErr("Error reading TalkTock.ini") $sHi = _IniFileRead("sFiniV", "Language", "onStart", $sdHi) $sIntro = _IniFileRead("sFiniV", "Language", "Intro", $sdIntro) $sPause = _IniFileRead("sFiniV", "Language", "onPause", $sdPause) $sResume = _IniFileRead("sFiniV", "Language", "onResume", $sdResume) $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", $sdPrefix) $sPrefix1 = _IniFileRead("sFiniV", "Language", "Prefix1", $sdPrefix1) $sBye = _IniFileRead("sFiniV", "Language", "onStop", $sdBye) ; 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", $sgd24hr_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) ; $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) $hTrayPA = TrayCreateItem($sgPause, -1, 0) $hTrayEX = TrayCreateItem($sgExit, -1, 1) TraySetClick(1) TraySetState($TRAY_ICONSTATE_SHOW) TrayItemSetOnEvent($hTrayPA, "_TrayPause") TrayItemSetOnEvent($hTrayEX, "_TrayExit") ; Postfix pairs: get values Local $aParts[1000][2] $aParts[0][0] = 0 $aParts = PostfixPairsRead() $sFiniV = "" Local $iS = 0 ; seconds counter Local $sDate1, $sDate2, $sTimerFn = "", $iBabyPID = -1 Local $oVox = ObjCreate("SAPI.spVoice") If @error Then _ExitErr("SAPI error") $oVox.Volume = $iVol $oVox.Rate = $iRate $vName = "" If $sVoice Then $oVoices = $oVox.GetVoices() For $vName in $oVoices If StringInStr($vName.GetDescription(), $sVoice) = 1 Then $oVox.Voice = $vName ExitLoop EndIf Next EndIf ; Command-line args, so skip the GUI If $CmdLine[0] Then Exit MAIN() ; GUI interface ; $hgTT = GUICreate($sgTitle, 638, 400, 213, 385, $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) $Label1 = GUICtrlCreateLabel($sgTop & ":", 8, 16, 137, 24) $hgA = GUICtrlCreateCheckbox($sgMinute, 16, 48, 113, 17) If $iFreq = 1 Then GUICtrlSetState($hgA, $GUI_CHECKED) Else GUICtrlSetState($hgA, $GUI_UNCHECKED) EndIf $hgB = GUICtrlCreateCheckbox("5 " & $sgMinutes, 16, 72, 113, 17) If $iFreq = 5 Then GUICtrlSetState($hgB, $GUI_CHECKED) Else GUICtrlSetState($hgB, $GUI_UNCHECKED) EndIf $hgC = GUICtrlCreateCheckbox("10 " & $sgMinutes, 16, 96, 113, 17) If $iFreq = 10 Then GUICtrlSetState($hgC, $GUI_CHECKED) Else GUICtrlSetState($hgC, $GUI_UNCHECKED) EndIf $hgD = GUICtrlCreateCheckbox($sgQuarterHour, 16, 120, 113, 17) If $iFreq = 15 Then GUICtrlSetState($hgD, $GUI_CHECKED) Else GUICtrlSetState($hgD, $GUI_UNCHECKED) EndIf $hgE = GUICtrlCreateCheckbox($sgHalfHour, 16, 144, 113, 17) If $iFreq = 30 Then GUICtrlSetState($hgE, $GUI_CHECKED) Else GUICtrlSetState($hgE, $GUI_UNCHECKED) EndIf $hgF = GUICtrlCreateCheckbox($sgHour, 16, 168, 113, 17) If $iFreq = 60 Then GUICtrlSetState($hgF, $GUI_CHECKED) Else GUICtrlSetState($hgF, $GUI_UNCHECKED) EndIf $hgX = GUICtrlCreateCheckbox($sgCustom & ":", 16, 192, 89, 17) $hgXt = GUICtrlCreateInput("", 96, 192, 41, 28) $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 $Label3 = GUICtrlCreateLabel($sgClock & ":", 180, 16, 79, 24) $hgK = GUICtrlCreateCheckbox($sg12hr_label, 182, 48, 97, 17) If $vT12or24 = 12 Then GUICtrlSetState($hgK, $GUI_CHECKED) Else GUICtrlSetState($hgK, $GUI_UNCHECKED) $bSayAMPM = 0 EndIf $hgL = GUICtrlCreateCheckbox($sg24hr_label, 182, 72, 97, 17) If $vT12or24 = 24 Then GUICtrlSetState($hgL, $GUI_CHECKED) $bSayAMPM = 0 Else GUICtrlSetState($hgL, $GUI_UNCHECKED) EndIf $hgQuiet = GUICtrlCreateCheckbox($sgQuiet_label, 182, 112, 185, 17) If $iDisplay > 0 Then GUICtrlSetState($hgQuiet, $GUI_CHECKED) Else GUICtrlSetState($hgQuiet, $GUI_UNCHECKED) EndIf ; Clock stops $Label5 = GUICtrlCreateLabel($sgExpires & ":", 390, 16, 90, 24) $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 $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 $hgExpAft = GUICtrlCreateInput("", 456, 64, 41, 28) If $iStop > 0 Then GUICtrlSetState($hgExpAft, $GUI_ENABLE) GUICtrlSetData($hgExpAft, $iStop) Else GUICtrlSetState($hgExpAft, $GUI_DISABLE) EndIf $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 $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 $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 $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 $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 $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 $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 $iX = 8 GUICtrlCreateLabel($sgVolume_label, 8, 230) Local $hgV = GUICtrlCreateSlider(8, 255, 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) $hgStart = GUICtrlCreateButton($sgStart_button, 534, 22, 92, 30, $BS_DEFPUSHBUTTON) GUICtrlSetState($hgStart, $GUI_FOCUS) $hgCancel = GUICtrlCreateButton($sgCancel_button, 534, 62, 92, 31) GUISetState(@SW_SHOW) ; #EndRegion ### END Koda GUI section ### If $iDisplay = 0 Then _SayTxt($sHi, $iVol, $iRate) 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 $hgQuiet If $iDisplay > 0 Then GUICtrlSetState($hgQuiet, $GUI_CHECKED) Else GUICtrlSetState($hgQuiet, $GUI_UNCHECKED) EndIf Case $hgV $iVol = GUICtrlRead($hgV) GUICtrlSetState($hgV, $GUI_ENABLE) $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, $iVol, $iRate) WriteTTini() Exit EndSwitch WEnd ; Function definitions ; -------------------- Func MAIN() ; TalkTock If $CmdLine[0] Then If StringInStr($CmdLine[1], "/L") Then Exit MsgBox($MB_OK, @ScriptName & " - List of installed voices", _ListVoices()) If StringInStr($CmdLine[1], "/source") Then Exit _ShowSource("txt") If StringInStr($CmdLine[1], "/S") Then If $CmdLine[0] > 1 Then $sVoice = $CmdLine[2] Else $sVoice = StringTrimLeft($CmdLine[1], 2) EndIf Exit _SetVoice($sVoice) EndIf If StringInStr($CmdLine[1], "?") Then Exit _ShowHelp() If StringInStr($CmdLine[1], "sayhelp") Then Exit _SayHelp() If StringInStr($CmdLine[1], "h") Then Exit _ShowHelp() If StringInStr($CmdLine[1], "kill") Then $aP = ProcessList(@ScriptName) $iP = $aP[0][0] - 1 If Not @error Or $iP > 1 Then $sT = "Killing " & $iP & @ScriptName _Splash($sT & " process(es)") Sleep(1000) SplashOff() While ProcessClose(@ScriptName) Sleep(100) WEnd Exit Else _ExitErr("No running " & @ScriptName & " processes", 3) EndIf EndIf $iFreq = $CmdLine[1] If $CmdLine[0] > 1 Then If $CmdLine[2] = "24" Then $vT12or24 = 24 EndIf If $CmdLine[0] > 2 Then If StringIsDigit($CmdLine[3]) Then If $CmdLine[3] > 0 And $CmdLine[3] < 101 Then $iVol = $CmdLine[3] EndIf EndIf If $CmdLine[0] > 3 Then If $CmdLine[4] > -11 And $CmdLine[4] < 11 Then $iRate = $CmdLine[4] EndIf If $CmdLine[0] > 4 Then $sStop = $CmdLine[5] If StringInStr($sStop, "=") Then $aU = StringSplit($sStop, "=") $sU = StringUpper(StringLeft($aU[1], 1)) 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 $iStop = $aU[2] If Not StringIsDigit($iStop) Then $iStop = 0 EndIf EndIf If $CmdLine[0] > 5 Then If StringInStr(StringUpper($CmdLine[6]), "Q") Then $iDisplay = 2 EndIf EndIf ; 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 = 80 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" #cs; debug Exit MsgBox(0,"", _ "$iFreq = " & $iFreq & @CRLF & _ "$vT12or24 = " & $vT12or24 & @CRLF & _ "$iVol = " & $iVol & @CRLF & _ "$iRate = " & $iRate & @CRLF & _ "$iStop = " & $iStop & @CRLF & _ "$sUnits = " & $sUnits & @CRLF & _ "$iDisplay = " & $iDisplay & @CRLF) #ce; debug 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 Exit _ShowHelp() 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 WriteTTini() If $iDisplay = 0 Then _SayTxt($sIntro & $sHowFreq, $iVol, $iRate) Else $sHowFreq = StringReplace($sHowFreq, "minnit", " minute") If StringLen($sHowFreq) > 10 Then $sHowFreq = @CRLF & $sHowFreq _Splash($sIntro & $sHowFreq) EndIf Sleep(2000) SplashOff() If $iStop > 0 Then $sDate1 = @YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC $sTimerFn = _TmpFile(@TempDir, "au3", 8, "TkTk") $iS = _SetTimer($iStop, $sUnits) $iBabyPID = _StartTimer($iS) EndIf 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 Do Sleep(100) Until @SEC = 00 While 1 $iMin = @MIN _SayTime($vT12or24) _CheckTimer() If $iFreq = 60 Then Sleep(60500) $iNext = Mod($iMin + $iFreq, 60) Do Sleep(100) Until @MIN = $iNext WEnd EndIf EndFunc ;==>MAIN ; --------------- 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 Switch $sUnits Case "S" $iM = 1 Case "M" $iM = 60 Case "H" $iM = 3600 Case "D" $iM = 86400 Case "W" $iM = 604800 Case "T" $iM = 2592000 Case "Y" $iM = 31536000 Case Else $iM = 0 EndSwitch $iN *= $iM Return $iN EndFunc ;==>_SetTimer Func _StartTimer($iSecs) $sFn = $sTimerFn $sFc = "Opt(""TrayIconHide"", 1)" & @CRLF & "$iS = " & $iSecs & @CRLF & "Do" & @CRLF & "Do" & @CRLF & "$iSec = @SEC" & @CRLF & "Sleep(100)" & @CRLF & "Until @SEC <> $iSec " & @CRLF & "$iS -= 1" & @CRLF & "Until $iS < 1" & @CRLF & "Exit" & @CRLF $hT = FileOpen($sFn, 2) If $hT > -1 Then FileWrite($hT, $sFc) FileClose($hT) Else _ExitErr("Error writing temp file") EndIf $iPID = Run(@ScriptFullPath & " /AutoIt3ExecuteScript " & $sFn, @TempDir, @SW_HIDE) Sleep(200) Return $iPID EndFunc ;==>_StartTimer Func _CheckTimer() If $iStop > 0 Then If Not ProcessExists($iBabyPID) Then FileDelete($sTimerFn) $sDate2 = @YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC Local $sDDType = "", $sDDUnits = "" Switch $sUnits Case "S" $sDDType = "s" $sDDUnits = "seconds" Case "M" $sDDType = "n" $sDDUnits = "minutes" Case "H" $sDDType = "h" $sDDUnits = "hour(s)" Case Else $sDDType = "D" $sDDUnits = "day(s)" EndSwitch $vETime = _DateDiff($sDDType, $sDate1, $sDate2) If @error Then $vETime = "[??]" Exit MsgBox($MB_OK, @ScriptName, @ScriptName & " stopped as requested at " & $sDate2 & @CRLF & "Elapsed time: " & $vETime & " " & $sDDUnits, 60) EndIf EndIf EndFunc ;==>_CheckTimer Func _ExitErr($sMg, $iSecs = 0) Exit MsgBox($MB_OK + $MB_ICONERROR, @ScriptName, $sMg, $iSecs) EndFunc ;==>_ExitErr Func _IniFileReadFile($sFn) #cs; ------------------------------------------------ Read INI file contents @error codes: 1 = INI file does not exist 2 = Error opening INI file 3 = Error closing INI file #ce; ------------------------------------------------ If Not FileExists($sFn) Then Return SetError(1, 0, "") $h = FileOpen($sFn) If $h = -1 Then Return SetError(2, 0, "") $sFc = FileRead($h) If Not FileClose($h) Then Return SetError(3, 0, "") Return @CRLF & $sFc EndFunc ;==>_IniFileReadFile 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 in section #ce; ----------------------------------------------- If Not IsDeclared($sVarName) Then Return SetError(1, 0, "") $sFc = Eval($sVarName) If Not $sFc Then Return SetError(2, 0, "") $iXsec = StringInStr(StringUpper($sFc), @CRLF & "[" & StringUpper($sSection) & "]") If $iXsec < 1 Then Return SetError(3, 0, "") $iXsec += StringLen(@CRLF & "[" & StringUpper($sSection) & "]") $sSub = StringUpper(StringTrimLeft($sFc, $iXsec)) $iXkey = StringInStr($sSub, StringUpper($sKey) & "=") If $iXkey < 1 Then Return SetError(4, 0, "") $iXKey += StringLen($sKey & "=") If $iXkey < 1 Then Return SetError(4, 0, "") If StringInStr($sSub, @CRLF & "[") Then If $iXkey > StringInStr($sSub, @CRLF & "[") Then Return SetError(3, 0, "") EndIf $sSub = StringUpper(StringTrimLeft($sFc, $iXsec + $iXkey)) $sValue = StringMid($sFc, $iXsec + $iXkey, StringInStr($sSub, @CRLF)) If Not $sValue Then $sValue = $sDefault Return SetError(0, 0, $sValue) EndFunc ;==>_IniFileRead Func _ListVoices() $oVox = ObjCreate("SAPI.spVoice") If @error Then Exit MsgBox(0, @ScriptName, "Error creating SAPI object") $oVoices = $oVox.GetVoices() $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("Command-Line Help for TalkTock, The Talking Clock. Launch TalkTock from the Windows command line, or from a desk top shortcut. The command is TalkTock, space, interval. Interval means the number of minutes between time announcements.", $iVol, $iRate) _PauseVoice(1) _SayTxt("For example: TalkTock, space, 7, means say the time every 7 minutes. Other options are as follows: TalkTock, space, SayHelp, one word, plays thiss help message. TalkTock, space, question mark, or TalkTock, space, Help, displays help on the screen.", $iVol, $iRate) _PauseVoice(2) _SayTxt("By adding additional command-line arguments, you can choose between eigh-M,,pee-M and 24-hour time. And adjust the volyume and speaking rate. Command TalkTock, space, Help, for details. Enjoy!", $iVol, $iRate) Return EndFunc ;==>_SayHelp Func _SayTime($vTime12or24 = 12) $h = Int(@HOUR) $m = @MIN $sAMPM = "" $sPrefix = $sPrefix $sPostfix = PostfixPairsSet() If $vTime12or24 = "12" Then If $bSayAMPM Then $sAMPM = "A.M." If $h > 11 Then $sAMPM = "P.M." 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 $sTime = $sPrefix & " " & $h & ":" & @MIN & " " & $sPostfix If $iDisplay > 0 Then _Splash($sTime) Sleep(Int(1000 * $iDisplay)) SplashOff() Else _SayTxt($sTime, $iVol, $iRate) EndIf Return EndFunc ;==>_SayTime Func _SayTxt($sIn, $iVolume = 80, $iSpRate = 0) ; Text-to-Speech $iRC = -1 If $sIn Then $oVox.Speak($sIn) $iRC = StringLen($sIn) EndIf Return $iRC EndFunc ;==>_SayTxt Func _SetVoice($sIn) If $sIn Then $oVox = ObjCreate("SAPI.spVoice") If @error Then Exit MsgBox(0, @ScriptName, "SAPI error") $oVoices = $oVox.GetVoices() $sVlist = "|" For $vName in $oVoices $sVlist &= $vName.GetDescription() & "|" Next If Not StringInStr($sVlist, "|" & $sIn) Then Exit MsgBox($MB_OK, @ScriptName, $sIn & " is not an available voice.") Else IniWrite($sFini, "TalkTock", "Voice", $sIn) Exit MsgBox($MB_OK, @ScriptName, @ScriptName & " voice set to """ & $sIn & """ in " & $sFini) EndIf EndIf Return EndFunc ;==>_SetVoice Func _ShowHelp() MsgBox($MB_OK, "TalkTock - Talking Clock", $sHelp) EndFunc ;==>_ShowHelp Func _ShowSource($postfx) ; Show source code If Not $postfx Then $Ext = "txt" Else $Ext = $postfx EndIf $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 $aA = StringSplit("ABCDEFGHIJKLMNPQRSTUVWXYZ123456789", "") $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) _SayTxt($sPause, $iVol, $iRate) Else TrayItemSetText($hTrayPA, $sgPause) _SayTxt($sResume, $iVol, $iRate) Return EndIf Do Sleep(200) Until TrayItemGetState($hTrayPA) Or TrayItemGetState($hTrayEX) EndFunc ;==>_TrayPause Func _TrayExit() WriteTTini() If $iDisplay = 0 Then _SayTxt($sBye, $iVol, $iRate) Else _Splash($sBye) Sleep(1000) SplashOff() EndIf If $iBabyPID > -1 Then ProcessClose($iBabyPID) Sleep(500) EndIf Exit EndFunc ;==>_TrayExit Func PostfixPairsRead() Local $aFParts[1000][2] $aFParts[0][0] = 0 $sValPt = "" $sValSp = "" For $n = 1 To 999 $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() $vTime = String(@HOUR & @MIN) $sPostfix = "" If $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", "Display", $iDisplay) EndFunc ;==>WriteTTini Default settings (TalkTock.ini): [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 ;; Duration, in seconds, of on-screen time display ;; Fractional (decimal) values are allowed (e.g., Display=3.5) ;; Display=0 means time is spoken Display=0 [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 employ other languages, edit TalkTock.ini using the ;; UTF-8 character set ;; Welcome onStart=Welcome to TalkTock, the Talking Clock Intro=The time will be announced every 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 ;Prefix=The time is ;Prefix=It's now ;; Say nothing (just announce the time): ;Prefix= ;; Prefix1 defines the singular inflection for "one o'clock" ;; in applicable languages, e.g., Italian ;Prefix1= ; ;; 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 ;onPause=TalkTock paused ;onResume=TalkTock resumed ;onStopSay=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=Quiet (time on screen) 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!
  2. 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
  3. 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...