David,
    This is the entire check. WMI works if you can actually check for a given 
program on the list as well; watch out for WMI for it gets blocked in some 
cases...

'Assuming each val is for minutes:
   globalTimer = SetCheckTimer, 5
Function SetCheckTimer( TimerVal)
 If globalTimer > 0 Then
  StopTimer globalTimer
  globalTimer = 0
 ' End of global timer.
 End If
'Save just in case app fails.
  INIFile(myINIFile).Number( "Configuration", "Global_Timer") = globalTimer

'For seconds:
' timerVal = timerVal * 1000
'For Minutes:
 timerVal = timerVal * 60000
 ' Now set the timer and send its val back to the function!
  SetCheckTimer = StartTimer( timerVal, "CheckForState")
' End of function SetCuckooClockTimer
End Function

Sent: Thursday, January 22, 2015 9:23 AM
Subject: Re: Think I could need a bit of help...


You might also take a look at the approach which takes advantage of WMI
described more here:
http://stackoverflow.com/questions/760904/how-can-i-monitor-a-windows-directory-for-changes.

Steve


On 1/22/2015 9:08 AM, LBX wrote:
> Dave,
>      This will check it at the 5 minute mark.
>
> Sample Format:
>    StartTimer 250, "SetFocus", dObj.Control( dID )
> Your Format:
>    StartTimer 50000, "CheckForState"
> Sub CheckForState()
> End Sub
>
> Sent: Thursday, January 22, 2015 6:05 AM
> Subject: Think I could need a bit of help...
>
>
> Scripters,
> In one of my projects, I need some routine to check a certain state of
> things, with given intervals. This should be done in the background,
> with as little interference with the user's activity, as possible. Let's
> for instance say, you want to check if a file has been updated, and you
> want to do that every 5 minutes, all through the day.
>
> OK, I have one idea, but wanted to know if the WE API gives a better
> solution, and if so, could someone please point me to some code or the
> like, that illustrates how to implement. Here is the idea I have, but
> not sure if it is all that waterproof, or if it holds any chance of
> malfunctioning the app.
>
> Sub CheckForState()
>       Sleep 5000     'Let's just give it five seconds interval.
>       ' code activity goes here...
>       CheckForState()
> End Sub 'ChackForState.
>
> In other words, a simple, recursive sub, that will keep running all till
> the app closes. Yet, what if I need to end it from running, at any given
> state throughout the app execution? Like I said, not sure if this is the
> best and most smooth way to handle this task, so if anyone has a better
> idea, I am all ears.
>
> Thanks,
>


---
This email has been checked for viruses by Avast antivirus software.
http://www.avast.com

Reply via email to