Source language: Translate to:

Idle

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Idle

Postby Alex » Fri May 11, 2012 5:28 am

Hi,

Is there a way to know if the pub is in idle mode?

For example after 60 seconds then [idlemode] = 1 and if I use again the pub then [idlemode] = 0

Thanks


Alex
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby Tony Kroos » Fri May 11, 2012 6:47 am

Book->Book Properties->Actions->Idle event
Tony Kroos
 
Posts: 402
Joined: Thu Oct 15, 2009 3:43 pm

Postby Alex » Fri May 11, 2012 6:51 am

Hi,

Yes thanks, but when my pub is not on idle, how can I know it?

Thanks


Alex
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby Tony Kroos » Fri May 11, 2012 6:56 am

and if I use again the pub then [idlemode] = 0

hmm... then I suppose you have to place [idlemode] = 0 in every action of every object on the page. Well, at least Mouse over actions... If mouse is moving then pub is not idle... it's stupid but will work )
Tony Kroos
 
Posts: 402
Joined: Thu Oct 15, 2009 3:43 pm

Postby Tony Kroos » Fri May 11, 2012 7:00 am

if you have a background wallpaper then handle it's mouse events, that should be enough...
Tony Kroos
 
Posts: 402
Joined: Thu Oct 15, 2009 3:43 pm

Postby Alex » Fri May 11, 2012 7:02 am

Hi,

Or maybe it is possible to know if the pub is on top?

Thanks


Alex
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby Tony Kroos » Fri May 11, 2012 7:09 am

it is possible to know if the pub is on top?

yes but you will need a plugin
Tony Kroos
 
Posts: 402
Joined: Thu Oct 15, 2009 3:43 pm

Postby Alex » Fri May 11, 2012 7:10 am

Hi,

Witch one?

Thanks


Alex
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby Tony Kroos » Fri May 11, 2012 7:39 am

I don't remember... you need to get a state of any given window (by it's caption or handle), I've seen it somewhere... maybe one of HPW plugins?
Tony Kroos
 
Posts: 402
Joined: Thu Oct 15, 2009 3:43 pm

Postby Alex » Fri May 11, 2012 10:51 am

Hi,

Ok thanks, maybe can Dave help us?

Thanks


Alex
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby Alex » Fri May 11, 2012 2:26 pm

Hi,

I will explain it better.

I have a timer that I want to stop when the pub is on idle and that it starts again when the pub is not idle anymore.

Is there a way to do it?

Thanks


Alex
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby Tony Kroos » Fri May 11, 2012 6:23 pm

Since there's no "Not Idle" action, you must define what is "not idle" by yourself. It may be mouse actions or user input, or something else... and put actions in appropriate place.
Ok thanks, maybe can Dave help us?
that's an easy way ) He may create a callback subroutine for "not idle" event (but define it first)
Tony Kroos
 
Posts: 402
Joined: Thu Oct 15, 2009 3:43 pm

Postby josesito » Fri May 11, 2012 6:28 pm

In section "Idle Event" write:

TimerStop "TimerX"
SetVar "[WindowState]" "Minimized"

(don´t forget to activate this funtion otherwise it won´t work)

This will force your user to maximize the program again.

......................
In section "Activate" write:

TimerStart "TimerX" "1000"

(this will start your timer again)
josesito
 
Posts: 53
Joined: Sat Sep 26, 2009 6:44 pm

Postby Gaev » Fri May 11, 2012 6:51 pm

Alex:

You are either confusing Idle (i.e. no mouse/keyboard action by user while your program has focus) with Deactivated/Activated (i.e. user navigates to another window/program ... and later returns to it) ... or you have changed your requirement during the course of this topic discussion.

If you just want to count the time that has elapsed when your pub/exe has focus ... then you can ...

1) Stop your Timer object in the pub's Deactivated section (also under Book Properties >>> Actions) ... and add time elapsed so far to [StoppedTime].

2) Recreate a Timer object in the pub's Activated section.

Each Timer's Interval section can show the accumulated elapsed time (say [Elapsedtime]) by adding the Timer's current elapsed time to [StoppedTime].


So you start with [StoppedTime] and [ElapsedTime] at zero.

Say the user stays on your pub for 5 seconds ... then [ElapsedTime] and [StoppedTime] are frozen at 5

Say user returns to your pub after xx seconds

After 1 second, [StoppedTime] is still 5 but [ElapsedTime] is 6 (5 + 1)

After 2 seconds, [StoppedTime] is still 5 but [ElapsedTime] is 7 (5 + 2)

If the user leaves your pub after 2 seconds, [StoppedTime] is now 7 (5 plus 2)

So when user returns, [ElapsedTime] is 7 + whatever time the new Timer is running.
User avatar
Gaev
 
Posts: 3737
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby josesito » Fri May 11, 2012 7:01 pm

I am not confusing Idle with Deactivated/Activated, this is only a simple way to do it, of course there are other ways, this is only something Alex can do in order to achieve what he wants, I guess it depends on what the Timer is doing. Also, if neccesary there should be some reset of varibles in the Idle section to achive the correct results.

The timer should include something like this:

If "[stop]" "=" ""
GotoLine "continue"
Else
GotoLine "stop"
EndIf

:continue
SetVar "[stop]" ""
.do the proccess
.

:stop
.don´t do the proccess
.

..............
The Idle section should include:
SetVar "[stop]" "yes"

This will trigger the stop proccess inside the timer.

.............
Then the "Activate" section should include:
SetVar "[stop]" ""
Last edited by josesito on Fri May 11, 2012 8:05 pm, edited 1 time in total.
josesito
 
Posts: 53
Joined: Sat Sep 26, 2009 6:44 pm

Next

Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 1 guest

cron