/    Sign up×
Community /Pin to ProfileBookmark

Need to run video from an HTA script. Dont want to use wmplayer as it will not close down at the end of the video. Would like to use VLC but can’t make it run.

Have installed 64 bit version and inserted
;C:Program FilesVideoLANVLC
into environment variables/path

VLC runs from cmd prompt but not from HTA
wmplayer and notepad both run ok from HTA with and without arguments. This is the script, any ideas please.

<script language=”vbscript”>
Dim objShell
Set objShell = CreateObject(“WScript.Shell”)
Sub RunApp(strApp)
objShell.Run strApp, 1, True
End Sub
</script>
</HEAD>

<body>
<BUTTON onclick=”self.close()”>Exit</BUTTON>
<br><br>
<a href=”#” onClick=”RunApp(‘wmplayer’)”>wmplayer</a>
<br>
<a href=”#” onClick=”RunApp(‘notepad’)”>notepad</a>
<br>
<a href=”#” onClick=”RunApp(‘vlc’)”>VLC</a>

</body>
</html>

Thanks

to post a comment
HTML

3 Comments(s)

Copy linkTweet thisAlerts:
@TrainJun 21.2016 — possile

<i>
</i>&lt;html&gt;

<i> </i>&lt;script type="text/javascript" language="javascript"&gt;
<i> </i> function RunFile()
<i> </i> {
<i> </i> WshShell = new ActiveXObject("WScript.Shell");
<i> </i> the_file = '"C:/Program Files/VideoLAN/VLC/vlc.exe" -vvv "file:///D:/Green BAK/Video/Kurzweil-1.mp4"';
<i> </i> alert(the_file);
<i> </i> WshShell.Run(the_file, 2, false);
<i> </i> }
<i> </i>&lt;/script&gt;

&lt;button onclick="RunFile()"&gt;Click Me!&lt;/button&gt;

&lt;/html&gt;

How I found that

http://stackoverflow.com/questions/17266595/hta-page-opening-the-program-but-not-running-the-file
Copy linkTweet thisAlerts:
@SnoweyauthorJun 21.2016 — Thanks

I was aware of the activeX method but could not have worked out this syntax to save my life.

Had another idea. Changed to another machine without VLC installed. Installed it in C:VLC with no system variables/path entry. The following code then works perfectly:

<a href="#" onClick="RunApp('C:vlcvlc.exe -f D:webtest.avi --play-and-exit')">VLC</a>

Not nice from a standards point of view, I always keep the C: drives as clean and neat as possible but probably a lot less susceptible to syntax error than the activeX option.

Thanks again
Copy linkTweet thisAlerts:
@TrainJun 21.2016 — You are welcome and good luck.
×

Success!

Help @Snowey spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...