Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!bu.edu!dartvax!Eric.J.Baumgartner From: Eric.J.Baumgartner@dartmouth.edu (Eric J. Baumgartner) Newsgroups: comp.sys.mac.hypercard Subject: Re: How to tell when really idle? Message-ID: <1991May5.214456.5228@dartvax.dartmouth.edu> Date: 5 May 91 21:44:56 GMT References: Sender: news@dartvax.dartmouth.edu (The News Manager) Organization: Dartmouth College, Hanover, NH Lines: 33 This routine won't always work but unless the user is pounding away in a text field and never makes a mistake (or fixes mistakes with the arrow keys) it'll do OK. If nothing else, it's a starting place for a better idle checker, because mouse activity tends to be a good test to "non-idleness". on idle global lastMouseLoc, idleSinceWhen put 5*60*60 into idleTicksThreshold -- 5 minute threshold if (the mouseLoc <> lastMouseLoc) then if (the ticks - idleSinceWhen) > idleTicksThreshold then doYourIdleRoutine end if else put the mouseLoc into lastMouseLoc put the ticks into idleSinceWhen end if -- pass idle -- if necessary end idle If someone figures out how to deal with keystrokes as well, I'd love to see it. * lightbulb suddenly appears over head... BING * Actually, what might work is in addition to checking that the mouse is in the same place, check to see if the selectedChunk is the same as it was before. If the user is typing merrily along the selectedChunk should change. I'll leave that one as an exercise for the reader, who can then tell me if it works. :-) Eric Baumgartner Interactive Media Lab Dartmouth Medical School