NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to play Windows AVI file using Teststand

Hi,
 
I'm trying to play a Windows AVI (*.avi) file using the Windows Media Player, launched by
a Teststand CallExecutable type step.
 
When the step executes, the Windows Media Player app. starts o.k., but the file to be played
causes an error which states the file type is not recognised.
Yet if the AVI file is selected in Windows Explorer, it runs fine, i.e. the file type is associated with
Windows Media Player.
 
If the 1st error is ignored, a 2nd is displayed. This states the file cannot be played, and suggests that
the path may be incorrect or the server is unavailable.
 
When configuring the Teststand CallExecutable step, the Argument Expression field contains the full
absolute address of the AVI (*.avi) file to load and play.
I have also tried using an expression and also placing the AVI file in the same directory as the
Windows Media Player .exe, but the file will still not play.
 
If I use the Run utility from the Windows Start menu, I can enter the same details on a single command
line, and the AVI (*.avi) loads and plays just fine.
 
What should I do to get Windows Media Player to run the AVI (*.avi) file using the Teststand CallExecutable step ?
 
 
thanks,
 
Gary.

 
 
0 Kudos
Message 1 of 6
(4,171 Views)
I've used the following solution:
 
The AVI (*.avi) file to be displayed is named in the Argument expression field, when configuring
the CallExecutable step type, as follows:
 
     "\"c:\\directory\\demo.avi\""
 
Not sure why the extra quotes resolve the problem, especially when using the same step type to open Notepad
and display a text file during sequence execution only requires single quotes around the string, for example
the Argument expression to open a text file in Notepad is:
 
     "c:\\directory\\demo.txt"
 
 
Teststand did warn of the single \ in the AVI file string, but the use of the \ as an escape code is intended. 
 
Any comments appreciated.
 
 
Gary.
 
 
 
0 Kudos
Message 2 of 6
(4,156 Views)

If the path to the media file has spaces in it, you will need to surround the path with quotes. So, your argument expression would be something like:

"\"" + Locals.MyPathWithoutQuotes + "\""

or

"\"c:\\foo bar\\bar foo.avi\""

 

 

Message 3 of 6
(4,156 Views)
By the way, the quotes would also be needed if you launch wmplayer.exe from a command shell.
0 Kudos
Message 4 of 6
(4,152 Views)

Thank you for the answer James.

My Argument expression file paths did contain spaces, which I did not show in my previous examples.

It threw me when Notepad's Argument expression worked fine with spaces but not Windows Media Player.

thank you,

Gary.

0 Kudos
Message 5 of 6
(4,148 Views)

Gary -

FYI, with TS 3.5, the MessagePopup step can also display html files. The html file can reference the player control and tell it to run immediately. The html code looks like this:

<HTML>
<HEAD>
<TITLE>Multimedia Control Page</TITLE>
</HEAD>
<BODY LANGUAGE = VBScript>
<p>
My header text
<p>
<object classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" id="WindowsMediaPlayer1" width="300" height="200">
 <param name="URL" value="c:\windows\clock.avi">
 <param name="rate" value="1">
 <param name="balance" value="0">
 <param name="currentPosition" value="0">
 <param name="defaultFrame" value>
 <param name="playCount" value="1">
 <param name="autoStart" value="-1">
 <param name="currentMarker" value="0">
 <param name="invokeURLs" value="-1">
 <param name="baseURL" value>
 <param name="volume" value="50">
 <param name="mute" value="0">
 <param name="uiMode" value="full">
 <param name="stretchToFit" value="-1">
 <param name="windowlessVideo" value="0">
 <param name="enabled" value="-1">
 <param name="enableContextMenu" value="-1">
 <param name="fullScreen" value="0">
 <param name="SAMIStyle" value>
 <param name="SAMILang" value>
 <param name="SAMIFilename" value>
 <param name="captioningID" value>
 <param name="enableErrorDialogs" value="0">
</object>
</p>
My footer text
</BODY>
</HTML>

Scott Richardson
https://testeract.com
0 Kudos
Message 6 of 6
(4,125 Views)