Hallo,
da ich in letzter Zeit oft auf Twitch unterwegs bin und Streams verpasse habe ich mir ein kleines Script geschrieben welches in einem bestimmten Intervall den Streamstatus von ausgewählten Channel anzeigt.
Die Channel werden in die Text-Datei eingefügt (mit einem Zeilenumbruch als Separator) und anschließend muss nur das Programm gestartet werden.
Die Oberfläche ist sehr simpel gehalten und erklärt sich eigentlich von selbst. Anzeigeeinstellungen (wie z.B. Sound oder Nachricht) können auch im TrayMenu vorgenommen werden!
In der Ini können noch weitere Einstellungen vorgenommen werden.
Das Script benachrichtigt am Anfang für alle Streams und danach nur noch für die die online gekommen sind. Also werdet ihr nicht nach jedem Intervall mit einer Nachricht genervt sondern nur wenn einer neu dazugekommen ist.
Ini-Datei Aufbau
Channelpath gibt den Pfad zur Datei an die die Liste an Streams beinhaltet die ihr abfragen möchtet.
PlaySound ist ein boolscher Wert der angibt ob ein Sound (wenn ein Streamer online gegangen ist) abgespielt wird oder nicht.
ShowMessage ist ein boolscher Wert der angibt ob eine Nachricht angezeigt werden soll (wenn ein Streamer online gegangen ist).
TrayMessage ist ein boolscher Wert der auf 1 gestellt wird wenn ihr das erste mal auf Schließen in der Haupt-GUI drückt. Es wird eine Nachricht angezeigt das TwitchNotify sich ins Tray minimiert hat.
WaitTime ist ein Integer Wert der das Intervall in Minuten angibt.
MessageColor ist ein Farbwert der die Randfarbe der Nachricht angibt.
AutoStart ist ein boolscher Wert der angibt ob TwitchNotify (nur in Version 2) mit Windows gestartet werden soll.
TwitchNotify - Code
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=notification.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <Sound.au3>
#include <WinHttp.au3>
If ProcessList(@ScriptName)[0][0] > 1 Then
MsgBox(48, "Second instance", "An instance of TwitchNotify is already running.")
Exit
EndIf
Opt("GUIOnEventMode", 1)
Opt("TrayOnEventMode", 1)
Opt("TrayMenuMode", 1)
; -------------- Nachrichten GUI --------------------
$hAlertGUI = GUICreate("Alert", 214, 110, @DesktopWidth - 214, @DesktopHeight - 150, 0x80000008)
GUICtrlCreateLabel("", 0, 0, 214, 210)
GUICtrlSetBkColor(-1, IniRead("Settings.ini", "Settings", "MessageColor", 0xFF0000))
$hMessage = GUICtrlCreateEdit("", 2, 2, 210, 106, 6144)
GUICtrlSetFont(-1, 10, 400, 0, "Segoe UI")
GUICtrlCreateLabel("", 514, 110, 0, 0)
GUICtrlSetState(-1, 256)
GUISetState(@SW_HIDE, $hAlertGUI)
; ---------------------------------------------------
; -------------- Tray Items -------------------------
Global $bPlaySound = IniRead("Settings.ini", "Settings", "PlaySound", 0)
Global $bShowMessage = IniRead("Settings.ini", "Settings", "ShowMessage", 0)
$hRecover = TrayCreateItem("TwitchNotify")
TrayItemSetOnEvent(-1, "_RecoverFromTray")
TrayCreateItem("")
$hWhosLive = TrayCreateItem("Who's live?")
TrayItemSetOnEvent(-1, "_WhosLive")
$hSettingsMenu = TrayCreateMenu("Settings")
$hTraySound = TrayCreateItem("Notify with sound", $hSettingsMenu)
TrayItemSetOnEvent(-1, "_PlaySoundTray")
$hTrayMessage = TrayCreateItem("Notify with message", $hSettingsMenu)
TrayItemSetOnEvent(-1, "_ShowMessageTray")
TrayItemSetState($hTraySound, IniRead("Settings.ini", "Settings", "PlaySound", 0) = 1 ? 1 : 4)
TrayItemSetState($hTrayMessage, IniRead("Settings.ini", "Settings", "ShowMessage", 0) = 1 ? 1 : 4)
TrayCreateItem("Exit Program")
TrayItemSetOnEvent(-1, "_ExitProgram")
; ---------------------------------------------------
; --------------- Haupt GUI -------------------------
$hMainGUI = GUICreate("TwitchNotify", 353, 242, 192, 124)
GUISetOnEvent(-3, "_MinimizeToTray")
GUICtrlCreateLabel("_____________________________________________________", 16, 32, 322, 17)
GUICtrlCreateLabel("Channel settings", 16, 16, 119, 25)
GUICtrlSetState(-1, 256)
GUICtrlSetFont(-1, 12, 400, 0, "Segoe UI")
GUICtrlCreateLabel("Channels file:", 24, 64, 67, 17)
GUICtrlSetTip(-1, "Select the file which contains the channel names seperated from each other with a line break.")
$hChannelPath = GUICtrlCreateInput(IniRead("Settings.ini", "Settings", "Channelpath", @ScriptDir & "\channels.txt"), 96, 61, 193, 21)
GUICtrlCreateButton("...", 296, 60, 27, 23)
GUICtrlSetOnEvent(-1, "_SelectPath")
GUICtrlCreateLabel("check every", 24, 96, 63, 17)
$hInterval = GUICtrlCreateInput(IniRead("Settings.ini", "Settings", "WaitTime", 5), 96, 93, 41, 21, 1)
GUICtrlCreateUpdown(-1)
GUICtrlSetOnEvent(-1, "_ChangeInterval")
GUICtrlSetLimit(-1, 60, 1)
GUICtrlCreateLabel("minutes for channel status", 144, 96, 127, 17)
GUICtrlCreateLabel("_____________________________________________________", 16, 152, 322, 17)
GUICtrlCreateLabel("Sound and message settings", 16, 136, 202, 25)
GUICtrlSetFont(-1, 12, 400, 0, "Segoe UI")
$hPlaySound = GUICtrlCreateCheckbox("play sound when channel goes live", 24, 176, 193, 17)
GUICtrlSetState(-1, IniRead("Settings.ini", "Settings", "PlaySound", 0) = 1 ? 1 : 4)
GUICtrlSetOnEvent(-1, "_PlaySound")
$hShowMessage = GUICtrlCreateCheckbox("show message when channel goes live", 24, 200, 209, 17)
GUICtrlSetState(-1, IniRead("Settings.ini", "Settings", "ShowMessage", 0) = 1 ? 1 : 4)
GUICtrlSetOnEvent(-1, "_ShowMessage")
GUISetState(@SW_SHOW, $hMainGUI)
; ---------------------------------------------------
Global $aCalledAlready[0][2]
; ---------------- Abfrage-Routine ------------------
While 1
Global $tmr = TimerInit()
Do
Sleep(100)
Until TimerDiff($tmr) >= Number(GUICtrlRead($hInterval)) * 60000
If FileExists(GUICtrlRead($hChannelPath)) Then
$hSession = _WinHttpOpen("TwitchNotify")
$hConnect = _WinHttpConnect($hSession, "api.twitch.tv", 443)
Local $sStreamList = ""
ReDim $aCalledAlready[UBound(StringRegExp(FileRead(GUICtrlRead($hChannelPath)), "\R", 3)) + 1 - Int(FileRead(GUICtrlRead($hChannelPath)) = "")][2]
For $i = 1 To UBound(StringRegExp(FileRead(GUICtrlRead($hChannelPath)), "\R", 3)) + 1 - Int(FileRead(GUICtrlRead($hChannelPath)) = "")
$sStreamerName = FileReadLine(GUICtrlRead($hChannelPath), $i)
$aCalledAlready[$i - 1][0] = $sStreamerName
If Not StringInStr(_WinHttpSimpleSSLRequest($hConnect, "GET", "kraken/streams/" & $sStreamerName), """stream"":null") Then
$sStreamList &= " " & $sStreamerName
Else
$aCalledAlready[$i - 1][1] = 0
EndIf
Next
_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hSession)
If $sStreamList <> "" Then
For $i = 0 To UBound($aCalledAlready) - 1
If StringInStr($sStreamList, $aCalledAlready[$i][0]) and $aCalledAlready[$i][1] = 0 Then
$aCalledAlready[$i][1] = 1
ElseIf StringInStr($sStreamList, $aCalledAlready[$i][0]) and $aCalledAlready[$i][1] = 1 Then
$sStreamList = StringReplace($sStreamList, " " & $aCalledAlready[$i][0], "")
ElseIf Not StringInStr($sStreamList, $aCalledAlready[$i][0]) and $aCalledAlready[$i][1] = 1 Then
$aCalledAlready[$i][1] = 0
EndIf
Next
If $sStreamList <> "" Then
If $bPlaySound Then
$hSound = _SoundOpen("sound.mp3")
_SoundPlay($hSound, 1)
_SoundClose($hSound)
EndIf
If $bShowMessage Then
GUICtrlSetData($hMessage, "The streamers" & $sStreamList & " are now live.")
GUISetState(@SW_SHOW, $hAlertGUI)
Sleep(5000)
GUISetState(@SW_HIDE, $hAlertGUI)
EndIf
EndIf
EndIf
EndIf
WEnd
; ---------------------------------------------------
Func _WhosLive()
TrayItemSetState($hWhosLive, 4)
$hSession = _WinHttpOpen("TwitchNotify")
$hConnect = _WinHttpConnect($hSession, "api.twitch.tv", 443)
Local $sStreamList = ""
ReDim $aCalledAlready[UBound(StringRegExp(FileRead(GUICtrlRead($hChannelPath)), "\R", 3)) + 1 - Int(FileRead(GUICtrlRead($hChannelPath)) = "")][2]
For $i = 1 To UBound(StringRegExp(FileRead(GUICtrlRead($hChannelPath)), "\R", 3)) + 1 - Int(FileRead(GUICtrlRead($hChannelPath)) = "")
$sStreamerName = FileReadLine(GUICtrlRead($hChannelPath), $i)
$aCalledAlready[$i - 1][0] = $sStreamerName
If Not StringInStr(_WinHttpSimpleSSLRequest($hConnect, "GET", "kraken/streams/" & $sStreamerName), """stream"":null") Then
$sStreamList &= " " & $sStreamerName
Else
$aCalledAlready[$i - 1][1] = 0
EndIf
Next
_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hSession)
If $sStreamList <> "" Then
For $i = 0 To UBound($aCalledAlready) - 1
If StringInStr($sStreamList, $aCalledAlready[$i][0]) Then $aCalledAlready[$i][1] = 1
Next
MsgBox(64, "Who's live?", "The streamers" & $sStreamList & " are live right now.")
Else
MsgBox(48, "Who's live?", "No one in your channel list is currently live.")
EndIf
$tmr = TimerInit()
EndFunc
Func _ChangeInterval()
IniWrite("Settings.ini", "Settings", "WaitTime", GUICtrlRead($hInterval))
EndFunc
Func _PlaySoundTray()
$bPlaySound = BitAND(TrayItemGetState($hTraySound), 1)
GUICtrlSetState($hPlaySound, $bPlaySound ? 1 : 4)
IniWrite("Settings.ini", "Settings", "PlaySound", $bPlaySound)
EndFunc
Func _ShowMessageTray()
$bShowMessage = BitAND(TrayItemGetState($hTrayMessage), 1)
GUICtrlSetState($hShowMessage, $bShowMessage ? 1 : 4)
IniWrite("Settings.ini", "Settings", "ShowMessage", $bShowMessage)
EndFunc
Func _PlaySound()
$bPlaySound = BitAND(GUICtrlRead($hPlaySound), 1)
TrayItemSetState($hTraySound, $bPlaySound ? 1 : 4)
IniWrite("Settings.ini", "Settings", "PlaySound", $bPlaySound)
EndFunc
Func _ShowMessage()
$bShowMessage = BitAND(GUICtrlRead($hShowMessage), 1)
TrayItemSetState($hTrayMessage, $bShowMessage ? 1 : 4)
IniWrite("Settings.ini", "Settings", "ShowMessage", $bShowMessage)
EndFunc
Func _SelectPath()
Local $sPath = FileOpenDialog("Select a file containing the channel names", @ScriptDir, "All Data (*.*)")
If $sPath <> "" Then
GUICtrlSetData($hChannelPath, $sPath)
IniWrite("Settings.ini", "Settings", "Channelpath", $sPath)
EndIf
EndFunc
Func _RecoverFromTray()
TrayItemSetState($hRecover, 4)
GUISetState(@SW_SHOW, $hMainGUI)
EndFunc
Func _MinimizeToTray()
GUISetState(@SW_HIDE, $hMainGUI)
If Not Number(IniRead("Settings.ini", "Settings", "TrayMessage", 0)) Then
IniWrite("Settings.ini", "Settings", "TrayMessage", 1)
TrayTip("Minimized to tray", "TwitchNotify minimized itself into the tray." & @CRLF & "You can exit by selecting the tray item.", 5)
EndIf
EndFunc
Func _ExitProgram()
IniWrite("Settings.ini", "Settings", "Channelpath", GUICtrlRead($hChannelPath))
IniWrite("Settings.ini", "Settings", "PlaySound", BitAND(GUICtrlRead($hPlaySound), 1))
IniWrite("Settings.ini", "Settings", "ShowMessage", BitAND(GUICtrlRead($hShowMessage), 1))
IniWrite("Settings.ini", "Settings", "WaitTime", GUICtrlRead($hInterval))
Exit
EndFunc
Alles anzeigen
TwitchNotify2 - Code
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=notification.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <Sound.au3>
#include <WinHttp.au3>
If ProcessList(@ScriptName)[0][0] > 1 Then
MsgBox(48, "Second instance", "An instance of TwitchNotify is already running.")
Exit
EndIf
If IniRead(@ScriptDir & "\Settings.ini", "Settings", "AutoStart", 0) = 1 Then
If Not FileExists(@StartupDir & "\TwitchNotify.lnk") Then FileCreateShortcut("TwitchNotify.exe", @StartupDir & "\TwitchNotify.lnk", @ScriptDir, "", "Autostarts TwitchNotify with Windows.")
ElseIf IniRead(@ScriptDir & "\Settings.ini", "Settings", "AutoStart", 0) = 0 and FileExists(@StartupDir & "\TwitchNotify.lnk") Then
FileDelete(@StartupDir & "\TwitchNotify.lnk")
Exit
EndIf
Opt("GUIOnEventMode", 1)
Opt("TrayOnEventMode", 1)
Opt("TrayMenuMode", 1)
; -------------- Nachrichten GUI --------------------
$hAlertGUI = GUICreate("Alert", 214, 110, @DesktopWidth - 214, @DesktopHeight - 150, 0x80000008)
GUICtrlCreateLabel("", 0, 0, 214, 210)
GUICtrlSetBkColor(-1, IniRead(@ScriptDir & "\Settings.ini", "Settings", "MessageColor", 0xFF0000))
$hMessage = GUICtrlCreateEdit("", 2, 2, 210, 106, 6144)
GUICtrlSetFont(-1, 10, 400, 0, "Segoe UI")
GUICtrlCreateLabel("", 514, 110, 0, 0)
GUICtrlSetState(-1, 256)
GUISetState(@SW_HIDE, $hAlertGUI)
; ---------------------------------------------------
; -------------- Tray Items -------------------------
Global $bPlaySound = IniRead(@ScriptDir & "\Settings.ini", "Settings", "PlaySound", 0)
Global $bShowMessage = IniRead(@ScriptDir & "\Settings.ini", "Settings", "ShowMessage", 0)
$hRecover = TrayCreateItem("TwitchNotify")
TrayItemSetOnEvent(-1, "_RecoverFromTray")
TrayCreateItem("")
$hWhosLive = TrayCreateItem("Who's live?")
TrayItemSetOnEvent(-1, "_WhosLive")
$hSettingsMenu = TrayCreateMenu("Settings")
$hTraySound = TrayCreateItem("Notify with sound", $hSettingsMenu)
TrayItemSetOnEvent(-1, "_PlaySoundTray")
$hTrayMessage = TrayCreateItem("Notify with message", $hSettingsMenu)
TrayItemSetOnEvent(-1, "_ShowMessageTray")
TrayItemSetState($hTraySound, IniRead(@ScriptDir & "\Settings.ini", "Settings", "PlaySound", 0) = 1 ? 1 : 4)
TrayItemSetState($hTrayMessage, IniRead(@ScriptDir & "\Settings.ini", "Settings", "ShowMessage", 0) = 1 ? 1 : 4)
TrayCreateItem("Exit Program")
TrayItemSetOnEvent(-1, "_ExitProgram")
; ---------------------------------------------------
; --------------- Haupt GUI -------------------------
$hMainGUI = GUICreate("TwitchNotify", 353, 258, 192, 124)
GUISetOnEvent(-3, "_MinimizeToTray")
GUICtrlCreateLabel("_____________________________________________________", 16, 32, 322, 17)
GUICtrlCreateLabel("Channel settings", 16, 16, 119, 25)
GUICtrlSetState(-1, 256)
GUICtrlSetFont(-1, 12, 400, 0, "Segoe UI")
GUICtrlCreateLabel("Channels file:", 24, 64, 67, 17)
GUICtrlSetTip(-1, "Select the file which contains the channel names seperated from each other with a line break.")
$hChannelPath = GUICtrlCreateInput(IniRead(@ScriptDir & "\Settings.ini", "Settings", "Channelpath", @ScriptDir & "\channels.txt"), 96, 61, 193, 21)
GUICtrlCreateButton("...", 296, 60, 27, 23)
GUICtrlSetOnEvent(-1, "_SelectPath")
GUICtrlCreateLabel("check every", 24, 96, 63, 17)
$hInterval = GUICtrlCreateInput(IniRead(@ScriptDir & "\Settings.ini", "Settings", "WaitTime", 5), 96, 93, 41, 21, 1)
GUICtrlCreateUpdown(-1)
GUICtrlSetOnEvent(-1, "_ChangeInterval")
GUICtrlSetLimit(-1, 60, 1)
GUICtrlCreateLabel("minutes for channel status", 144, 96, 127, 17)
GUICtrlCreateLabel("_____________________________________________________", 16, 152, 322, 17)
GUICtrlCreateLabel("Sound and message settings", 16, 136, 202, 25)
GUICtrlSetFont(-1, 12, 400, 0, "Segoe UI")
$hPlaySound = GUICtrlCreateCheckbox("play sound when channel goes live", 24, 176, 193, 17)
GUICtrlSetState(-1, IniRead(@ScriptDir & "\Settings.ini", "Settings", "PlaySound", 0) = 1 ? 1 : 4)
GUICtrlSetOnEvent(-1, "_PlaySound")
$hShowMessage = GUICtrlCreateCheckbox("show message when channel goes live", 24, 200, 209, 17)
GUICtrlSetState(-1, IniRead(@ScriptDir & "\Settings.ini", "Settings", "ShowMessage", 0) = 1 ? 1 : 4)
GUICtrlSetOnEvent(-1, "_ShowMessage")
$hAutoStart = GUICtrlCreateCheckbox("start with windows (silent mode)", 24, 224, 209, 17)
GUICtrlSetState(-1, IniRead(@ScriptDir & "\Settings.ini", "Settings", "AutoStart", 0) = 1 ? 1 : 4)
GUICtrlSetOnEvent(-1, "_OnAutoStart")
GUISetState(@SW_HIDE, $hMainGUI)
; ---------------------------------------------------
Global $aCalledAlready[0][2]
; ---------------- Abfrage-Routine ------------------
While 1
Global $tmr = TimerInit()
Do
Sleep(100)
Until TimerDiff($tmr) >= Number(GUICtrlRead($hInterval)) * 60000
If FileExists(GUICtrlRead($hChannelPath)) Then
$hSession = _WinHttpOpen("TwitchNotify")
$hConnect = _WinHttpConnect($hSession, "api.twitch.tv", 443)
Local $sStreamList = ""
ReDim $aCalledAlready[UBound(StringRegExp(FileRead(GUICtrlRead($hChannelPath)), "\R", 3)) + 1 - Int(FileRead(GUICtrlRead($hChannelPath)) = "")][2]
For $i = 1 To UBound(StringRegExp(FileRead(GUICtrlRead($hChannelPath)), "\R", 3)) + 1 - Int(FileRead(GUICtrlRead($hChannelPath)) = "")
$sStreamerName = FileReadLine(GUICtrlRead($hChannelPath), $i)
$aCalledAlready[$i - 1][0] = $sStreamerName
If Not StringInStr(_WinHttpSimpleSSLRequest($hConnect, "GET", "kraken/streams/" & $sStreamerName), """stream"":null") Then
$sStreamList &= " " & $sStreamerName
Else
$aCalledAlready[$i - 1][1] = 0
EndIf
Next
_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hSession)
If $sStreamList <> "" Then
For $i = 0 To UBound($aCalledAlready) - 1
If StringInStr($sStreamList, $aCalledAlready[$i][0]) and $aCalledAlready[$i][1] = 0 Then
$aCalledAlready[$i][1] = 1
ElseIf StringInStr($sStreamList, $aCalledAlready[$i][0]) and $aCalledAlready[$i][1] = 1 Then
$sStreamList = StringReplace($sStreamList, " " & $aCalledAlready[$i][0], "")
ElseIf Not StringInStr($sStreamList, $aCalledAlready[$i][0]) and $aCalledAlready[$i][1] = 1 Then
$aCalledAlready[$i][1] = 0
EndIf
Next
If $sStreamList <> "" Then
If $bPlaySound Then
$hSound = _SoundOpen("sound.mp3")
_SoundPlay($hSound, 1)
_SoundClose($hSound)
EndIf
If $bShowMessage Then
GUICtrlSetData($hMessage, "The streamers" & $sStreamList & " are now live.")
GUISetState(@SW_SHOW, $hAlertGUI)
Sleep(5000)
GUISetState(@SW_HIDE, $hAlertGUI)
EndIf
EndIf
EndIf
EndIf
WEnd
; ---------------------------------------------------
Func _WhosLive()
TrayItemSetState($hWhosLive, 4)
$hSession = _WinHttpOpen("TwitchNotify")
$hConnect = _WinHttpConnect($hSession, "api.twitch.tv", 443)
Local $sStreamList = ""
ReDim $aCalledAlready[UBound(StringRegExp(FileRead(GUICtrlRead($hChannelPath)), "\R", 3)) + 1 - Int(FileRead(GUICtrlRead($hChannelPath)) = "")][2]
For $i = 1 To UBound(StringRegExp(FileRead(GUICtrlRead($hChannelPath)), "\R", 3)) + 1 - Int(FileRead(GUICtrlRead($hChannelPath)) = "")
$sStreamerName = FileReadLine(GUICtrlRead($hChannelPath), $i)
$aCalledAlready[$i - 1][0] = $sStreamerName
If Not StringInStr(_WinHttpSimpleSSLRequest($hConnect, "GET", "kraken/streams/" & $sStreamerName), """stream"":null") Then
$sStreamList &= " " & $sStreamerName
Else
$aCalledAlready[$i - 1][1] = 0
EndIf
Next
_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hSession)
If $sStreamList <> "" Then
For $i = 0 To UBound($aCalledAlready) - 1
If StringInStr($sStreamList, $aCalledAlready[$i][0]) Then $aCalledAlready[$i][1] = 1
Next
MsgBox(64, "Who's live?", "The streamers" & $sStreamList & " are live right now.")
Else
MsgBox(48, "Who's live?", "No one in your channel list is currently live.")
EndIf
$tmr = TimerInit()
EndFunc
Func _OnAutoStart()
$bAutoStart = BitAND(GUICtrlRead($hAutoStart), 1)
If BitAND(GUICtrlRead($hAutoStart), 1) Then
FileCreateShortcut(@ScriptDir & "\TwitchNotify.exe", @StartupDir & "\TwitchNotify.lnk", @ScriptDir, "", "Autostarts TwitchNotify with Windows.")
Else
FileDelete(@StartupDir & "\TwitchNotify.lnk")
EndIf
IniWrite(@ScriptDir & "\Settings.ini", "Settings", "AutoStart", $bAutoStart)
EndFunc
Func _ChangeInterval()
IniWrite(@ScriptDir & "\Settings.ini", "Settings", "WaitTime", GUICtrlRead($hInterval))
EndFunc
Func _PlaySoundTray()
$bPlaySound = BitAND(TrayItemGetState($hTraySound), 1)
GUICtrlSetState($hPlaySound, $bPlaySound ? 1 : 4)
IniWrite(@ScriptDir & "\Settings.ini", "Settings", "PlaySound", $bPlaySound)
EndFunc
Func _ShowMessageTray()
$bShowMessage = BitAND(TrayItemGetState($hTrayMessage), 1)
GUICtrlSetState($hShowMessage, $bShowMessage ? 1 : 4)
IniWrite(@ScriptDir & "\Settings.ini", "Settings", "ShowMessage", $bShowMessage)
EndFunc
Func _PlaySound()
$bPlaySound = BitAND(GUICtrlRead($hPlaySound), 1)
TrayItemSetState($hTraySound, $bPlaySound ? 1 : 4)
IniWrite(@ScriptDir & "\Settings.ini", "Settings", "PlaySound", $bPlaySound)
EndFunc
Func _ShowMessage()
$bShowMessage = BitAND(GUICtrlRead($hShowMessage), 1)
TrayItemSetState($hTrayMessage, $bShowMessage ? 1 : 4)
IniWrite(@ScriptDir & "\Settings.ini", "Settings", "ShowMessage", $bShowMessage)
EndFunc
Func _SelectPath()
Local $sPath = FileOpenDialog("Select a file containing the channel names", @ScriptDir, "All Data (*.*)")
If $sPath <> "" Then
GUICtrlSetData($hChannelPath, $sPath)
IniWrite(@ScriptDir & "\Settings.ini", "Settings", "Channelpath", $sPath)
EndIf
EndFunc
Func _RecoverFromTray()
TrayItemSetState($hRecover, 4)
GUISetState(@SW_SHOW, $hMainGUI)
EndFunc
Func _MinimizeToTray()
GUISetState(@SW_HIDE, $hMainGUI)
If Not Number(IniRead(@ScriptDir & "\Settings.ini", "Settings", "TrayMessage", 0)) Then
IniWrite(@ScriptDir & "\Settings.ini", "Settings", "TrayMessage", 1)
TrayTip("Minimized to tray", "TwitchNotify minimized itself into the tray." & @CRLF & "You can exit by selecting the tray item.", 5)
EndIf
EndFunc
Func _ExitProgram()
IniWrite(@ScriptDir & "\Settings.ini", "Settings", "Channelpath", GUICtrlRead($hChannelPath))
IniWrite(@ScriptDir & "\Settings.ini", "Settings", "PlaySound", BitAND(GUICtrlRead($hPlaySound), 1))
IniWrite(@ScriptDir & "\Settings.ini", "Settings", "ShowMessage", BitAND(GUICtrlRead($hShowMessage), 1))
IniWrite(@ScriptDir & "\Settings.ini", "Settings", "WaitTime", GUICtrlRead($hInterval))
Exit
EndFunc
Alles anzeigen
Feedback ist gerne gesehen.