Description
Use the aqUtils.Beep
method to generate a tone with the specified frequency and duration. When this method is called the test execution is paused unless the given sound is played.
Declaration
aqUtils.Beep(Freq, Duration)
Freq | [in] | Optional | Integer | Default value: 5000 |
Duration | [in] | Optional | Integer | Default value: 1000 |
Result | None |
Applies To
The method is applied to the following object:
Parameters
The method has the following parameters:
Freq
The frequency of the sound, in Hertz. Possible values are in the range 37 to 32767 Hertz.
Duration
The duration of the sound, in milliseconds.
Result Value
None.
Remarks
This method is not supported on 64-bit editions of Windows XP, Windows Server 2003 and later operating systems.
Example
The code below demonstrates how you can generate the tone on the PC speaker.
JavaScript, JScript
function GenerateTone()
{
// Specifies the paths to the pictures
var Pic1 = "D:\\MyFiles\\TestResults_old.jpg";
var Pic2 = "D:\\Work\\Test1\\TestResults.jpg";
// Compares two pictures
var Res = Regions.Compare(Pic1, Pic2);
if (Res)
Log.Message("The test log is not changed.")
else
{
aqUtils.Beep();
Log.Message("The test log is changed.");
}
}
Python
def GenerateTone():
# Specifies the paths to the pictures
Pic1 = "D:\\MyFiles\\TestResults_old.jpg"
Pic2 = "D:\\Work\\Test1\\TestResults.jpg"
# Compares two pictures
Res = Regions.Compare(Pic1, Pic2)
if Res:
Log.Message("The test log is not changed.")
else:
aqUtils.Beep()
Log.Message("The test log is changed.")
VBScript
Sub GenerateTone
' Specifies the paths to the pictures
Pic1 = "D:\MyFiles\TestResults_old.jpg"
Pic2 = "D:\Work\Test1\TestResults.jpg"
' Compares two pictures
Res = Regions.Compare(Pic1, Pic2)
If Res Then
Log.Message("The test log is not changed.")
Else
aqUtils.Beep()
Log.Message("The test log is changed.")
End If
End Sub
DelphiScript
function GenerateTone;
var Pic1, Pic2, Res;
begin
// Specifies the paths to the pictures
Pic1 := 'D:\MyFiles\TestResults_old.jpg';
Pic2 := 'D:\Work\Test1\TestResults.jpg';
// Compares two pictures
Res := Regions.Compare(Pic1, Pic2);
if (Res) then
Log.Message('The test log is not changed.')
else
begin
aqUtils.Beep();
Log.Message('The test log is changed.');
end;
end;
C++Script, C#Script
function GenerateTone()
{
// Specifies the paths to the pictures
var Pic1 = "D:\\MyFiles\\TestResults_old.jpg";
var Pic2 = "D:\\Work\\Test1\\TestResults.jpg";
// Compares two pictures
var Res = Regions["Compare"](Pic1, Pic2);
if (Res)
Log["Message"]("The test log is not changed.")
else
{
aqUtils["Beep"]();
Log["Message"]("The test log is changed.");
}
}