Web Images News Groups Scholar Blogs Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Wscript.Shell open file in wmplayer
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
cdubone  
View profile  
 More options Oct 31, 10:09 pm
Newsgroups: microsoft.public.scripting.vbscript
From: cdubone <gu...@unknown-email.com>
Date: Sat, 31 Oct 2009 17:09:22 -0500
Local: Sat, Oct 31 2009 10:09 pm
Subject: Wscript.Shell open file in wmplayer

I'm making an app that lives on a CD that 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")
objShell.Run "assets\" & theFile
'            objShell.Run "wmplayer.exe D:assets\TheFile.wmv"
End Sub

This works: objShell.Run "assets\" & theFile

And if I hard code a file reference it works:
objShell.Run "wmplayer.exe D:assets\TheFile.wmv"

I'm essentially trying to fuse those two lines of code - open 'theFile'
in the assets directory via a relative path (not absolute) in wmplayer.
I've tried so many ways to get this going but can't seem to find the one
that works.

Will someone show me how this is done?

--
cdubone


    Reply    Reply to author    Forward  
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.
Al Dunbar  
View profile  
 More options Nov 1, 5:29 pm
Newsgroups: microsoft.public.scripting.vbscript
From: "Al Dunbar" <aland...@hotmail.com>
Date: Sun, 1 Nov 2009 10:29:32 -0700
Local: Sun, Nov 1 2009 5:29 pm
Subject: Re: Wscript.Shell open file in wmplayer

"cdubone" <gu...@unknown-email.com> wrote in message

news:09b40379df88c25c91573f85a8d01528@nntp-gateway.com...

> I'm making an app that lives on a CD that 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")
> objShell.Run "assets\" & theFile
> '            objShell.Run "wmplayer.exe D:assets\TheFile.wmv"

I know that is a comment, however, it is of concern that "D:" is not
followed immediately by a "\". Similarly, the "D:" itself would not allow
for this to work in a computer having two hard drives, or two CD drives.

> End Sub

> This works: objShell.Run "assets\" & theFile

> And if I hard code a file reference it works:
> objShell.Run "wmplayer.exe D:assets\TheFile.wmv"

Again, you really should use more explicit paths that will always be correct
rather than relying on the path including the desired executable, and the
"D:" drive containing the CD.

> I'm essentially trying to fuse those two lines of code - open 'theFile'
> in the assets directory via a relative path (not absolute) in wmplayer.
> I've tried so many ways to get this going but can't seem to find the one
> that works.

> Will someone show me how this is done?

You might include a copy of wmplayer.exe on the CD, assuming that running
this will not modify the user's related settings on the workstation. Or you
might do a search for wmplayer.exe on the hard drive, as it may not be
located in the same place on all systems.

/Al


    Reply    Reply to author    Forward  
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.
cdubone  
View profile  
 More options Nov 2, 4:50 am
Newsgroups: microsoft.public.scripting.vbscript
From: cdubone <gu...@unknown-email.com>
Date: Sun, 1 Nov 2009 22:50:02 -0600
Local: Mon, Nov 2 2009 4:50 am
Subject: Re: Wscript.Shell open file in wmplayer

Yes, you're correct about about the slash in D:\assets\TheFile.wmv, that
was just a typo.

I can get the application to open wmplayer and a certain file if I hard
code it. For example:
objShell.Run "wmplayer.exe D:\assets\TheFile.wmv"
works perfectly.

However, if I construct that very same string it doesn't work:

LaunchDir = objShell.CurrentDirectory
RelPath = "assets\" & theFile
ThePlayer = "wmplayer.exe "

FullPath = chr(34) & ThePlayer & LaunchDir & RelPath &
chr(34)
document.write(FullPath)
objShell.Run FullPath

The document.write outputs "wmplayer.exe D:\assets\TheFile.wmv" which
seems correct to me but I get the error "the system cannot file the file
specified" "URL: file///D:/index.hta".

Anyone know what I need to do to get this working?

Al Dunbar;1181374 Wrote:

--
cdubone

    Reply    Reply to author    Forward  
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.
Al Dunbar  
View profile  
 More options Nov 3, 2:53 am
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

"cdubone" <gu...@unknown-email.com> wrote in message

news:b763438ada3fbea75de27110cb9009f9@nntp-gateway.com...

> Yes, you're correct about about the slash in D:\assets\TheFile.wmv, that
> was just a typo.

> I can get the application to open wmplayer and a certain file if I hard
> code it. For example:
> objShell.Run "wmplayer.exe D:\assets\TheFile.wmv"
> works perfectly.

Yes it does. Note however, that the command actually being run contains no
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
quotes it should run, but if you enter it with quotes, an error dialog will
pop up stating that:

    windows cannot find 'wmplayer.exe D:\assets\TheFile.wmv'

> However, if I construct that very same string it doesn't work:

> LaunchDir = objShell.CurrentDirectory
> RelPath = "assets\" & theFile

Presumably you have just forgotten to include this statement somewhere
above:

    theFile = "theFile.wmv"

> ThePlayer = "wmplayer.exe "

> FullPath = chr(34) & ThePlayer & LaunchDir & RelPath &
> chr(34)

replace the above statement with:

    FullPath = ThePlayer & LaunchDir & RelPath

and it should work.

> document.write(FullPath)
> objShell.Run FullPath

> The document.write outputs "wmplayer.exe D:\assets\TheFile.wmv" which
> seems correct to me

As noted above the actually correct command has no quotes in it.

>    but I get the error "the system cannot file the file
> specified" "URL: file///D:/index.hta".

Different error message, but the result is the same.

/Al


    Reply    Reply to author    Forward  
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.
cdubone  
View profile  
 More options Nov 9, 12:21 am
Newsgroups: microsoft.public.scripting.vbscript
From: cdubone <gu...@unknown-email.com>
Date: Sun, 8 Nov 2009 18:21:42 -0600
Local: Mon, Nov 9 2009 12:21 am
Subject: Re: Wscript.Shell open file in wmplayer

I got it going with this:

Sub OpenWmv (theFile)
Set objShell = CreateObject("Wscript.Shell")
LaunchDir = objShell.CurrentDirectory
RelPath = "\assets\" & theFile
ThePlayer = "wmplayer.exe "
FullPath = ThePlayer & chr(34) & LaunchDir & RelPath &
chr(34)
objShell.Run FullPath
End Sub

Thanks for the help!

--
cdubone


    Reply    Reply to author    Forward  
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.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google