Jump to content

Call a Function then get stuck


Recommended Posts

while I am close to sucess with this mess of a script but theres one problem.

#include <GUIConstants.au3>
#include <IE.au3>
Opt("OnExitFunc","_Exit")
If Not FileExists("Buffer") Then 
    DirCreate("Buffer")
EndIf

MsgBox(0 , "Note" , "some cameras have a set refresh rate so be patient")
Global $Feed
$GUI = GUICreate("Live Cam", 237, 50)
$Feed = GUICtrlCreateCombo("Live Feed Camera", 0, 0, 235, @DesktopHeight)
GUICtrlSetData(-1, "CN Tower|Niagara Falls")
$Select = GUICtrlCreateButton("Select...", 0, 24, 75, 25, 0)
$About = GUICtrlCreateButton("About", 80, 24, 75, 25, 0)
$Exit = GUICtrlCreateButton("Exit", 160, 24, 75, 25, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            _Exit()
        Case $Select
            _Select()
        Case $About
        MsgBox(0,"About","I have made this so people can acess just a few cool cameras that are live feed and most of them are Canadian cameras." & @CRLF & @CRLF & "You never know what you might see." & @CRLF & @CRLF & " ")
        Case $Exit
        _Exit()
    EndSwitch
WEnd

Func _Select()
    ;Refresh for picture feeds
    ;Hide for video feed that open up IE to open .wma , mp3
    If GUICtrlRead($Feed) = "" Then _Error()
    If GUICtrlRead($Feed) = "Live Feed Camera" Then _Error()
    If GUICtrlRead($Feed) = "CN Tower" Then _Refresh("http://www.2ontario.com/webcam/oissouth.jpg")
    If GUICtrlRead($Feed) = "Niagara Falls" Then _Hide("mms://niagaracam.protected.ca/niagara") 
EndFunc

Func _Hide($Video)
    _IECreate($Video , 0 , 0 , 1 , 0)
EndFunc

Func _Refresh($Site)
    ;manual buffering
    $url = $Site
    $oIE = _IECreate($url, 0 , 0 , 1 , 1)
    
    $oImgs = _IEImgGetCollection($oIE)
    For $oImg In $oImgs
        $imgURL = $oImg.src
        If $imgURL = $Site Then
        $imgFileName = $oImg.nameProp
        $imgHeight = $oImg.Height
        $imgWidth = $oImg.Width
        InetGet($imgURL , @ScriptDir & "\Buffer\" & $imgFileName)
        $GUI2 = GUICreate(GUICtrlRead($Feed) , $imgWidth, $imgHeight + 30)
        $Pic = GUICtrlCreatePic(@ScriptDir & "\Buffer\" & $imgFileName, 0, 0 , $imgWidth , $imgHeight)
        $GUI_Refresh = GuiCtrlCreateButton("Refresh" , 0 , $imgHeight , 100,  30)
        GUISetState()
        While 1
        $msg = GUIGetMsg()
        Select
        Case $msg = $GUI_EVENT_CLOSE
            GUIDelete($GUI2)
        Case $msg = $GUI_Refresh
            ;$oIE.navigate($Site)
            InetGet($imgURL , @ScriptDir & "\Buffer\" & $imgFileName)
            GUICtrlDelete($Pic)
            $Pic = GUICtrlCreatePic(@ScriptDir & "\Buffer\" & $imgFileName, 0, 0 , $imgWidth , $imgHeight)
            EndSelect
        WEnd
    EndIf
Next    
WinKill($Site)
EndFunc


Func _Error()
    MsgBox(0 , "Error" , "that is not a proper video feed")
EndFunc
;mms://niagaracam.protected.ca/niagara
Func _Exit()
    DirRemove("Buffer", 1)
    Exit
EndFunc

When I call a function it does the function but then the first GUI gets frozen

Edited by testingtest
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...