Jump to content

Is it possible to ...


Recommended Posts

Hi,

I trying to make a program where you can listen a certain radio with.

The only thing it, I have no idea how I can make the radio play when the user pressed "Play". Or how to stop on "Stop".

Oh, and dont mind the "Load" button.

The GUI

Global $Load = 0

$GUI = GUICreate("Kink Aardschok Radio", 120, 75)
$Play = GUICtrlCreateButton("Play", 10, 10, 50)
$Stop = GUICtrlCreateButton("Stop", 10, 40, 50)
$Load = GUICtrlCreateButton("Load", 70, 10, 40, 55)

GUISetState()
While 1
    $nMsg = GUIGetMsg()
    Select
    Case $nMsg = -3
        Exit
    EndSelect
WEnd

Do you have any idea how to make it work?

Some information:

Radio Site: http://www.nederland.fm/

Radio: Kink Aardschok

I hope you know what I mean. :)

AlmarM

Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Link to comment
Share on other sites

Here's a script I did for my wife a little while ago, I probably robbed most of the code from someone but if so I've forgotten from who or where. It needs audio.au3 which is in example scripts somewhere. It's possible that the stations I've used won't work outside of the uk.

#Region;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=radio.ico
#AutoIt3Wrapper_UseUpx=y
#AutoIt3Wrapper_Run_Obfuscator=n
#EndRegion;**** Directives created by AutoIt3Wrapper_GUI ****

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#include "audio.au3"

_IEErrorHandlerRegister ("MyErrFunc")

$oIE = _IECreateEmbedded()
$Gui = GUICreate("Sally's Internet Radio", 550, 370, _
        (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2);, _
       ;$WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)
$GUIActiveX = GUICtrlCreateObj($oIE, 5, 5, 540, 280)
$lblSet = GUICtrlCreateLabel(".:::::::::::::::.",121,289,70,12);----------V-----------
;GUICtrlSetBkColor(-1,0xcccccc)
GUICtrlSetColor(-1,0xff0000)
GUICtrlSetFont(-1,8,600)
$Radio2 = GUICtrlCreateButton("Radio 2", 10, 300, 90, 40)
$Radio4 = GUICtrlCreateButton("Radio 4", 112, 300, 90, 40)
$Radio5 = GUICtrlCreateButton("Radio 5 LIve", 214, 300, 90, 40)
$ClassicFM = GUICtrlCreateButton("Classic FM", 316, 300, 90, 40)

$GUI_Button_Stop = GUICtrlCreateButton("Exit", 438, 300, 90, 40)
GUICtrlCreateLabel("Volume",210,347,55,20)
$slider = GUICtrlCreateSlider(250, 342, 298, 32)
GUICtrlSetData(-1, 50)

GUISetState();Show GUI
sleep(1000)
;don't know why but this script crashes on Dell D830 if it is compiled production or beta

_IENavigate($oIE, "http://www.bbc.co.uk/iplayer/console/radio4fm/?fm")
;_IENavigate($oIE, "http://www.google.co.uk",1);"http://www.bbc.co.uk/iplayer/console/fivelive",1)
ConsoleWrite("loaded site" & @CRLF)
controlMove($Gui,"",$lblset,121,286)


Global $v = 10
$Choice = "4"
$lastchoice = "-1"
$lastvol = 0
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $ClassicFM
            controlMove($Gui,"",$lblset,325,286)
            _IENavigate($oIE, "http://mediaweb.musicradio.com/player/default.asp?s=2&e=0")
            $choice = "fm"
        Case $msg = $Radio5
            controlMove($Gui,"",$lblset,223,286)
            _IENavigate($oIE, "http://www.bbc.co.uk/iplayer/console/fivelive/")
            $choice = "5"
           ; _IEAction ($oIE, "back")
        Case $msg = $Radio4
            controlMove($Gui,"",$lblset,121,286)
            _IENavigate($oIE, "http://www.bbc.co.uk/iplayer/console/radio4fm/?fm")
           ;_IEAction ($oIE, "forward")
            $choice = "4"
        Case $msg = $Radio2
            controlMove($Gui,"",$lblset,19,286)
            _IENavigate($oIE, "http://www.bbc.co.uk/iplayer/console/radio2")
            $choice = "2"
        Case $msg = $GUI_Button_Stop
            exit

    EndSelect
    $vol = GUICtrlRead($slider)
    If $vol <> $lastvol Then
        _SoundSetMasterVolume($vol)
        $lastvol = $vol
    EndIf
    
    if $lastchoice <> $choice Then
        if $lastchoice = "fm" Then
            ConsoleWrite("81" & @CRLF)
            sleep(200)
            if winexists("Windows Internet Explorer") and StringInStr(WinGetText("Windows Internet Explorer"),"Are you sure") Then
                ConsoleWrite("gotit" & @CRLF)
            EndIf
            
        EndIf
     $lastchoice = $choice
    EndIf
    
WEnd

GUIDelete()

Exit

Func MyErrFunc()
   ; Important: the error object variable MUST be named $oIEErrorHandler
    $ErrorScriptline = $oIEErrorHandler.scriptline
    $ErrorNumber = $oIEErrorHandler.number
    $ErrorNumberHex = Hex($oIEErrorHandler.number, 8)
    $ErrorDescription = StringStripWS($oIEErrorHandler.description, 2)
    $ErrorWinDescription = StringStripWS($oIEErrorHandler.WinDescription, 2)
    $ErrorSource = $oIEErrorHandler.Source
    $ErrorHelpFile = $oIEErrorHandler.HelpFile
    $ErrorHelpContext = $oIEErrorHandler.HelpContext
    $ErrorLastDllError = $oIEErrorHandler.LastDllError
    $ErrorOutput = ""
    $ErrorOutput &= "--> COM Error Encountered in " & @ScriptName & @CR
    $ErrorOutput &= "----> $ErrorScriptline = " & $ErrorScriptline & @CR
    $ErrorOutput &= "----> $ErrorNumberHex = " & $ErrorNumberHex & @CR
    $ErrorOutput &= "----> $ErrorNumber = " & $ErrorNumber & @CR
    $ErrorOutput &= "----> $ErrorWinDescription = " & $ErrorWinDescription & @CR
    $ErrorOutput &= "----> $ErrorDescription = " & $ErrorDescription & @CR
    $ErrorOutput &= "----> $ErrorSource = " & $ErrorSource & @CR
    $ErrorOutput &= "----> $ErrorHelpFile = " & $ErrorHelpFile & @CR
    $ErrorOutput &= "----> $ErrorHelpContext = " & $ErrorHelpContext & @CR
    $ErrorOutput &= "----> $ErrorLastDllError = " & $ErrorLastDllError
    MsgBox(0,"COM Error", $ErrorOutput)
    SetError(1)
    Return
EndFunc ;==>MyErrFunc
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

@ Monoceres,

Not sure how the bass.dll could help me listen to a radio.

@ martin,

Your scripts crashes when it loaded the first site.

AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Link to comment
Share on other sites

@ Monoceres,

Not sure how the bass.dll could help me listen to a radio.

@ martin,

Your scripts crashes when it loaded the first site.

AlmarM

Um, I had that problem on my laptop and I commented out the line

_IEErrorHandlerRegister ("MyErrFunc")

and it worked again so maybe that will work for you. (I never investigated it any further.)

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...