Индикаторы выходной мощности передатчиков компании Триада ТВ со звуковым оповещением.
Программа написана на языке AutoIt
#AutoIt3Wrapper_Icon=rtrs3.ico
#NoTrayIcon
#include <IE.au3>
#include <String.au3>
#include <array.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include "_get_text.au3"
#include "_mySleep.au3"
;=============================================================================================================================
$URL_26_user = "http://"
$URL_26_guest = "http://"
$URL_33_user = "http://"
$URL_33_guest = "http://"
$min_power = 1.80
$max_power = 2.20
;=============================================================================================================================
#Region ### START Koda GUI section ### Form=C:\d\AutoIT\SoundAlarm3\PowerSoundAlarm.kxf
$PowerSoundAlarm = GUICreate("PowerSoundAlarm" & " min(" & $min_power & "кВт) | max(" & $max_power & "кВт)", 498, 222, 246, 256)
$Label_26 = GUICtrlCreateLabel("26 ТВК = ", 8, 8, 230, 63)
GUICtrlSetFont(-1, 30, 800, 0, "Arial")
$Label_33 = GUICtrlCreateLabel("33 ТВК = ", 8, 88, 230, 63)
GUICtrlSetFont(-1, 30, 800, 0, "Arial")
$LabelPower_26 = GUICtrlCreateLabel(GetText($URL_26_user) & " кВт", 240, 8, 200, 63)
GUICtrlSetFont(-1, 30, 800, 0, "Arial")
$LabelPower_33 = GUICtrlCreateLabel(GetText($URL_33_user) & " кВт", 240, 88, 200, 63)
GUICtrlSetFont(-1, 30, 800, 0, "Arial")
$on26 = GUICtrlCreateCheckbox("on", 448, 24, 41, 33)
GUICtrlSetState(-1, $GUI_UNCHECKED)
GUICtrlSetColor(-1, 0x000080)
$on33 = GUICtrlCreateCheckbox("on", 448, 104, 41, 33)
GUICtrlSetState(-1, $GUI_UNCHECKED)
GUICtrlSetColor(-1, 0x000080)
$Pic1 = GUICtrlCreatePic("C:\d\AutoIT\SoundAlarm3\RTRS_logo.jpg", 8, 152, 97, 65)
$Label1 = GUICtrlCreateLabel("Комсомольск-на-Амуре", 112, 168, 326, 44)
GUICtrlSetFont(-1, 20, 800, 0, "Arial Narrow")
GUICtrlSetColor(-1, 0x0000FF)
;=============================================================================================================================
;=============================================================================================================================
;$Label_min_power = GUICtrlCreateLabel("minimum power = " & $min_power, 8, 210, 326, 44)
;$Label_min_power = GUICtrlCreateLabel("minimum power = " & $min_power & " | maximum power = " & $max_power, 8, 210, 326, 44)
;GUICtrlSetFont(-1, 10, 800, 0, "Arial Narrow")
;GUICtrlSetColor(-1, 0x000000)
;$Label_min_power = GUICtrlCreateLabel("maximum power = " & $max_power, 8, 230, 326, 44)
;GUICtrlSetFont(-1, 10, 800, 0, "Arial Narrow")
;GUICtrlSetColor(-1, 0x000000)
;Local $idEXIT = GUICtrlCreateButton("EXIT", 10, 10, 85, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
;=============================================================================================================================
ConsoleWrite(@CRLF)
;$Old = GetText($URL)
While true ;mySleep(50)
;------------------------------------------
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
;------------------------------------------
$power_26 = GetText($URL_26_guest)
if $power_26 = 0 then
ConsoleWrite("relogin = 26" & @CRLF)
$power_26 = GetText($URL_26_user)
EndIf
;------------------------------------------
$power_33 = GetText($URL_33_guest)
if $power_33 = 0 then
ConsoleWrite("relogin = 33" & @CRLF)
$power_33 = GetText($URL_33_user)
endif
;------------------------------------------
;? : Select conditionally an expression. e.g. $condition ? $expression1 : $expression2
;($expression1 if $condition is True or $expression2 if False) See the Ternary operator for an example.
;local $out = $power_26
;if $out = 2 then $out = "2.00"
;GUICtrlSetData($LabelPower_26, $power_26 & " кВт")
GUICtrlSetData($LabelPower_26,($power_26=2 ? "2.00" : $power_26) & " кВт")
GUICtrlSetData($LabelPower_33,($power_33=2 ? "2.00" : $power_33) & " кВт")
;------------------------------------------
if $power_26 <= $min_power or $power_26 >= $max_power then
GUICtrlSetBkColor($LabelPower_26 , 0xFF0000)
Else
GUICtrlSetBkColor($LabelPower_26 , $GUI_BKCOLOR_TRANSPARENT)
EndIf
;------------------------------------------
if $power_33 <= $min_power or $power_33 >= $max_power then
GUICtrlSetBkColor($LabelPower_33 , 0xFF0000)
Else
GUICtrlSetBkColor($LabelPower_33 , $GUI_BKCOLOR_TRANSPARENT)
EndIf
;------------------------------------------
$beepkus = false;
;------------------------------------------
if $power_26 <= $min_power or $power_26 >= $max_power then
if BitAND(GUICtrlRead($on26), $GUI_CHECKED) = $GUI_CHECKED then
;beepka();
$beepkus = true;
EndIf
EndIf
;------------------------------------------
if $power_33 <= $min_power or $power_33 >= $max_power then
if BitAND(GUICtrlRead($on33), $GUI_CHECKED) = $GUI_CHECKED then
$beepkus = true;
;beepka();
EndIf
EndIf
;------------------------------------------
#include "exit_event.au3"
ConsoleWrite( "--------------------------------------------------------------------------------" & @CRLF)
WEnd
;=============================================================================================================================
ConsoleWrite( "exit" & @CRLF)
exit
;=============================================================================================================================
Func beepka()
Beep(900, 2000)
EndFunc
;=============================================================================================================================