whats goin guys? I wanted to know how you would add in videos or music into your website using VBScript. If anyone can help me out I'tll be great :) thank you

Recommended Answers

All 4 Replies

Embedding the Windows Media Player
this is for IE ..only .. ther is another ways for if u r using another browser .. just PM me ;)
There are two ways to play a streaming media file. The first one is through an external Media Player. If you haven't install it yet on your computer, this link will connect you immediately to the download area:
http://www.microsoft.com/windows/windowsmedia/default.aspx
To invoke the external Media Player, just place a link to an asf or ASX file in your Web page. To see a live demo of a streaming media, try this story about a turtle. The minimum modem baud rate should be 28.8K. The video stream will look more like still pictures with lower-rate communication link.

The second method to play a streaming media is to embed the Media Player in the Web page. The way to do it is by embedding an ActiveX control. As the subject of ActiveX controls needs much more attention than we can give it here, we won't dive into it in this column (we will dedicate a column to it in the near future). For now, it is sufficient to view ActiveX controls as objects that we embed in Web pages. Each object type supports a set of properties, methods, and events that is relevant to its role on the page. It is not a coincident that the HTML tag that embeds ActiveX controls is the <OBJECT> tag. Here is how the Media Player ActiveX control looks like:

<OBJECT
  ID="mediaPlayer"
  CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
  CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/
    nsmp2inf.cab#Version=5,1,52,701"
  // (The above two lines should be joined as one line.
  // They have been split for formatting purposes.)
  STANDBY="Loading Microsoft Windows Media Player components..."
  TYPE="application/x-oleobject">
  <PARAM NAME="fileName" VALUE="http://msdn.microsoft.com/
    downloads/samples/Internet/imedia/netshow/smedia/NS3/JavaScript/
    Buttons/control.asx">
  // (The above three lines should be joined as one line.
  // They have been split for formatting purposes.)
  <PARAM NAME="animationatStart" VALUE="true">
  <PARAM NAME="transparentatStart" VALUE="true">
  <PARAM NAME="autoStart" VALUE="true">
  <PARAM NAME="showControls" VALUE="true">
</OBJECT>

Let's examine the components of this tag:

Attribute Description 

ID :- Object ID. Can be assigned any string constant. 
CLASS ID: - Media Player ActiveX control registration number. Must be copied and pasted as is. 
CODEBASE: - URL of the decompression application. Must be copied and pasted as is. 
STANDBY:- A message to be displayed while loading the Media Player. 
TYPE:- ActiveX control type specification. Must be copied and pasted as is. 

The <OBJECT> tag is accompanied with several parameter specifications:

NAME Type Description 

fileName:- String URL of the ASF or ASX file. Can reside on an HTTP server (http://), MultiMedia Server (mms://), local hard drive (u:), or on a network drive (p://). 
animationAtStart:- Boolean Specifies whether to activate the Microsoft animation show while the ASF or ASX file buffers. Default is true; ignored if transparentAtStart is true. 
autoStart :- Boolean Specifies whether to start the ASF file when the page loads. 
showControls:- Integer Specifies whether to show the player's control buttons. A value of true shows the controls, while a value of false means no controls. 
clickToPlay :- Boolean Specifies whether to start the ASF when the user clicks on the player's display area. 
transparentAtStart:- Boolean Specifies whether to make the player transparent at the start of the play. Default is false. Takes precedence over animationAtStart.

thank you VERY much! I think I'm going to go with the first way of doing a media file. I dont acutally want it embeded in my web page. Thank you VERY VERY much! :) If I have anymore questions I will ask you!

hiii meabed

saw your post n thought u may help me..

i ve embedded a Windows Media Player component in the ASP.NET Web Application interface.. but dunno how to play a media(audio/video) file in it...

i m using VB.NET as the frontend and oracle9i as the backend...on Windows 2000 Advanced Server..
saw your post n thought u may help me...

i ve tried giving a URL path to a Hyperlink, when this Hyperlink is clicked, another Windows Media Player pops up and plays that media file... but i want the embedded media player(on the interface) to play the file..

how to do this.. ??

and also how to go for dynamic URL path for the media files.. like when a user clicks on any file, its URL shud be invoked n played in the Embedded Windows Media Player(on interface)...

can you help me ???

badly need the help

greatings!
i have this code for .hta
objective is a media browser

<HTML>
<HEAD>
<HTA:APPLICATION
applicationname="desktop.mediaViewer"
id="FileBrowser"
version="17.10.2010"
date="24.12.1999"
border="thin"
innerborder="no"
caption="no"
maximizebutton="no"
minimizebutton="no"
scroll="auto"
scrollflat="yes"
singleinstance="yes"
windowstate="maximize"
navigable="yes"
icon="aux_/dm.ico">
</hta:application>



<meta name="VI60_defaultClientScript" content="VBScript">



<SCRIPT LANGUAGE="VBScript">
Public FolPath, fso, ExtFilter, SortBy, ViewDetails ,t
Public PictureWidth, PictureHeight, OriginalPictureWidth, OriginalPictureHeight, ScreenHeight, ScreenWidth
Public FilePath, fName, ShowInfo, ShowBackgroundText, ShowText, DisableKey
Public ListNumber, mlNumPrev, FileList(2000)


Sub window_onLoad()
ScreenHeight = window.screen.height
ScreenWidth = window.screen.width
ShowInfo = True
ShowBackgroundText = False
ShowText = True
Set fso = CreateObject("scripting.FilesystemObject")
t = Split(FileBrowser.commandLine, "..//")
'----read arguments-----
FolPath = ""
SortBy = ""
ViewDetails = ""
ExtFilter = ","
If UBound(t)>0 Then
For i=1 To UBound(t)
If InStr(t(i), ":\") Then
FolPath = t(i)
ElseIf InStr(t(i), "O:") Then
SortBy = UCase(Replace( Mid(t(i), InStr(t(i), ":")+1) ," ",""))
ElseIf InStr(t(i), "V:") Then
ViewDetails = UCase(Replace( Mid(t(i), InStr(t(i), ":")+1) ," ",""))
ElseIf t(i)<>"" Then
ExtFilter = Replace(t(i)," ","") & ","
End If
Next
End If
'---------SortBy---------
'    N - by name
'    E - by extension
'    A - by last access date
'    S - by size
'    D - by date and time
'----added for pic viewer
If ExtFilter = "," Then
ExtFilter = "jpg,mp3,avi,mpg,mp4,amr,3gp"
End If
If SortBy = "" Then
SortBy = "N"
End If
'------ViewDetails (info)-------
'    A -  last access date
'    S -  size
'    D -  date and time
'    B -  attribute
'    L -  full details
'   ""
'--------------
t=""
If Len(FolPath)>0 Then
Do While Right(FolPath,1) = " "
FolPath = Left(FolPath, Len(FolPath)-1)
Loop
End If
If FolPath = "" Then
FolPath = CreateObject("WScript.Shell").CurrentDirectory
Call DoList(FolPath)
Else
'---debug-----
'MsgBox "InStrRev(FolPath, ""."") = " & InStrRev(FolPath, ".") _
'   & VBCrlf &  "Len(FolPath)-3 = " & Len(FolPath)-3 _
'   & VBCrlf &  "FolPath = """ & FolPath & """" ,,"debug FolPath"
'---end debug---
If InStrRev(FolPath, ".") = Len(FolPath)-3 Then
FilePath = FolPath
FolPath = Left(FolPath, InStrRev(FolPath, "\")-1)
If Fso.FileExists(FilePath) Then
t = LCase(fso.GetExtensionName(FilePath))
If t="jpg" Or t="mpg" Or t="mp3" Or t="mp4" Or t="avi" Or t="amr" Or t="3gp" Then
t=""'
MsgBox FilePath,,"ok"
Call SelectFile(FilePath)
Exit Sub
Else
MsgBox "file not compatible",0+48,"Error"
t=""
Call DoList(FolPath)
End If
Else
MsgBox "File not found.",0+48,"Error"
Call DoList(FolPath)
End If
End If
'-----
If Fso.FolderExists(FolPath) Then
Call DoList(FolPath)
Else
MsgBox "folder not found",0+48,"Error"
FolPath = CreateObject("WScript.Shell").CurrentDirectory
Call DoList(FolPath)
End If
End If
End Sub


Sub DoList(fPath)
FolPath = fPath
LinkCount = 0
fCount = 0
t=""
'------------do buttons------
TextToStart = "<p align=""center""><strong>" & fPath & "</strong>&nbsp;&nbsp;<INPUT NAME=""BtnUpOneLevel"" TYPE=""BUTTON"" VALUE=""↑...Up one level"" "
If InStr(fPath, "\")=0 Then
fPath = fPath & "\"
End If
If InStrRev(fPath, ":\") = Len(fPath)-1 Then
TextToStart = TextToStart & "disabled>"
Else
TextToStart = TextToStart & "onclick=""DoList('" &   Left(fPath, InStrRev(fPath,"\")-1)   & "')"">"
End If
TextToStart = TextToStart &  "<INPUT NAME=""BtnExit"" ONCLICK=""ExitViewer()"" TYPE=""BUTTON"" VALUE=""X"">" _
& "<INPUT NAME=""BtnTaskBar"" ONCLICK=""ShowTaskBar()"" TYPE=""BUTTON"" VALUE=""_""></p>" _
& "<span id=""This"" onmouseover=""this.style.cursor='hand'"" onmouseout=""this.style.cursor='auto'"">"
'----------do subfolders--------
Set folder = fso.getfolder(fPath)
For Each f in folder.subfolders
t = t & "<A onclick=""DoList('"  &  f.path  & _
"')"" ><img name=""BtnOpenFolder"" src=""folder.png"" border=""0"" alt=""go to this directory"">&nbsp;&nbsp;" &_
Replace(f.name," ","&nbsp") & "</A> &nbsp;&nbsp;"
Next
If t <>"" Then
TextToStart = TextToStart & t
End If
'-------------do files---------
'---------SortBy---------
Select Case SortBy
Case ""  t="MyString = UCase(f.name) & VbTab &"
Case "N" t="MyString = UCase(f.name) & VbTab &"
Case "E" t="MyString = fso.GetExtensionName(f.name) & UCase(f.name) & VbTab &"
Case "A" t="MyDate = f.DateLastAccessed" _
& VbCrlf & "MyString = Right(Year(MyDate),2) & Right( ""0"" & Month(MyDate),2 ) & Right( ""0"" & Day(MyDate),2 ) " _
& "& UCase(f.name) & VbTab &"
Case "S" t="MyString = Chr(Len(f.size)+65) & f.size & VbTab &"
Case "D" t="MyDate = f.DateLastModified" _
& VbCrlf & "MyString = Right(Year(MyDate),2) & Right( ""0"" & Month(MyDate),2 ) & Right( ""0"" & Day(MyDate),2 ) " _
& " & Right( ""0"" & Hour(MyDate),2 ) & Right( ""0"" & Minute(MyDate),2 ) & Right( ""0"" & Second(MyDate),2 )" _
& "& UCase(f.name) & VbTab &"
End Select
'------ViewDetails-------
Select Case True
Case ViewDetails="" t=t & " ""*1*"" & Replace(Replace(Replace(Replace(f.ShortName,""."",""""),"" "",""""),""~"",""""),""-"",""_"") & ""*2*"" & f.path & ""')""""><b>;;""" _
& " & Replace(f.name,"" "",""&nbsp"") & "";;</b></A></span>"""
Case InStr(ViewDetails,"L")>0 t=t & " ""*1*"" & Replace(Replace(Replace(Replace(f.ShortName,""."",""""),"" "",""""),""~"",""""),""-"",""_"") & ""*2*"" & f.path & ""')""""><b>;;""" _
& " & Replace(f.name,"" "",""&nbsp"") & "";;*3*""" _
& " & FormatNumber(f.Size, 0,0,0,-1) & "";b, Modified: "" & f.DateLastModified & "", Accessed: "" & f.DateLastAccessed" _
& " & Replace(Replace(Replace(Replace(""["" & f.Attributes,""1"",""Read Only""),""[2"",""[Hidden""),""4"",""System File""),""32"",""Archive"") & ""]</font><br>"""
Case InStr(ViewDetails,"A")>0 t=t & " ""*1*"" & Replace(Replace(Replace(Replace(f.ShortName,""."",""""),"" "",""""),""~"",""""),""-"",""_"") & ""*2*"" & f.path & ""')""""><b>;;""" _
& " & Replace(f.name,"" "",""&nbsp"") & "";;*3*""" _
& " & "" Acc.: "" & f.DateLastAccessed"
Case InStr(ViewDetails,"S")>0 t=t & " ""*1*"" & Replace(Replace(Replace(Replace(f.ShortName,""."",""""),"" "",""""),""~"",""""),""-"",""_"") & ""*2*"" & f.path & ""')""""><b>;;""" _
& " & Replace(f.name,"" "",""&nbsp"") & "";;*3*""" _
& " & FormatNumber(f.Size, 0,0,0,-1) & "";b"""
Case InStr(ViewDetails,"D")>0 t=t & " ""*1*"" & Replace(Replace(Replace(Replace(f.ShortName,""."",""""),"" "",""""),""~"",""""),""-"",""_"") & ""*2*"" & f.path & ""')""""><b>;;""" _
& " & Replace(f.name,"" "",""&nbsp"") & "";;*3*""" _
& " & f.DateLastModified"
Case InStr(ViewDetails,"B")>0 t=t & " ""*1*"" & Replace(Replace(Replace(Replace(f.ShortName,""."",""""),"" "",""""),""~"",""""),""-"",""_"") & ""*2*"" & f.path & ""')""""><b>;;""" _
& " & Replace(f.name,"" "",""&nbsp"") & "";;*3*""" _
& " & Replace(Replace(Replace(Replace(""["" & f.Attributes,""1"",""Read Only""),""[2"",""[Hidden""),""4"",""System File""),""32"",""Archive"") & ""]"""
End Select
'----if more than one---
If Len(ViewDetails)>1 Then
For i=2 To Len(ViewDetails)
Select Case True
Case InStr(i,ViewDetails,"A",1)>0 t=t & " & "";Acc.:;"" & f.DateLastAccessed"
Case InStr(i,ViewDetails,"S",1)>0 t=t & " & "";-;"" & FormatNumber(f.Size, 0,0,0,-1) & "";b"""
Case InStr(i,ViewDetails,"D",1)>0 t=t & " & "";-;"" & f.DateLastModified"
Case InStr(i,ViewDetails,"B",1)>0 t=t & " & "";-;"" & Replace(Replace(Replace(Replace(""["" & f.Attributes,""1"",""Read Only""),""[2"",""[Hidden""),""4"",""System File""),""32"",""Archive"") & ""]"""
End Select
Next
End If
If InStr(ViewDetails,"L")=0 And ViewDetails<>"" Then
If Len(ViewDetails)>2 Then
t=t & " & ""</font></A></span><br>"""
Else
t=t & " & ""</font></A></span>"""
End If
End If
'-------------
Set oMyCatString = New AddString '---utilise la classe pour ajouter les ficheirs dans la liste rapidement
For Each f in folder.files
If ExtFilter = "," Or InStr(1, ExtFilter,  fso.GetExtensionName(f.name) & ",", 1) Then
Execute t
oMyCatString MyString
'------ajoute à la liste simple----
If fCount < 2000 Then
FileList(fCount) = f.Path
End If
'---------
fCount = fCount+1
End If
Next
mlNumPrev = -2
If fCount > 2000 Then
MsgBox "Buttons ""Next"" and ""Previous"" disabled: Too many files.",0+48,"Picture viewer"
ElseIf fCount < 2000 Then
For i=fCount+1 To 2000
FileList(fCount) = ""
Next
End If
If fCount > 1 Then
FileListHtml = oMyCatString.Flush
ElseIf fcount = 0 Then
FileListHtml = ""
Else
MyString = Mid(MyString, InStr(MyString, VbTab)+1)
MyString = Replace(Replace(Replace(Replace(MyString, ";", "&nbsp;"),"*1*","<span id=""f"), "*2*", """><A onclick=""SelectFile('"), "*3*", "</b><font color=""#009933"">")
FileListHtml = MyString
End If
document.all.ListOfItems.innerhtml = TextToStart & "<hr>" & FileListHtml & "</p></span><p><font color=""aqua"">.files:</font>" & fCount & " </p> "



End Sub


'-----class to concatenate strings (modified)-----
Class AddString
Dim iElement, NewStrArray
Private Sub Class_Initialize()
iElement = 0
ReDim NewStrArray(iElement)
End Sub
Public Default Sub AddString(Value)
NewStrArray(iElement) = Value
iElement = iElement + 1
ReDim Preserve NewStrArray(iElement)
End Sub
Public Function Flush
iElement = iElement - 1
Redim Preserve NewStrArray(iElement)
'------sort list-----
ArraySort NewStrArray
'-----remove sorting mark------
'-----and add html code that where replaced by "*1*" to make string shorter when sorting-----
For iel = 0 To  UBound(NewStrArray)
Word = NewStrArray(iel)
Word = Mid(Word, InStr(Word, VbTab)+1)
Word = Replace(Replace(Replace(Replace(Word, ";", "&nbsp;"),"*1*","<span id=""f"), "*2*", """><A onclick=""SelectFile('"), "*3*", "</b><font color=""#009933"">")
NewStrArray(iel) = Word
Next
'--------------------
Flush = Join(NewStrArray,VbCrLf)
End Function
'-----sort function---------
Private Function ArraySort(ArrY)
ReDim TempArray(255)
For Each Word in ArrY
UCaseWord = UCase(Word) & "   "
TempArrayNum = Asc(Left(UCaseWord,1))
TempArray(TempArrayNum) = TempArray(TempArrayNum) & Word & VBCrlf
Next
For Each SmallList In TempArray
If SmallList <>"" Then
SmallArray = Split( Mid(SmallList,2 ),VBCrlf)
InsertionSort SmallArray
BigList = BigList & Join(SmallArray,VbCrlf)
End If
Next
time2 = Timer
ArrY = Split(BigList,VbCrlf)
Erase SmallArray
Erase TempArray
End Function
'-----sort function-----
Private Function InsertionSort(arrX)
Dim nUB : nUB = UBound(arrX)
Dim i, j, v
For i=1 To nUB
v=arrX(i)
j=i
Do While arrX(j-1) > v
arrX(j) = arrX(j-1)
j=j-1
If j<=0 Then
Exit Do
End If
Loop
arrX(j) = v
Next
End Function
'--------
Private Sub Class_Terminate()
Erase NewStrArray
End Sub
End Class
'----------


Sub Open()
document.body.innerhtml = "<FORM NAME=""form""><span id=""ListOfItems""></span></FORM>"
Call DoList(FolPath)
End Sub


Sub HideScrollBar()
CreateObject("WScript.Shell").Run "app.HTx",1,true
End Sub


Sub ShowTaskBar()
If document.form.BtnTaskBar.value = "_" Then
document.form.BtnTaskBar.value = "_-"
window.moveTo ScreenWidth -400, ScreenHeight -240
window.ResizeTo 400,240
Else
document.form.BtnTaskBar.value = "_"
window.moveTo 0, 0
window.ResizeTo ScreenWidth ,ScreenHeight
End If
End Sub


Sub ExitViewer()
Window.Close
End Sub


Sub AddPrev(i)
If mlNumPrev =-2 Then
For mlNumPrev=0 To 2000
If FilePath = FileList(mlNumPrev) Then
Exit For
End If
Next
End If
mlNumPrev = mlNumPrev +i
If mlNumPrev >= 2000 Then
mlNumPrev = 2000
MsgBox "Loop list cannot contain more than 2000 files.",48+0,"Picture viewer"
If InsTr(document.form.innertext, "*Hide ToolBar*") Then
document.form.BtnNext.disabled = True
document.form.BtnPrev.disabled = False
End If
ElseIf mlNumPrev =-1 Then
mlNumPrev = 0
If InsTr(document.form.innertext, "*Hide ToolBar*") Then
document.form.BtnNext.disabled = False
document.form.BtnPrev.disabled = True
Else
MsgBox "Start of list.",,"Picture viewer"
End If
ElseIf  FileList(mlNumPrev)="" Then
If InsTr(document.form.innertext, "*Hide ToolBar*") Then
If MsgBox("End of list: Start again from the beginning?", 4, "Picture viewer") = 6 Then
mlNumPrev = 0
document.form.BtnPrev.disabled = True
Else
document.form.BtnNext.disabled = True
document.form.BtnPrev.disabled = False
End if
Else
MsgBox "End of list: Starting again from the beginning.",,"Picture viewer"
mlNumPrev = 0
End If
Else
FilePath = FileList(mlNumPrev)
fName = Replace(FilePath, " ","%20")
document.all.MyPic.innerhtml = "<img border=""0"" src=""file:///" &  fName  & """ id=""MyPicture"">"
PictureWidth = document.all.MyPicture.width
PictureHeight = document.all.MyPicture.height
OriginalPictureWidth = PictureWidth
OriginalPictureHeight = PictureHeight
If ShowInfo = True Then
Call WriteInfo(0)
End If
If ShowText = True Then
Call WriteText(0)
End If
If InsTr(document.form.innertext, "*Hide ToolBar*") Then
document.form.BtnNext.disabled = False
document.form.BtnPrev.disabled = False
End If
End If
End Sub


Sub WriteInfo(Var)
Select Case Var
Case -1
ShowInfo = -(ShowInfo+1)
Case 1
If document.form.Info.checked = True Then
ShowInfo = True
Else
ShowInfo = False
End If
End Select
If ShowInfo = True Then
Set f = fso.GetFile(FilePath)
FileDate = f.DateLastModified
FileDate = Left(FileDate, InStrRev(FileDate, ":")-1)
document.all.PicInfo.innerhtml = f.name & " <font color=""#00FFFF"">" _
& "[" & OriginalPictureWidth & "/" & OriginalPictureHeight & " " & f.size & " b " & FileDate & "]</font>"
Else
document.all.PicInfo.innertext = ""
End If
End Sub


Sub WriteText(Var)
Select Case Var
Case -1
ShowText = -(ShowText+1)
Case 1
If document.form.Text.checked = True Then
ShowText = True
Else
ShowText = False
End If
Case 2
If document.form.BackgroundText.checked = True Then
ShowBackgroundText = True
Else
ShowBackgroundText = False
End If
End Select
If ShowText = True Then
TextFile = Left( FilePath, InStr(FilePath,".")-1 ) & ".htx"
If fso.FileExists(TextFile) Then
Set ts = fso.GetFile(TextFile).OpenAsTextStream(1)
t= Replace(Replace(ts.ReadAll, VbCrlf, "<br>"), VbTab,"&nbsp;&nbsp;&nbsp; ")
ts.Close
PosLeft = PictureWidth +16
PosWidth = ScreenWidth -PictureWidth -32
If PosLeft > ScreenWidth -350 Then
PosLeft = Round(ScreenWidth *0.66, 0)
PosWidth = Round(ScreenWidth *0.33 -32, 0)
End If
If ShowBackgroundText = False Then
document.all.PicText.innerhtml = "<p style=""position: absolute; left: " & PosLeft & "; top: 56; width: "  & PosWidth & ";"">" _
& VbCrlf & t & "</p>"
Else
document.all.PicText.innerhtml = "<p style=""position: absolute; left: " & PosLeft & "; top: 56; width: "  & PosWidth & ";"">" _
& VbCrlf & "<font style=""background-color: #000000"">" & t & "</font></p>"
End If
Else
document.all.PicText.innerhtml = ""
End If
Else
document.all.PicText.innerhtml = ""
End If
End Sub


Sub PlayVideo(FileName, Left, Top, Width, Height, Repeat)
Action.LoadControl MediaPlayerObject(1)
MediaPlayerObject(1).Move Left*ScreenObject.TwipsPerPixelX, Top*ScreenObject.TwipsPerPixelX, Width*ScreenObject.TwipsPerPixelY, Height*ScreenObject.TwipsPerPixelY
MediaPlayerObject(1).FileName = FileName
If Repeat = True Then
MediaPlayerObject(1).PlayCount = 0
Else
MediaPlayerObject(1).PlayCount = 1
End If
MediaPlayerObject(1).Visible = True
MediaPlayerObject(1).Play
End Sub
Sub PlaySound(FileName, Repeat)
Action.LoadControl MediaPlayerObject(2)
MediaPlayerObject(2).FileName = FileName
If Repeat = True Then
MediaPlayerObject(2).PlayCount = 0
Else
MediaPlayerObject(2).PlayCount = 1
End If
MediaPlayerObject(2).Play
End Sub
Sub StopVideo()
MediaPlayerObject(1).Visible = False
MediaPlayerObject(1).Stop
MediaPlayerObject(1).FileName = "*.mp3"
Action.UnloadControl MediaPlayerObject(1)
End Sub
Sub StopSound()
MediaPlayerObject(2).Stop
MediaPlayerObject(2).FileName = "*.avi"
Action.UnloadControl MediaPlayerObject(2)
End Sub


Sub SaveText()
TextFile = Left(FilePath, InStrRev(FilePath, ".")) & "txt"
Set ts = fso.OpenTextFile(TextFile , 2, -1)
ts.Write document.all.MyText.innertext
ts.Close
If document.form.Text.checked = True Then
Call WriteText(1)
End If
DisableKey=False
End Sub


Sub EditText
DisableKey=True
TextFile = Left(FilePath, InStrRev(FilePath, ".")) & "txt"
PosLeft = PictureWidth +16
PosWidth = ScreenWidth -PictureWidth -32
If PosLeft > ScreenWidth -150 Then
PosLeft = Round(ScreenWidth *0.66, 0)
PosWidth = Round(ScreenWidth *0.33 -32, 0)
End If
If Fso.FileExists(TextFile) Then
'MsgBox """" & TextFile & """",,"debug text file"
Set ts = fso.GetFile(TextFile).OpenAsTextStream(1)
t= ts.ReadAll
ts.Close
document.all.PicText.innerhtml = "<p style=""position: absolute; left: " & PosLeft & "; top: 50; width: "  & PosWidth & ";"">" _
& "<INPUT NAME=""BtnSaveText"" ONCLICK=""SaveText()"" TYPE=""BUTTON"" VALUE=""Salvar"">" _
& "<INPUT NAME=""BtnCancelText"" ONCLICK=""WriteText(1)"" TYPE=""BUTTON"" VALUE=""Cancelar""><br>" _
& "<textarea name=""MyText"" cols=""50"" rows=""30"" >" & t &  "</textarea></p>"
ElseIf MsgBox("""" & TextFile & """ não existe. Criar nova?", 32+4, "Create a text for this image") = 6 Then
fso.CreateTextFile TextFile, True
document.all.PicText.innerhtml = "<p style=""position: absolute; left: " & PosLeft & "; top: 50; width: "  & PosWidth & ";"">" _
& "<INPUT NAME=""BtnSaveText"" ONCLICK=""SaveText()"" TYPE=""BUTTON"" VALUE=""Save"">" _
& "<INPUT NAME=""BtnCancelText"" ONCLICK=""WriteText(1)"" TYPE=""BUTTON"" VALUE=""Cancel""><br>" _
& "<textarea name=""MyText"" cols=""50"" rows=""30"" ></textarea></p>"
End If
End Sub


Sub ShowToolBar(Var)
t = document.all.PicInfo.innerhtml
Select Case Var
Case 0
document.form.innerhtml = "<span id=""ToolBar"" onmouseover="" ShowToolBar(1)"">" _
& "<font color=""#C0C0C0"">" _
& "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *Show ToolBar* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" _
& "</font></span><span id=""PicInfo""></span>"
Case 1
document.form.innerhtml = "<font color=""#FFFFFF"">" _
& "<INPUT NAME=""BtnEditText"" ONCLICK=""EditText()"" TYPE=""BUTTON"" VALUE=""Ver\Editar Texto"">" _
& "<INPUT NAME=""BtnZoomIn"" ONCLICK=""Zoom('1')"" TYPE=""BUTTON"" VALUE=""Zoom in"">" _
& "<INPUT NAME=""BtnZoomOut"" ONCLICK=""Zoom('2')"" TYPE=""BUTTON"" VALUE=""100%"">" _
& "<INPUT NAME=""BtnZoomOut"" ONCLICK=""Zoom('3')"" TYPE=""BUTTON"" VALUE=""Zoom out"">" _
& "<INPUT NAME=""BtnOpen"" ONCLICK=""Open()"" TYPE=""BUTTON"" VALUE=""navegar"">" _
& "<INPUT NAME=""BtnPrev"" ONCLICK=""AddPrev(-1)"" TYPE=""BUTTON"" VALUE=""←"">" _
& "<INPUT NAME=""BtnNext"" ONCLICK=""AddPrev(1)"" TYPE=""BUTTON"" VALUE=""→"">" _
& "<INPUT NAME=""BtnTaskBar"" ONCLICK=""ShowTaskBar()"" TYPE=""BUTTON"" VALUE=""_"">" _
& "<INPUT NAME=""BtnExit"" ONCLICK=""ExitViewer()"" TYPE=""BUTTON"" VALUE=""X"">" _
& "Show infos<input type=""checkbox"" value=""ON"" name=""Info"" ONCLICK=""WriteInfo(1)"">" _
& "Show text<input type=""checkbox"" value=""on"" name=""Text"" ONCLICK=""WriteText(1)"">" _
& "Text on black<input type=""checkbox"" value=""on"" name=""BackgroundText"" ONCLICK=""WriteText(2)"">" _
& "<span id=""ToolBar"" onmouseover=""ShowToolBar(0)"">" _
& "<font color=""#C0C0C0"">" _
& "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * Hide toolbar* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" _
& "</font></span>" _
& "</font><br>" _
& "<span id=""PicInfo""></span>"
If ShowInfo = False Then
document.form.Info.checked = False
Else
document.form.Info.checked = True
End If
If ShowBackgroundText = True Then
document.form.BackgroundText.checked = True
Else
document.form.BackgroundText.checked = False
End If
If ShowText = True Then
document.form.Text.checked = True
Else
document.form.Text.checked = False
End If
End Select
document.all.PicInfo.innerhtml = t
End Sub


Sub SelectFile(fPath)
FilePath = fPath
fName = Replace(fPath, " ","%20")
document.body.innerhtml = "<FORM NAME=""form"">" _
& "<span id=""ToolBar"" onmouseover=""ShowToolBar(1)"">" _
& "<font color=""#C0C0C0"">" _
& "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *Show ToolBar* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" _
& "</font></span>" _
& "<span id=""PicInfo""></span></FORM>"  _
& "<span id=""PicText""></span>" _
& "<span id=""MyPic"">" _
& "<img border=""0"" src=""file:///" &  fName  & """ id=""MyPicture""></span>"
PictureWidth = document.all.MyPicture.width
PictureHeight = document.all.MyPicture.height
OriginalPictureWidth = PictureWidth
OriginalPictureHeight = PictureHeight
If ShowInfo = True Then
Call WriteInfo(0)
End If
If ShowText = True Then
Call WriteText(0)
End If
End Sub


Sub Zoom(Var)
Select Case Var
Case 1
PictureWidth = Round(PictureWidth * 1.3 ,0)
PictureHeight = Round(PictureHeight * 1.3 ,0)
Case 2
PictureWidth = OriginalPictureWidth
PictureHeight = OriginalPictureHeight
Case 3
PictureWidth = Round(PictureWidth / 1.3 ,0)
PictureHeight = Round(PictureHeight / 1.3 ,0)
End Select
Document.all.MyPic.Innerhtml = "<img border=""0"" src=""file:///" &  fName  & """ width=""" & PictureWidth & """ height=""" & PictureHeight & """>"
Call WriteText(1)
End Sub


Sub Help()
MsgBox "[Esc] :" & VBTab & VbTab & "Exit" _
& VBCrlf & "- :" & VBTab & VbTab & "Zoom out" _
& VBCrlf & "+ :" & VBTab & VbTab & "Zoom in" _
& VBCrlf & "? :" & VBTab & VbTab & "Help" _
& VBCrlf & "b :" & VBTab & VbTab & "Show toolbar" _
& VBCrlf & "i :" & VBTab & VbTab & "Show file infos (on/off)" _
& VBCrlf & "n or [White Space] : Show next picture" _
& VBCrlf & "o :" & VBTab & VbTab & "Open file" _
& VBCrlf & "p :" & VBTab & VbTab & "Show previous picture" _
& VBCrlf & "t :" & VBTab & VbTab & "Edit text" _
& VBCrlf & "w :" & VBTab & VbTab & "Show text (on/off)"
End Sub


Sub checkKey()
If DisableKey=True Then
Exit Sub
End If
If InsTr(document.form.innertext, "ToolBar*") Then
t = window.event.keycode
Select Case t
Case 27 Window.Close
Case 32 Call AddPrev(1)
Case 43 Call Zoom(1)
Case 45 Call Zoom(3)
Case 63 Call Help()
Case 98 Call ShowToolBar(1)
Case 105 Call WriteInfo(-1)
Case 108 Call HideScrollBar()
Case 110 Call AddPrev(1)
Case 111 Call Open()
Case 112 Call AddPrev(-1)
Case 116 Call EditText()
Case 119 Call WriteText(-1)
End Select
Else
MsgBox "not ok",,"debug checkkey"
End If
End Sub



</SCRIPT>


<TITLE>CTRL://xplorer/</TITLE>
</HEAD>


<BODY style= bgcolor="#000000" onKeyPress="checkKey()">
<link rel="stylesheet" href="styles.css" type="text/css" />
<style type="text/css">
<!--
BODY{
scrollbar-face-color:#151a1e;
scrollbar-arrow-color:#A8E9FF;
scrollbar-track-color:#EEEEEE;
scrollbar-shadow-color:black;
scrollbar-highlight-color:'#A8E9FF';
scrollbar-3dlight-color:'#A8E9FF';
scrollbar-darkshadow-Color:'black';
}
-->
</style>


<div id="top-bar">
<div id="topbar-inner">CTRL-SIEM
<br>
<div style="text-align:;"><span class="usercontrol">Bem-vindo %USER%</span><br></div>
<br><br>
<FORM NAME="form">
<span id="ListOfItems"></span>
</FORM>
</BODY>
</HTML>

i need to insert a WMP syntax.
if the aplication browses *.mp3, *.mpg,*.avi or others video and audio files supported.
Is there anyone to bring sujestions?
thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.