Global $hours
Global $minutes
Global $C
AdlibRegister("UpdateTime")
AdlibRegister("HOUR")
AdlibRegister("MIN")
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <TrayConstants.au3>
#include <Memory.au3>
#NoTrayIcon
#include <GUIConstantsEx.au3>
Global $X = -1, $Y = -1
If FileExists(@ScriptDir & '\taimerXY.ini') Then
$X = IniRead(@ScriptDir & '\taimerXY.ini', 'POS', 'X', '')
$Y = IniRead(@ScriptDir & '\taimerXY.ini', 'POS', 'Y', '')
EndIf
$Form1_1 = GUICreate("Timer", 325, 106, $X, $Y)
GUISetBkColor(0x2D9C43)
$Label1 = GUICtrlCreateLabel("Время", 8, 6, 76, 20)
GUICtrlSetFont(-1, 14, 700, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Label2", 80, 6, 90, 20)
GUICtrlSetFont(-1, 14, 700, 0, "MS Sans Serif")
$Label3 = GUICtrlCreateLabel("ЧЧ", 8, 50, 28, 25)
GUICtrlSetFont(-1, 14, 700, 0, "MS Sans Serif")
$Input1 = GUICtrlCreateInput("", 8, 28, 65, 23)
$Label4 = GUICtrlCreateLabel("ММ", 80, 50, 38, 25)
GUICtrlSetFont(-1, 14, 700, 0, "MS Sans Serif")
$Input2 = GUICtrlCreateInput("", 80, 28, 73, 23)
$Button1 = GUICtrlCreateButton("Выполнить ", 8, 72, 120, 28)
$Combo1 = GUICtrlCreateCombo("", 168, 28, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Выключение|Вывести сообщение|Звук")
$Label5 = GUICtrlCreateLabel("Текст для сообщения", 135, 53, 188, 24)
GUICtrlSetFont(-1, 12, 700, 0, "MS Sans Serif")
$Input3 = GUICtrlCreateInput("", 145, 75, 169, 21)
GUISetState(@SW_SHOW)
Opt("TrayMenuMode", 3)
$IdMenu = TrayCreateMenu ("Действия")
$iDisplay = TrayCreateItem("Выключить таймер", $IdMenu)
$exit = TrayCreateItem("Выход", $IdMenu)
$SHOW = TrayCreateItem("Развернуть", $IdMenu)
TraySetState($TRAY_ICONSTATE_SHOW)
TraySetToolTip("Timer")
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
$WS = WinGetState($Form1_1)
If Not BitAND($WS, 16) Then
$WP = WinGetPos($Form1_1)
IniWrite(@ScriptDir & '\taimerXY.ini', 'POS', 'X', $WP[0])
IniWrite(@ScriptDir & '\taimerXY.ini', 'POS', 'Y', $WP[1])
EndIf
Exit
Case $Button1
While 1
If GUICtrlRead($Input1) = HOUR() Then
If GUICtrlRead($Input2) = MIN() Then
If GUICtrlRead($Combo1) = "Звук" Then
SoundSetWaveVolume(100)
SoundPlay("C:\2\Готово1.mp3", 1)
Sleep(1000)
If ($C = 1) Or ($C = 0) Then ExitLoop
EndIf
If GUICtrlRead($Combo1) = "Вывести сообщение" Then
$amsg = MsgBox(64,"Информация",GUICtrlRead($Input3))
If $amsg =1 Or $amsg = -1 Then ExitLoop
EndIf
If GUICtrlRead($Combo1) = "Выключение" Then
$downsystem = Shutdown(8)
If $downsystem =1 Or $downsystem = 0 Then ExitLoop
EndIf
EndIf
EndIf
Switch TrayGetMsg()
Case $iDisplay
ExitLoop
Case $exit
Exit
EndSwitch
WEnd
EndSwitch
WEnd
Func UpdateTime()
GUICtrlSetData($Label2,@HOUR & ":" & @MIN & ":" & @SEC)
EndFunc
Func HOUR()
Return @HOUR
EndFunc
Func MIN()
Return @MIN
EndFunc
Func SEC()
Return @SEC
EndFunc