Do you get any error messages in the Console?
In fact, you should…
A few things (revealed with some RTFM):
• app.setTimeOut does create an object, which is better defined as a variable, therefore
var myTO = app.setTimeOut(…) ;
• The first argument of app.setTimeOut is a string, therefore
var myTO = app.setTimeOut("app.alert(\"This should appear after a delay.\")", 5000) ;
• a TimeOut object should be cleared. This can be done as part of the delayed command, therefore
var myTO = app.setTimeOut("app.alert(\"This should appear after a delay.\") ; app.clearTimeOut(myTO) ;", 5000) ;
Note that I have not tested the code; it may still be buggy.
Hope this can help.
Max Wyss.