Newsgroups: microsoft.public.scripting.vbscript
From: "Al Dunbar" <aland...@hotmail.com>
Date: Mon, 2 Nov 2009 19:53:21 -0700
Local: Tues, Nov 3 2009 2:53 am
Subject: Re: Wscript.Shell open file in wmplayer
news:b763438ada3fbea75de27110cb9009f9@nntp-gateway.com...
> Yes, you're correct about about the slash in D:\assets\TheFile.wmv, that > I can get the application to open wmplayer and a certain file if I hard quotes; the quotes in the .run statement simply serve to pass the command to be run as a literal string. look at the statement without the quotes: objShell.Run wmplayer.exe D:\assets\TheFile.wmv Does that look like a valid vbscript statement to you? Also note that if you go start - run - and then enter the command with no windows cannot find 'wmplayer.exe D:\assets\TheFile.wmv' > However, if I construct that very same string it doesn't work: Presumably you have just forgotten to include this statement somewhere > LaunchDir = objShell.CurrentDirectory above: theFile = "theFile.wmv" > ThePlayer = "wmplayer.exe " replace the above statement with: > FullPath = chr(34) & ThePlayer & LaunchDir & RelPath & FullPath = ThePlayer & LaunchDir & RelPath and it should work. > document.write(FullPath) As noted above the actually correct command has no quotes in it. > objShell.Run FullPath > The document.write outputs "wmplayer.exe D:\assets\TheFile.wmv" which > but I get the error "the system cannot file the file Different error message, but the result is the same. > specified" "URL: file///D:/index.hta". /Al > Anyone know what I need to do to get this working?
> Al Dunbar;1181374 Wrote: >> > > I'm making an app that lives on a CD that opens wmv's from the CD. I >> > > Sub OpenFile (theFile) >> > > End Sub >> > > This works: objShell.Run "assets\" & theFile >> > > And if I hard code a file reference it works: >> > > I'm essentially trying to fuse those two lines of code - open >> > > Will someone show me how this is done? > > You might include a copy >> /Al > -- You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||