Forum Discussion

abalint's avatar
abalint
Occasional Contributor
12 years ago

Play audio on remote computer

Hi, 



I'd like to set up to play audio on remote computer during distributed testing.

Any idea?

  • Hi Balint,


     


    There are many different objects to play music. For example, to play *.wav files on slave computers, you can use the SAPI.SpVoice object:




    Set oVoice = CreateObject("SAPI.SpVoice")


    set oSpFileStream = CreateObject("SAPI.SpFileStream")


    oSpFileStream.Open "c:\Windows\Media\tada.wav"


    oVoice.SpeakStream oSpFileStream


    oSpFileStream.Close


    oVoice.Speak "Finished Playing wave file."




     


    or the WMPlayer.OCX object to play *.mp3:




    Set wmp = CreateObject("WMPlayer.OCX")


    wmp.openPlayer("D:\MP3\Adiemus.mp3")




     


    Also, many years ago, Helen Kosova posted a very funny script that plays Jingle Bells via PC Speaker:




    // Note frequencies (in Hertz)


    var C4 = 261.63, C3 = C4 / 2, C5 = C4 * 2, C6 = C5 * 2, D4 = 293.66, D3 = D4 / 2, D5 = D4 * 2, 


    E4 = 329.63, E3 = E4 / 2, E5 = E4 * 2, F4 = 349.23, F3 = F4 / 2, F5 = F4 * 2, G4 = 392, 


    G3 = G4 / 2, G5 = G4 * 2, A4 = 440, A3 = A4 / 2, A5 = A4 * 2, B4 = 493.88, B3 = B4 / 2,


    B5 = A5 * 2, REST = 0;


     


    // Note durations (in milliseconds)


    var


    WHOLE = 2000,


    HALF = WHOLE /2,


    QUARTER = HALF /2,


    EIGHTH = QUARTER /2,


    SIXTEENTH = EIGHTH /2;


     


    // An object that represents a note


    function Note(tone, duration)


    {


    this.Tone = tone;


    this.Duration = duration;


    }


    // An object that represents a lyrics snippet


    function Lyrics(text)


    {


     


    }


    function PlaySong(song)


    {


    for (var i in song)


    with (song)


    switch (constructor)


    {


    case Note:


    if (Tone == REST)


    BuiltIn.Delay(Duration)


    else


    Win32API.Beep(Tone, Duration);


    break;


    case Lyrics:


    Indicator.PushText(Text);


    break;


    }


    }


     


     


    function Main()


    {


    var JingleBells = new Array (


    new Lyrics("Jingle bells, jingle bells"),


    new Note(E5, EIGHTH),


    new Note(E5, EIGHTH),


    new Note(E5, QUARTER),


    new Note(E5, EIGHTH),


    new Note(E5, EIGHTH),


    new Note(E5, QUARTER),


    new Lyrics("Jingle all the way"),


    new Note(E5, EIGHTH),


    new Note(G5, EIGHTH),


    new Note(C5, EIGHTH + SIXTEENTH),


    new Note(D5, SIXTEENTH),


    new Note(E5, HALF),


    new Lyrics("Oh! what fun it is to ride"),


    new Note(F5, EIGHTH),


    new Note(F5, EIGHTH),


    new Note(F5, EIGHTH + SIXTEENTH),


    new Note(F5, SIXTEENTH),


    new Note(F5, EIGHTH),


    new Note(E5, EIGHTH),


    new Note(E5, EIGHTH),


    new Lyrics("In a one-horse open sleigh"),


    new Note(E5, SIXTEENTH),


    new Note(E5, SIXTEENTH),


    new Note(G5, EIGHTH),


    new Note(G5, EIGHTH),


    new Note(F5, EIGHTH),


    new Note(D5, EIGHTH),


    new Note(C5, EIGHTH),


    new Note(G3, EIGHTH),


    new Note(A3, EIGHTH),


    new Note(B3, EIGHTH),


    new Lyrics("Dashing through the snow"),


    new Note(G4, EIGHTH),


    new Note(E5, EIGHTH),


    new Note(D5, EIGHTH),


    new Note(C5, EIGHTH),


    new Note(G4, QUARTER + EIGHTH),


    new Lyrics("In a one horse open sleigh"),


    new Note(G4, SIXTEENTH),


    new Note(G4, SIXTEENTH),


    new Note(G4, EIGHTH),


    new Note(E5, EIGHTH),


    new Note(D5, EIGHTH),


    new Note(C5, EIGHTH),


    new Note(A4, HALF),


    new Lyrics("O’er the fields we go"),


    new Note(A4, EIGHTH),


    new Note(F5, EIGHTH),


    new Note(E5, EIGHTH),


    new Note(D5, EIGHTH),


    new Note(B4, HALF),


    new Lyrics("Laughing all the way"),


    new Note(G5, EIGHTH),


    new Note(G5, EIGHTH),


    new Note(F5, EIGHTH),


    new Note(D5, EIGHTH),


    new Note(E5, EIGHTH),


    new Note(G3, EIGHTH),


    new Note(A3, EIGHTH),


    new Note(G4, SIXTEENTH),


    new Note(G4, SIXTEENTH),


    new Lyrics("Bells on bob tail ring"),


    new Note(G4, EIGHTH),


    new Note(E5, EIGHTH),


    new Note(D5, EIGHTH),


    new Note(C5, EIGHTH),


    new Note(G4, HALF),


    new Lyrics("Making spirits bright"),


    new Note(G4, EIGHTH),


    new Note(E5, EIGHTH),


    new Note(D5, EIGHTH),


    new Note(C5, EIGHTH),


    new Note(A4, HALF),


    new Lyrics("What fun it is to ride and sing"),


    new Note(A4, EIGHTH),


    new Note(F5, EIGHTH),


    new Note(E5, EIGHTH),


    new Note(D5, EIGHTH),


    new Note(G5, EIGHTH),


    new Note(G5, EIGHTH),


    new Note(G5, EIGHTH),


    new Lyrics("A sleighing song tonight"),


    new Note(G5, EIGHTH),


    new Note(A5, EIGHTH),


    new Note(G5, EIGHTH),


    new Note(F5, EIGHTH),


    new Note(D5, EIGHTH),


    new Note(C5, EIGHTH),


    new Note(G3, EIGHTH),


    new Note(A3, EIGHTH),


    new Note(B3, EIGHTH),


    new Lyrics("Jingle bells, jingle bells"),


    new Note(E5, EIGHTH),


    new Note(E5, EIGHTH),


    new Note(E5, QUARTER),


    new Note(E5, EIGHTH),


    new Note(E5, EIGHTH),


    new Note(E5, QUARTER),


    new Lyrics("Jingle all the way"),


    new Note(E5, EIGHTH),


    new Note(G5, EIGHTH),


    new Note(C5, EIGHTH + SIXTEENTH),


    new Note(D5, SIXTEENTH),


    new Note(E5, EIGHTH),


    new Note(C3, EIGHTH),


    new Note(D3, EIGHTH),


    new Note(E3, EIGHTH),


    new Lyrics("Oh! what fun it is to ride"),


    new Note(F5, EIGHTH),


    new Note(F5, EIGHTH),


    new Note(F5, EIGHTH + SIXTEENTH),


    new Note(F5, SIXTEENTH),


    new Note(F5, EIGHTH),


    new Note(E5, EIGHTH),


    new Note(E5, EIGHTH),


    new Lyrics("In a one-horse open sleigh"),


    new Note(E5, SIXTEENTH),


    new Note(E5, SIXTEENTH),


    new Note(E5, EIGHTH),


    new Note(D5, EIGHTH),


    new Note(D5, EIGHTH),


    new Note(E5, EIGHTH),


    new Note(D5, QUARTER),


    new Note(G5, QUARTER),


    new Lyrics("Jingle bells, jingle bells"),


    new Note(E5, EIGHTH),


    new Note(E5, EIGHTH),


    new Note(E5, QUARTER),


    new Note(E5, EIGHTH),


    new Note(E5, EIGHTH),


    new Note(E5, QUARTER),


    new Lyrics("Jingle all the way"),


    new Note(E5, EIGHTH),


    new Note(G5, EIGHTH),


    new Note(C5, EIGHTH + SIXTEENTH),


    new Note(D5, SIXTEENTH),


    new Note(E5, EIGHTH),


    new Note(C3, EIGHTH),


    new Note(D3, EIGHTH),


    new Note(E3, EIGHTH),


    new Lyrics("Oh! what fun it is to ride"),


    new Note(F5, EIGHTH),


    new Note(F5, EIGHTH),


    new Note(F5, EIGHTH + SIXTEENTH),


    new Note(F5, SIXTEENTH),


    new Note(F5, EIGHTH),


    new Note(E5, EIGHTH),


    new Note(E5, EIGHTH),


    new Lyrics("In a one-horse open sleigh"),


    new Note(E5, SIXTEENTH),


    new Note(E5, SIXTEENTH),


    new Note(G5, EIGHTH),


    new Note(G5, EIGHTH),


    new Note(F5, EIGHTH),


    new Note(D5, EIGHTH),


    new Note(C5, EIGHTH + SIXTEENTH),


    new Note(E5, SIXTEENTH),


    new Note(G5, SIXTEENTH),


    new Note(C6, EIGHTH + SIXTEENTH)


    );


     


    PlaySong(JingleBells);


    Log.Message("Happy Holidays!");


    }




  • Hi Balint,


     


    Thanks for the explanation.


    Currently, there is no way to configure the parameters of the Remote Desktop Connection tool in Network Suite. We have a corresponding suggestion in our DB - I've increased its rating.


     


    You can use the following workaround at the moment:


    1. Set the "Login mode" property equal to the Manual option in the Hosts editor.


    2. Run the Remote Desktop Connection utility and set the parameters you need in it.


    3. Run your test. As you have selected the Manual mode, TestComplete will run the test in the user session you've opened on the previous step.