Thursday, April 8, 2010

QTP - How to play sound

QTP - How to play sound

Reason for implementing this feature in Hybrid Framework. - One of the developer told me that you are not calculating page response time correctly there is flaw in page synchronization code. In order to prove that I am correct, I have implemented this feature. When system select any action on the control it will generate a beep, once page sync is complete, it will generate different beep. After showing the same to the developer, he agreed that my page response time code is correct.

Attaching the beep function, replace the path of the wave files.

Function funBeep(iBeepNumber)
        strSoundFile = "C:\Automation FrameWork\Config\Blip.wav"
        strSoundFile1 = "C:\Automation FrameWork\Config\notify.wav"
        If gsBeepMode = "ON"  Then
                Select Case iBeepNumber
                        Case 1 : strCommand = "sndrec32 /play /close " & chr(34) & strSoundFile & chr(34) : goShell.Run strCommand, 0, False
                        Case 2 : strCommand = "sndrec32 /play /close " & chr(34) & strSoundFile1 & chr(34) : goShell.Run strCommand, 0, False
                End Select
        End If
End Function


No comments:

Post a Comment