Change Idle Event Seconds - Page 2 - Forum

Forum Navigation
You need to log in to create posts and topics.

Change Idle Event Seconds

PreviousPage 2 of 2

@gaev

you only need to add one line of script only in each of the TextEntry Boxes.

Yes in the "Text Change Event" that fires at every keystroke.

... perhaps you can summarize what the Timer script can do to detect a user who spends 3, 5 or 10 minutes inside a single TextEntry Box.

I didn't put much work into it but it detects all activity at all times, keystrokes and mouse movement/clicks. It fulfills the required brief but, the way its setup, the Idle Event has to fire every 1000 milliseconds to produce a count, [IdleCount]. The timer fires every 1050 milliseconds to detect changes in that count. i.e whether it has increased (idle) or stayed the same (not idle). When it reaches [MaxCount], it goes to the required page stopping the timer. The Idle Event will still fire but wont trigger the timer unless it is manually restarted by a Push Button (SetVar "[TimerStarted]" "=" "0").

As I said, using it doesn't sit easy with me for that reason, nor does the "Text Change Event" banging off at every keystroke.

I may be just pedantic but I don't like using unnecessary code or plugins.

In this instance though, it maybe the only way.

 

@bonez

it detects all activity, Keystrokes and mouse movement/clicks

I checked out the IdleGaev publication you posted earlier.

I only saw scripts associated with the TimerInterval and the ElapsedTime subroutine ... unless I am missing something, I don't see how this checks for non-idle activity at all ... I will not comment further on this until you can explain how it traps keyboard and mouse activity.

I may be just pedantic but I don't like using unnecessary code or plugins.

Later today, I will send you the (promised) v2, which will detect all activity (but require a GoSub command in the TextChange event of TextEntry Boxes (not all objects).

If that is not acceptable, then you may want to consider asking on this forum for plugin developers to custom build a one-command plugin that meets your exact requirements.

My personal philosophy when developing Apps is that ...

- it is all about making do with what the platform offers (warts and all)
- personal likes/dislikes apart, I "pray at the alter of our lady of whatever works"

@gaev

I only saw scripts associated with the TimerInterval and the ElapsedTime subroutine ...

IdleGaev.pub was simply a quick and nasty trimmed down version of my requirements to show that the timer object does indeed work in conjunction with the Idle Event (in this situation anyway). It also may negate the need for any other code.

unless I am missing something, I don't see how this checks for non-idle activity at all ...

Maybe. I have provided a modified version of your IdleBonez.pub (IdleBonezModified.pub) by leaving all your code in place and commenting it out. I then added code from my IdleGaev.pub so you can better understand how it works.

- it is all about making do with what the platform offers (warts and all)

Check

- personal likes/dislikes apart, I "pray at the alter of our lady of whatever works"

Double Check

I look forward to your v2.

I think we are almost there.

Uploaded files:
  • You need to login to have access to uploads.

@bonez

IdleGaev.pub was simply a quick and nasty trimmed down version of my requirements to show that the timer object does indeed work in conjunction with the Idle Event (in this situation anyway).

For future reference, I don't decipher/debug other people's code ... I only responded to your original enquiry because you referenced something I had posted back in 2018 ... and then agreed to extend the proposed solution to include your additional requirements.

It also may negate the need for any other code.

I still don't see how it is going to trap keyboard activity. However, if it works for you, go ahead and use it.

To understand it a bit better I have provided a modified version of your IdleBonez.pub (IdleBonez(modified).pub) by leaving all your code in place and commenting it out. I then added code from my IdleGaev.pub so you can better see how it works.

At this time, I will work on delivering v2+ of the code (the one that traps changes to Pages, Focused Objects, Mouse Positions, and keyboard Input); you can then take it from there.

@gaev

For future reference, I don't decipher/debug other people's code

My apologies, I had no idea.

I will not comment further on this until you can explain how it traps keyboard and mouse activity.

I will do my best to explain.

My understanding is that Neo's inbuilt "activity monitor" detects all activity at all times. It detects all mouse movement, clicks and keyboard input. Or the lack thereof. Therefore it performs two actions. 1) If it doesn't detect any activity (idle activity) it triggers the Idle Event to start counting down using the Idle Event options check box and input field in Neo's Book Properties under Actions/Idle Event. 2) If it does detect activity (non idle activity) it pauses the Idle Event and resets the countdown.

With these options in mind, (counting down, albeit for only 1000 milliseconds in this case and pausing) when the user logs in, a variable [TimerStarted]=0 is set.

The Idle Event sees [TimerStarted]=0 and starts a timer which runs until stopped. It then sets [TimerStarted]=1 which stops itself from starting the timer again. Idle Event then continues adding 1 to the variable [IdleCount] every 1000 milliseconds while idle.

The timer takes note of [IdleCount] and stores it in the variable [Check] then waits 1050 milliseconds and checks it again.

If activity is detected by Neo's inbuilt "activity monitor" (mouse movements/clicks or keyboard activity), [IdleCount] will of course pause. When the timer checks again, it will see that [Check] still = [IdleCount] because [IdleCount] is paused and resets [IdleCount] to 0.

If no activity occurs, [IdleCount] increases to the preset time variable [IdleMinutes].

When the timer detects that [IdleCount]=[IdleMinutes], it stops itself and navigates to the login page.

When the user logs back in, the process starts over.

 

As I said in my previous post, this is simply a demonstration of how the Idle Event can indeed work alongside the timer object in relation to my requirements as I think we both presumed it wouldn't. The more options the better.

As you have vastly more experience than me, your v2 is the one I'm more interested in seeing.

@bonez

My understanding is that Neo's inbuilt "activity monitor" detects all activity at all times. It detects all mouse movement, clicks and keyboard input. Or the lack thereof.

I stand corrected ... I revisited the help file and it does say this.

In light of this additional information, the solution does become even more simplified ... no need to check for changes to Page Titles, Focused objects or Mouse Positions ... as they all require a Mouse or Keyboard activity.

I will modify v2 of the Sample/Demo publication ... still, no Timer Object required.

Another case of "teach an old dog new tricks" ... thanks.

@bonez

It is getting late over here, and I am tired ... but I wanted you to have a look at the publication while I sleep.

1) I stand corrected on my earlier statement where I said "I stand corrected"

While it is true that the Idle Event traps mouse and keyboard changes, in all the side tracked discussions I forgot the prime reason for checking for changes to Page Titles, Focused Objects and Mouse Position i.e. there is no provision in VNWin to notify you of the result, and so you have no way to reset variables depending on whether there was idleness or not.

So, the attached v2 publication checks all these in order to determine if there was any activity.

In order to check for activity inside TextEntry Boxes, you still need one line of script in the TextChange event section (check out the example on AppPage2).

I also added script to have the Idle Event code "do nothing" when in the LoginPage or ConfigPage.

I did not find any error situations during testing (although I did not test everything rigorously).

Note that GetObjectInfo can be used to enquire about the cursor position within a TextEntry Box ... which in turn can be used to determine keyboard changes ... unfortunately, this would require checking/managing a large number of values inside the IdleEvent section.

I will look for your feedback tomorrow morning.

Uploaded files:
  • You need to login to have access to uploads.

@gaev

HI Gaev.

Sorry mate. We had a breakdown at work so I have been busy with that.

Downloading now.

@bonez

We had a breakdown at work so I have been busy with that.

No worries ... been there, experienced that (spent 23+ years in Corporate IT; don't miss that life one bit).

Hi Gaev back again.

Its almost 5.30 am here and not long arrived home.  Things have been a bit over the top at work but its all finished.

Maybe now I can get back to enjoying my time off. If "Breakdown" "=" "0" Gosub "RestartTimeOff"

Anyhoo, I have tested IdleBonez2 quite a bit and seems to work great.

I will test more today.

@gaev

Sorry mate, forgot to include you in the last post.

Did more testing today with IdleBonez2 and it works extremely well. I'm very happy with it.

Did you have any more thoughts or additions?

 

@bonez

Glad it works.

I don't have any additions, but I would ...

- strongly suggest that you study/understand how things work ... so, when things don't appear to work, or new functionality is required, you can respond quickly.
- not get rid of the container showing the values of the related variables; instead, move the Container off screen
- keep VNWin's Idle Event Time to 15 seconds (30 seconds Max) so the actual Idle Times (3, 5, 10 minutes) are adhered closely

Good luck with the rest of your project.

@gaev

strongly suggest that you study/understand how things work

Going through the code has given me a few ideas.

I may add more to this post in the near future.

keep VNWin's Idle Event Time to 15 seconds (30 seconds Max) so the actual Idle Times (3, 5, 10 minutes) are adhered closely

Yes I see it can add to the overall time. That's fine.

 

Fantastic Gaev, your help and hard work has been much appreciated. Thanks mate.

PreviousPage 2 of 2