auemitpas Posted December 2, 2012 Share Posted December 2, 2012 (edited) I made a small radio programScreen and download: http://sdrv.ms/VeiZBfEnjoy!Sorce Code:expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=Resources/Radio player!.ico #AutoIt3Wrapper_Res_Comment=Radio player în tray menu #AutoIt3Wrapper_Res_Description=Radio player! © Emil Pastramă #AutoIt3Wrapper_Res_Fileversion=1.0.0.2 #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=p #AutoIt3Wrapper_Res_LegalCopyright=© Emil Pastramă 2012 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <Constants.au3> #include <GUIConstants.au3> #include <EditConstants.au3> #include <GuiListView.au3> #include <Array.au3> #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #NoTrayIcon Opt("GUIOnEventMode", 1) Opt("TrayMenuMode", 3) Opt("TrayOnEventMode", 1) Global $Path = "HKEY_CURRENT_USERSOFTWARERadio KillerPosturi" Global $TrayMenuPosturi,$TrayMenuControl,$TrayMenuAdaugaPost,$TrayMenuStergePost,$TrayMenuDespre,$TrayMenuParaseste,$oWMP,$TrayMenuActualizare,$TrayMenuStop Global $FormAddRadio,$GroupAddRadio,$GroupAddRadioName,$NumePostRadio,$GroupAddRadioStream,$NumeSteamRadio,$ButtonAddRadioOK,$ButtonAddRadioRenunta Global $TrayMenuPostNou[100],$iCountItem Global $FormDeleteRadio,$GroupDeleteRadio,$ComboDeleteRadio,$ButtonDeleteRadioRenunta _TrayMenu() TrayTip("","Radio player! starts ...",10) While 1 Sleep(10) WEnd Func _TrayMenu() TraySetIcon("", -1) TraySetClick("1") $TrayMenuPosturi = TrayCreateMenu("Radio station") $TrayMenuControl = TrayCreateMenu("Control") $TrayMenuAdaugaPost = TrayCreateItem("Add station", $TrayMenuControl) TrayItemSetOnEvent($TrayMenuAdaugaPost, "_EventTrayMenu") $TrayMenuStergePost = TrayCreateItem("Delete station", $TrayMenuControl) TrayItemSetOnEvent($TrayMenuStergePost, "_EventTrayMenu") $TrayMenuStop = TrayCreateItem("Stops playback", $TrayMenuControl) TrayItemSetOnEvent($TrayMenuStop, "_EventTrayMenu") TrayItemSetState($TrayMenuStop,$TRAY_DISABLE) $TrayMenuActualizare = TrayCreateItem("Update") TrayItemSetOnEvent($TrayMenuActualizare, "_EventTrayMenu") $TrayMenuDespre = TrayCreateItem("About") TrayItemSetOnEvent($TrayMenuDespre, "_EventTrayMenu") $TrayMenuParaseste = TrayCreateItem("Exit") TrayItemSetOnEvent($TrayMenuParaseste, "_EventTrayMenu") _RegEnumValDataItem($Path) $oWMP = ObjCreate ( "WMPLayer.ocx" ) $oWMP.controls.stop() TraySetState() TraySetToolTip("Radio player! by Pastramă Emil") EndFunc Func _EventTrayMenu() Local $MsgTray = @TRAY_ID Switch $MsgTray Case $TrayMenuParaseste $oWMP.controls.stop() Exit Case $TrayMenuDespre MsgBox(0,"About!","Program developed by Pastramă Emil!") Case $TrayMenuAdaugaPost _AddRadio() Case $TrayMenuStergePost _DeleteRadio() Case $TrayMenuActualizare ShellExecute('http://sdrv.ms/VeiZBf') Case $TrayMenuStop $oWMP.controls.stop() TrayItemSetState($TrayMenuStop,$TRAY_DISABLE) EndSwitch EndFunc Func _TrayRadioLink() $oWMP.controls.stop() Local $MsgTray = @TRAY_ID Local $iCount, $sRegEnumVal, $sRegRead Local $valid = False Do $iCount += 1 Local $sRegEnumVal = RegEnumVal($Path, $iCount) Local $sRegRead = RegRead($Path, $sRegEnumVal) If $sRegEnumVal = TrayItemGetText($MsgTray) Then $valid = True EndIf If @error Then ExitLoop Until $sRegEnumVal = "" Or $valid = True $oWMP.url = $sRegRead $oWMP.controls.play() TrayItemSetState($TrayMenuStop,$TRAY_ENABLE) TrayTip("", 'Playing radio station ' & $sRegEnumVal,10) EndFunc Func _EventGuiMenu() Local $MsgGui = @GUI_CtrlId Switch $MsgGui Case $ButtonAddRadioOK _AddRadioOK() Case $ButtonAddRadioRenunta GUIDelete($FormAddRadio) Case $ComboDeleteRadio $AdresaDeSters = GUICtrlRead($ComboDeleteRadio) If $AdresaDeSters <> "" Then If $AdresaDeSters <> "Delete radio station..." Then $mesaj = MsgBox(4, "Warning!", "Want to remove radio station "& $AdresaDeSters) If $mesaj = 6 Then RegDelete($Path,$AdresaDeSters) GUICtrlSetData($ComboDeleteRadio,"") _RegEnumValDataItemDelete($Path) EndIf EndIf EndIf Case $ButtonDeleteRadioRenunta GUIDelete($FormDeleteRadio) EndSwitch EndFunc Func _RegEnumValDataItem($sKeyName) Global $sRegEnumVal, $sRegRead, $sRet,$iCountItem Do $iCountItem += 1 Local $sRegEnumVal = RegEnumVal($sKeyName, $iCountItem) If RegEnumVal($sKeyName, $iCountItem) Then $TrayMenuPostNou[$iCountItem] = TrayCreateItem($sRegEnumVal, $TrayMenuPosturi) TrayItemSetOnEvent($TrayMenuPostNou[$iCountItem], "_TrayRadioLink") EndIf If @error Then ExitLoop Until $sRegEnumVal = "" EndFunc Func _AddRadio() $FormAddRadio = GUICreate("Add radio station", 403, 125, 438, 326, 0, 0) $GroupAddRadio = GUICtrlCreateGroup("Add radio station", 0, 0, 401, 113) $GroupAddRadioName = GUICtrlCreateGroup("Name", 8, 22, 129, 48) $NumePostRadio = GUICtrlCreateInput("Name...", 16, 40, 113, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) $GroupAddRadioStream = GUICtrlCreateGroup("Adress", 144, 22, 249, 48) $NumeSteamRadio = GUICtrlCreateInput("Adress...", 152, 40, 233, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) $ButtonAddRadioOK = GUICtrlCreateButton("OK", 88, 72, 75, 25) GUICtrlSetOnEvent($ButtonAddRadioOK, "_EventGuiMenu") $ButtonAddRadioRenunta = GUICtrlCreateButton("Cancel", 200, 72, 75, 25) GUICtrlSetOnEvent($ButtonAddRadioRenunta, "_EventGuiMenu") GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState() EndFunc Func _AddRadioOK() Local $NumePost = GUICtrlRead( $NumePostRadio ) Local $AdresaPost = GUICtrlRead( $NumeSteamRadio ) $iCountItem += 1 RegWrite($Path, $NumePost, "REG_SZ", $AdresaPost) MsgBox (0,"Radio station added!", "You have successfully added radio station: " & @CRLF & _ "Name = " & $NumePost & @CRLF & _ "Adress = " & $AdresaPost) $TrayMenuPostNou[$iCountItem] = TrayCreateItem($NumePost, $TrayMenuPosturi) TrayItemSetOnEvent($TrayMenuPostNou[$iCountItem], "_TrayRadioLink") GUICtrlSetData($NumePostRadio,"Name...") GUICtrlSetData($NumeSteamRadio,"Adress...") EndFunc Func _DeleteRadio() $FormDeleteRadio = GUICreate("Delete radio station!", 403, 134, 374, 288, 0, 0) $GroupDeleteRadio = GUICtrlCreateGroup("Stations will be updated after program restart...", 38, 8, 315, 73) $ComboDeleteRadio = GUICtrlCreateCombo("", 104, 40, 193, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) _RegEnumValDataItemDelete($Path) GUICtrlSetOnEvent($ComboDeleteRadio, "_EventGuiMenu") GUICtrlCreateGroup("", -99, -99, 1, 1) $ButtonDeleteRadioRenunta = GUICtrlCreateButton("Cancel", 280, 80, 75, 25) GUICtrlSetOnEvent($ButtonDeleteRadioRenunta, "_EventGuiMenu") GUISetState() EndFunc Func _RegEnumValDataItemDelete($sKeyName) Local $iCount, $sRegEnumVal, $sRegRead, $sRet,$DataItemRadio = "" Do $iCount += 1 Local $sRegEnumVal = RegEnumVal($sKeyName, $iCount) $DataItemRadio &= $sRegEnumVal & "|" If @error Then ExitLoop Until $sRegEnumVal = "" $PosturiExistente = StringTrimRight($DataItemRadio, 1) GUICtrlSetData($ComboDeleteRadio, "Delete radio station..."& "|" &$PosturiExistente,"Delete radio station...") EndFunc Edited December 3, 2012 by auemitpas Link to comment Share on other sites More sharing options...
logmein Posted December 3, 2012 Share Posted December 3, 2012 Thank you! It's nice! [font=arial, helvetica, sans-serif][s]Total USB Security 3.0 Beta[/s] | [s]Malware Kill[/s] | Malware Scanner | Screen Hider | Locker | Matrix Generator[s]AUTO-SYNC 1.0 | MD5 Hash Generator | URL Checker | Tube Take [/s]| Random Text[/font] Link to comment Share on other sites More sharing options...
wakillon Posted December 3, 2012 Share Posted December 3, 2012 Good start Can you set Tray menu in english ?Take a look to AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
MagixSoftware Posted December 3, 2012 Share Posted December 3, 2012 Looks interesting, perhaps we can see the source program ?PS. And I'm from romania also, and I did something similar myself. Link to comment Share on other sites More sharing options...
auemitpas Posted December 3, 2012 Author Share Posted December 3, 2012 (edited) Update to English version. Tanks for reply Sorry for my english in code! Edited December 3, 2012 by auemitpas Link to comment Share on other sites More sharing options...
wakillon Posted December 3, 2012 Share Posted December 3, 2012 Thanks it's more understandable You can remove these not needed includes : #include <GUIConstants.au3> #include <EditConstants.au3> #include <GuiListView.au3> #include <Array.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now