Here is one way to implement this feature. The following script will
automatically return to the first card in a stack when it has remained on
any card for more than 30 seconds and the mouse has not moved. If you are
performing some operations and you would like to reset the time manually,
you can call the resetTime handler which has the same affect as moving the
cursor. The time will be automatically reset when the user goes to a new
card so it is not necessary to reset the time when going to a new card.
Put this code in a stack or background script:
on openCard
global startTime, cursorLoc
put the long time into startTime
convert startTime to seconds
put the mouseLoc into cursorLoc
end openCard
on idle
global startTime, cursorLoc
-- Change the next line to set your time limit.
put 30 into timeLimit
-- Change the next line to set the return card number.
put 1 into returnCard
put the mouseLoc into currentLoc
if cursorLoc <> currentLoc then
put currentLoc into cursorLoc
resetTime
end if
put the long time into endTime
convert endTime to seconds
if (endTime - startTime) > timeLimit then
if the number of this card <> returnCard then
go to card returnCard
end if
resetTime
end if
end idle
on resetTime
global startTime
put the long time into startTime
convert startTime to seconds
end resetTime
This article is adapted from the Claris Tech Info database.