home *** CD-ROM | disk | FTP | other *** search
Text File | 1999-03-04 | 1.1 KB | 45 lines | [TEXT/ToyS] |
- on run
- DelayNote()
- end run
-
-
- on DelayNote()
- -- Get out a here
- tell application "Finder" to activate
-
- -- You should always test if you are in the background before posting a notification
- WaitUntilWeAreNotFront()
-
- -- Post it
- set myNote to ¬
- («event ÅkuSÑote» with «class ñEye» given «class ñStr»:¬
- "Hey dude, I need some attention!", «class ñIcn»:150 ¬
- , «class ñSnD»:"Indigo")
-
- -- Wait for the user to swap us back (or BP2F)
- WaitUntilWeAreInFront()
-
- -- Remove it from queue - good practice!
- «event ÅkuSÑote» myNote with «class ñEnd»
-
- display dialog ¬
- "Hi there. Thanks for coming back." & return & return & ¬
- "Bye now." buttons {"OK"} default button 1
- end DelayNote
-
-
- on WaitUntilWeAreNotFront()
- -- Check if we are still front…
- repeat until (frontmost process with comparison to me) is 0
- pause for 5 with seconds timing
- end repeat
- end WaitUntilWeAreNotFront
-
-
- on WaitUntilWeAreInFront()
- -- Check if we are still back…
- repeat until (frontmost process with comparison to me) is not 0
- pause for 2 with seconds timing
- end repeat
- end WaitUntilWeAreInFront
-