SetTimeout() won't execute the function
So this is my code snippet: 'in VBScript Sub Main() Dim timeoutTimer 'more scripts here 'more scripts here 'more scripts here timeoutTimer = window.setTimeout("alert()", 2000) Call WaitForAnEvent() 'This function waits for an event to happen 'if there is no event then code execution stop's 'and wait 'more scripts here 'more scripts here 'more scripts here End Sub Sub alert() MsgBox "Help!" End Sub What happens is, there are times when alert() is not triggered, and I don't have any idea why. I conducted some research about setTimeout() and they said that setTimeout will be triggered if the