Jump to content
Sign in to follow this  
MrDeltaX

[Help]Radio- combo menu[Help]

Recommended Posts

MrDeltaX

Hi guys I am making a script.

The function of the script is that I can listen to the radio without starting up my browser.

I also wan't that the last used channel is saved in the register and that the programm automaticly goes to that channel after you restart.

The site is www.nederland.fm (it's dutch)

If you wan't to go to for example the radio channel slamfm you can click on the slamfm button in the mainpage or type in the browser http://www.nederland.fm?z=slamfm

I wan't that the channel selected in the combo is stored in the register but I can't find out how.

so if you for example go to slamfm in the combo.

The programm writes slamfm in the register.

And if the program restart he wil load: http://www.nederland.fm?z= +the registerkey

Can somebody help me ?

Thanks Alot ! :)

#Region;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=sound2.ico
#AutoIt3Wrapper_outfile=NederlandFM.exe
#AutoIt3Wrapper_Res_Description=Nederland.FM
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#EndRegion;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_Icon_Add=..\favicon.ico

#include <GUIConstants.au3>
#Include <Constants.au3>
#include <IE.au3>
Opt("TrayMenuMode", 1)
Opt("TrayOnEventMode", 1)
Opt("GUIOnEventMode", 1)
Opt("WinTitleMatchMode", 3)





TraySetToolTip("Nederland FM")
TraySetState(2)
$zender="slamfm1"
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\nederland","nederlandfm","reg_key")
$read=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\nederlandfm","zender")
$radio = _IECreateEmbedded()
$Nederland = GUICreate("Nederland.FM", @DesktopWidth, @DesktopHeight-50)
$combo=GUICtrlCreateCombo ("SlamFM", 10,550,100,120)
$combo2=GUICtrlSetData(-1,"Radio538|Caz|slamfm|TMFradio|3fm", "3")
$object = GUICtrlCreateObj($radio, 0, -136, 1050, 680)
$readcombo=GUICtrlRead($combo)

$write=RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\nederlandfm","zender","reg_sz",$readcombo)

If $readcombo=0 then
    $write=RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\nederlandfm","zender","reg_sz","slamfm")

EndIf


GUISetState(@SW_SHOW, $Nederland)
_IENavigate ($radio,"http://www.nederland.fm?z="& $read )
$TrayMenu_Exit = TrayCreateItem("Exit")
TraySetClick(8)


Func Tray_Exit()
    Exit
EndFunc
Func Tray_Restore()
    GUISetState(@SW_SHOW, $Nederland)4
    TraySetState(2)
    GUISetState(@SW_RESTORE, $Nederland)
EndFunc

Func GUI_Exit()
    Exit
EndFunc

Func GUI_Hide()
    GUISetState(@SW_HIDE, $Nederland)
    TraySetState(1)
EndFunc






TrayItemSetOnEvent($TrayMenu_Exit, "Tray_Exit")
TraySetOnEvent($TRAY_EVENT_PRIMARYDOUBLE, "Tray_Restore")
GUISetOnEvent($GUI_EVENT_CLOSE, "GUI_Exit")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "GUI_Hide")

While 1
        Sleep(1)

WEnd

Share this post


Link to post
Share on other sites
meekaah

why not just store the combo in an INI file instead of register

then use iniread :)

Share this post


Link to post
Share on other sites
PsaltyDS

Hi guys I am making a script.

The function of the script is that I can listen to the radio without starting up my browser.

I also wan't that the last used channel is saved in the register and that the programm automaticly goes to that channel after you restart.

The site is www.nederland.fm (it's dutch)

If you wan't to go to for example the radio channel slamfm you can click on the slamfm button in the mainpage or type in the browser http://www.nederland.fm?z=slamfm

I wan't that the channel selected in the combo is stored in the register but I can't find out how.

so if you for example go to slamfm in the combo.

The programm writes slamfm in the register.

And if the program restart he wil load: http://www.nederland.fm?z= +the registerkey

Can somebody help me ?

Thanks Alot ! ;)

I took a shot at it:

#include <GUIConstants.au3>
#include <constants.au3>
#include <IE.au3>

Opt("TrayMenuMode", 1)
Opt("TrayOnEventMode", 1)
Opt("GUIOnEventMode", 1)
Opt("WinTitleMatchMode", 3)

; Check default value in registry
$DefaultStation = "slamfm" 
$read = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\nederland\nederlandfm", "zender") ; See if key exists
ConsoleWrite("Debug: At start, $read = " & $read & @LF)
If $read = "" Then
    ; Create reg key if required
    ConsoleWrite("Debug: Writing reg key HKEY_LOCAL_MACHINE\SOFTWARE\nederland\nederlandfm\zender = " & $DefaultStation & @LF)
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\nederland\nederlandfm", "zender", "reg_sz", $DefaultStation)
    $read = $DefaultStation
EndIf

; Setup up tray icon
TraySetToolTip("Nederland FM")
TraySetState(2)
$TrayMenu_Exit = TrayCreateItem("Exit")
TraySetClick(8)
TrayItemSetOnEvent($TrayMenu_Exit, "GUI_Exit")
TraySetOnEvent($TRAY_EVENT_PRIMARYDOUBLE, "Tray_Restore")

; Setup GUI
$Nederland = GUICreate("Nederland.FM", @DesktopWidth - 200, @DesktopHeight - 200)
GUISetOnEvent($GUI_EVENT_CLOSE, "GUI_Exit")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "GUI_Hide")

$radio = _IECreateEmbedded()
$object = GUICtrlCreateObj($radio, 10, 10, @DesktopWidth - 220, @DesktopHeight - 250)
$combo = GUICtrlCreateCombo($DefaultStation, 10, @DesktopHeight - 230, 100, 120)
GUICtrlSetData(-1, "radio538|caz|tmfradio|3fm", $read)
GUICtrlSetOnEvent(-1, "_ComboSel")
GUISetState(@SW_SHOW, $Nederland)
_IENavigate($radio, "http://www.nederland.fm?z=" & $read, 0)

While 1
    Sleep(20)
WEnd

Func Tray_Restore()
    GUISetState(@SW_SHOW, $Nederland)
    TraySetState(2)
    GUISetState(@SW_RESTORE, $Nederland)
EndFunc   ;==>Tray_Restore

Func GUI_Exit()
    ; Save current selection to reg key
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\nederland\nederlandfm", "zender", "reg_sz", GUICtrlRead($combo))
    Exit
EndFunc   ;==>GUI_Exit

Func GUI_Hide()
    GUISetState(@SW_HIDE, $Nederland)
    TraySetState(1)
EndFunc   ;==>GUI_Hide

Func _ComboSel()
    _IEAction($radio, "stop")
    Sleep(250)
    _IENavigate($radio, "http://www.nederland.fm?z=" & GUICtrlRead($combo), 0)
EndFunc   ;==>_ComboSel

Seems to work...

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
MrDeltaX

Thanks !!!!!!!! :)

@meekaah I first used a ini files but it's easier if you only have an exe.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×