On 27 Mar 2015, at 5:40 am, Stan Cleveland <email@hidden> wrote:
You mean Shane's handler. This isn't the first time he (Shane Stanley) and I (Stan Cleveland) have been mistaken for one another.
I'm usually mistaken for someone much worse ;-)
On the subject of that handler, in my book it's like this:
on doEventFetch() repeat set theEvent to current application's NSApp's nextEventMatchingMask:(((current application's NSLeftMouseDownMask) as integer) + ((current application's NSKeyDownMask) as integer)) untilDate:(missing value) inMode:(current application's NSEventTrackingRunLoopMode) dequeue:true if theEvent is missing value then exit repeat else current application's NSApp's sendEvent:theEvent end if end repeat end doEventFetch
Now that's only clearing two types of event. I picked on them because they trap attempts to cancel a script, which was appropriate to the context. However, it's quite possible for other events to begin banking up, especially mouse movements, so it might be worthwhile adding NSMouseMovedMask in there too.
There is, in fact, a catch-all NSAnyEventMask, and in an ideal world, that's what I'd suggest. The problem is that it's an integer value beyond AppleScript's integer range, which means it gets converted to a real and doesn't work.
In Brian's case he might be better to use the Myriad Helpers equivalent, where it's defined as the -fordEvent method in the ObjectWithFords class. It should be quicker because it's done in Objective-C, but more importantly it uses NSAnyEventMask. So he'd define a property to hold an instance, and initialize it early:
set my notStan to current application's ObjectWithFords And from then on he'd call it like this:
|