detect user activity to adjust scripts speed automatically