Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
I want to start an app every 10 Minutes
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00735793
Message ID:
00739109
Views:
24
I have created a timer app that runs 16 different VFP apps and non-apps depending on the time entries contained in the time-tables...

Shared here even though this may be too elaborate for what you need...
scan
      If Active                                                       && Active Test
         If SubStr(Upper(CDOW(DateTime())),1,3) $ Dow                 && Day-Of-Week Test  or  Today already-run Test
            If IIf(Year(DateTime()) > Year(LastRun), .T., Iif(Month(DateTime()) > Month(LastRun), .T., Iif(Day(DateTime()) > Day(LastRun), .T., Iif(Day(DateTime()) = Day(LastRun), IIF(CTOT(Time) > DATETIME(), .T., .F.), .F.)))) 
               lTimeWarp= .F.
               IF IIF(Hour(DateTime()) > Hour(cToT(Time)), .T., IIF(!(Hour(cToT(Time)) > Hour(DateTime())) AND !(Minute(cToT(Time)) > Minute(DateTime())), .T., .F.))
                  lTimeWarp= .T.    && The Hour has Passed
               ENDIF
               IF lTimeWarp
                  If !(SubStr(Upper(CDOW(DateTime())),1,3) $ Skip)    && Skip Test
                     IF ALIAS()= "ACRON"
                        Replace LastRun With DateTime()
                        lRunSomething= .T.
                     *** Build Program Switch!
                     *   Accumulate all request for this run time!
                     *   If any run is Test, All Runs are Test (no Production)!
                     *** Program Switch Complete
                        cProgramSwitch= cProgramSwitch+ AllTrim(Program) 
...
                        Replace LastRun With DateTime()
                        lRunExecutable= .T.
                        EXIT      // Leave Scan
                     ENDIF        // TABLE SELECTION
                  EndIf           // Skip Requested
               EndIf              // Time Passed (TimeWarp)
            EndIf                 // Ran Already
         EndIf                    // Day Of Week
      EndIf                       // Active      
   EndScan
   If lRunSomething
      Do WriteLog
      cRunScript= "C:\ACRON\AC.bat "+ cProgramSwitch
      loWRun=CreateObject("Wscript.Shell")
      loWRun.run("&cmnd &cRunScript",0,0)
      loWRun=NULL
   EndIf 
   IF lRunExecutable
      Do WriteLog
      cRunScript= "Run /n "+ cProgramSwitch
      &cRunScript
   ENDIF
...
Edgar L. Bolton, B.S. B.B.A.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform