I'm making an app in an hta that lives on a CD and opens wmv's from the CD. I thought everything was going well until I realized that if wmplayer isn't the default player the thing crashes. I have no idea why this is (I'm a Web dev and I'm totally out of my league here). Anyway, I'm trying to get around this by forcing wmplayer to open. Here's my code:
Sub OpenFile (theFile)
Set objShell = CreateObject("Wscript.Shell")
LaunchDir = objShell.CurrentDirectory
RelPath = "\assets\" & theFile
ThePlayer = "wmplayer.exe "
FullPath = chr(34) & ThePlayer & LaunchDir & RelPath & chr(34)
document.write(FullPath)
objShell.Run FullPath
' objShell.Run "assets\" & theFile
' objShell.Run "wmplayer.exe D:\assets\TheFile.wmv"
End Sub
The two commented lines: objShell.Run "assets\" & theFile and objShell.Run "wmplayer.exe D:\assets\TheFile.wmv" both work by themselves but neither is quite what I need. I need to have wmplayer open the file whose name is getting passed in as 'theFile'.
The document.write outputs "wmplayer.exe D:\assets\TheFile.wmv" which seems right to me but I get the error: "The system cannot find the file specified" and "URL: file:///D:/index.hta"
Anyone know what I need to do to get this working?