NELyon Posted February 25, 2007 Share Posted February 25, 2007 Heres a simple Youtube Video Viewer. You just paste the ID of a Youtube Video into the input box and it "Magically" appears. I tried to add some error checking... but it just doesn't check. Oh well, at least it works if you use it right :"> expandcollapse popup#include <GUIConstants.au3> #Include <IE.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Youtube Video Viewer", 633, 477, 193, 115) $Obj1 = ObjCreate("Shell.Explorer.2") $Obj1_ctrl = GUICtrlCreateObj($Obj1, 0, 0, 626, 380) $Button1 = GUICtrlCreateButton("Go!", 248, 416, 145, 25, 0) $Input1 = GUICtrlCreateInput("Youtube Video ID", 128, 384, 369, 21) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $load = _LoadYoutube(GUICtrlRead($Input1)) If $load = -1 Then YoutubeError("Obj") ElseIf $load = -2 Then YoutubeError("Nav") EndIf EndSwitch WEnd Func _LoadYoutube($sId) If IsObj($Obj1) Then Return $Obj1.Navigate("http://youtube.com/v/"&$sId) Else Return -1 EndIf If Not StringInStr(_IEPropertyGet($Obj1, "LocationUrl"), ".swf") Then Return -2 EndIf EndFunc Func YoutubeError($sType) If $sType = "Obj" Then MsgBox(0, "Error", "Error with the Object. Object was not created properly") ElseIf $sType = "Nav" Then MsgBox(0, "Error", "There was an error navigating to the video. Was there a valid ID?") EndIf EndFunc I'm gonna try to add a "Download" thing. i want it to download the viewer and the flv file, but it's not as easy as i thought. Link to comment Share on other sites More sharing options...
James Posted February 25, 2007 Share Posted February 25, 2007 This is nifty especially for me. I love watching the funy videos. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Valuater Posted February 25, 2007 Share Posted February 25, 2007 for those of us who dont have an account ( or dont want one....here is a UTube ViewerRequires EzSkinexpandcollapse popup#region ; Code generated by EzSkin_1-2-3, Created by Valuater ; For personal use only, All Rights Reserved ; Author of this code: Valuater ; Thank you big_daddy and Joscpe #include <GUIConstants.au3> #include <EzSkin.au3> #Include <IE.au3> $favorites = "http://youtube.com/watch?v=AFnzKDFD9To|Place your favorites here" $EzGUI = EzSkinGUICreate ("U-Tube Viewer", 460, 477) $EzIcon = EzSkinIcon ($EzGUI) GUISetState() #endregion $Obj1 = ObjCreate("Shell.Explorer.2") $child = GUICreate("", 400, 320, 50, 40, $WS_CHILD, -1, $EzGUI) $Obj1_ctrl = GUICtrlCreateObj($Obj1, -50, -260, 630, 620) GUISetState() GUISwitch($EzGUI) $Button1 = EzSkinButton ("Go!", 160, 406, 145, 25) $Input1 = GUICtrlCreateCombo("", 70, 374, 315, 21) GUICtrlSetData( -1, $favorites, "http://youtube.com/watch?v=AFnzKDFD9To") While 1 EzSkinOver () $msg = GUIGetMsg() If $msg = $EzIcon[1] Then Exit If $msg = $EzIcon[2] Then GUISetState(@SW_MINIMIZE, $EzGUI) If $msg = $Button1 Then $load = _LoadYoutube(GUICtrlRead($Input1)) If $load = -1 Then YoutubeError("Obj") ElseIf $load = -2 Then YoutubeError("Nav") EndIf EndIf WEnd Func _LoadYoutube($sId) If IsObj($Obj1) And $sId <> "" Then Return $Obj1.Navigate ($sId) Else Return -1 EndIf If Not StringInStr(_IEPropertyGet($Obj1, "LocationUrl"), ".swf") Then Return -2 EndIf EndFunc ;==>_LoadYoutube Func YoutubeError($sType) If $sType = "Obj" Then MsgBox(0, "Error", "Error with the Object. Object was not created properly") ElseIf $sType = "Nav" Then MsgBox(0, "Error", "There was an error navigating to the video. Was there a valid ID?") EndIf EndFunc ;==>YoutubeError8) 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