I think I got it. Now i can play an outside sound without any problem. The only thing missing is a timer to the last MsgBox so when no one press cancel, it will reloop the whole script, meaning the sound will play again. This is the best approach to the problem I guess.
Code: Select all
[PCOMM SCRIPT HEADER]
Language = VBSCRIPT
Description =Monitor New Call in Local Queue - Made by Me MySelf And I (need to remain private, but people who are using this script know who I am hehe)- Version 1.0
[PCOMM SCRIPT SOURCE]
Option Explicit
autECLSession.SetConnectionByName (ThisSessionName)
'REM This line calls the macro subroutine
Dim A1, oShell, retCode, strSoundFile, objShell, strCommand
subSub1_
Sub subSub1_()
If MsgBox("An Alarm will be triggered when [NEW] or [ST] call are created within the Queue!", vbOKCancel, _
" The Queue will be monitored for new call") = vbCancel Then Exit Sub
'Once logged in and at the local queue, with all service call listed.....
Do While autECLSession.autECLPS.GetText(5, 26, 3) <> "NEW" And _
autECLSession.autECLPS.GetText(5, 26, 2) <> "ST" And autECLSession.autECLPS.GetText(6, 26, 3) <> "NEW" And _
autECLSession.autECLPS.GetText(6, 26, 2) <> "ST"
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "ci", 22, 008
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[enter]"
autECLSession.autECLPS.Wait 500 ' = 5 seconds - Adjust as required in miliseconds
Loop
Do
strSoundFile = "C:\windows\Media\Notify.wav"
Set objShell = CreateObject("Wscript.Shell")
strCommand = "sndrec32 /play /close " & chr(34) & strSoundFile & chr(34)
objShell.Run strCommand, 0, False
autECLSession.autECLPS.Wait 500
If MsgBox("New Call Found", vbSystemModal + vbExclamation + vbOKCancel, " ***WARNING***") = vbCancel Then Exit Sub
Loop
End Sub