' ' Peteris Krumins (peter@catonmat.net) ' http://www.catonmat.net - good coders code, great reuse ' ' 2007.08.03 v1.0 - initial release ' 2007.10.21 v1.1 - youtube changed the way it displays vids ' 2008.03.01 v1.2 - youtube changed the way it displays vids ' 2009.12.02 v1.3 - youtube changed the way it displays vids ' Option Explicit Dim WscriptMode ' Detect if we are running in WScript or CScript If UCase(Right(WScript.Fullname, 11)) = "WSCRIPT.EXE" Then WScriptMode = True Else WScriptMode = False End If Dim Args: Set Args = WScript.Arguments If Args.Count = 0 And WScriptMode Then ' If running in WScript and no command line args are provided ' ask the user for a URL to the YouTube video Dim Url: Url = InputBox("Enter a YouTube video URL to download" & vbCrLf & _ "For example, http://youtube.com/watch?v=G1ynTV_E-5s", _ "YouTube Downloader, http://www.catonmat.net") If Len(Url) = 0 Then: WScript.Quit 1 DownloadVideo Url ElseIf Args.Count = 0 And Not WScriptMode Then ' If running in CScript and no command line args are provided ' show the usage and quit WScript.Echo "Usage: " & WScript.ScriptName & "