Idle interval too long...
Idle interval too long...
- Subject: Idle interval too long...
- From: Steven Sanders <email@hidden>
- Date: Sat, 29 Mar 2003 16:27:37 -0700
Hi,
I am making a script to give me a list of previous mouse positions at
100 millisecond intervals.
I am going to use this in FileMaker Pro.
The reason I want a "list" instead of "where is the mouse now?" is
because, FMP has a time-lag
and I can easily move the mouse 200 pixels by the time it executes an
AppleScript via a button.
Therefore, I want a list so I can see the trajectory of movement and
compute where it slowed down
to make the click (haven't done this part yet but have confirmed that I
need it).
The following makes the list using 'Event Suites':
____________________________________________
property mousePositions : {"", ""} -- list of mouse positions
property queLength : 10
on idle
try
tell application "Extra Suites"
set {thisPosition} to {mouse location}
-- set xyz to causeError -- cause testing for error
end tell
on error
tell application "FileMaker Pro" to display dialog "Get Mouse
Location, idler can't get mouse position"
quit me -- THIS WON'T QUIT & 'quit' by itself won't quit
end try
try
-- save last 'N' mouse positions
if (count of mousePositions) < queLength then
set end of mousePositions to thisPosition
else
-- the count of 'mousePositions' is always 'queLength'; throw
away oldest position 1
set mousePositions to items 2 thru queLength of mousePositions
set end of mousePositions to thisPosition
end if
on error
tell application "FileMaker Pro" to display dialog "Programming error
pushing down list."
return 1
end try
-- beep -- RETURN 0.1 DOESN'T WORK and this stops beeping.
return 1
end idle
____________________________________________
My questions are:
1. The handler stops executing if I use a 'Return' less than 1 second.
How can I get this to run every 100 milliseconds?
2. How do I combine the following lines into one line?
set mousePositions to items 2 thru queLength of mousePositions
set end of mousePositions to thisPosition
3. In the error handler, 'quit me' (or 'quit') doesn't work.
How do I get the idler to programmatically quit?
Thanks,
Steven
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.