Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I auto-terminate FPD2.6

Status
Not open for further replies.

FoxEgg

Programmer
Mar 24, 2002
749
AU
I have a FPD2.6 application (Doctor's Billing and Patient Info Program) Main Prog and one huge procedure file.

I want to make sure the application closes down either

if there is no activity for say 10 minutes
or
alternatively at Midnight

Also can I intitiate the application (say at MidNight to do a backup or summut similar)

Thnx for you help.

John Fox (No relation to the program)
 
John,
The only way to do this in 2.x is to place the whole thing in a DO LOOP that cycles constantly. That will put some ugly processing in your system. It can be done, but you will need to fequently check the system date/time. If you decide to do it, make sure that you "Capture" the start-up date/time to a value. If you want it to take place at "Midnight", I wouldn't bother with the time. It is easier to just check for a change in the system date. This is better because, at whatever point in time the "Date" change occurs, it will still process. (For example, let's say your application is doing some other process, even an Idel process, and misses the switch to "Midnight" by 1 second, depending on how you have your "DO" loop constructed, it may not ever work, but if at any time in the LOOP's life, the system date "Changes", assume you have just passed the "Day" threshold, and start your process. If this is a large app, it must return to you "Idle" loop when not "Doing" anything else, or it will not work.
Best Regards,
Scott

Please let me know if this has helped [hammer]
 
Thanks...

I tried using onkey() (or was it inkey()).. very difficult.. losts of lost sleep.. I like your idea better...
Thanks again
 
The other way round is much easier. Initiate your app using the windows task scheduler. You can even add and capture a special parameter for this purpose to determine if the app has been launched manually by the user or by the OS.
 
Look at the READ clause "TIMEOUT".

TIMEOUT <expN3>

A TIMEOUT clause determines how long the READ is in effect. <expN3> specifies the number of seconds that can elapse without user input before the READ is terminated. If the READ is terminated by a TIMEOUT clause, READKEY( ) returns 20 if changes have not been made to any object. If changes have been made, READKEY( ) returns 276.
When READ is terminated by a TIMEOUT clause, any changes made to the field being edited when the READ ends are discarded. However, changes made to other fields are saved.
**********************************************************

With a little planning, you can do most anything with this, close tables, close screens, end FoxPro etc...etc....

HTH - Wayne
 
Dear All

Thanks to everyone for your help..

I tried the 'simple as chips' TIMEOUT on the READ statement

Works very very well.

Thanks Wayne....

(When the solution is sooooo simple in FPD2.6 makes me wanna stop bashing my head against the VFP wall)

John Fox
 
John,
Don't dispare, and don't give up on VFP. Remember 90% of what works in FP 2.6, still works in VFP. (Possibly much higher...) Spend a little more time in it, and the next time you try to go back to 2.x, you'll think, &quot;How archaic....&quot;

Best Regards,
Scott

Please let me know if this has helped [hammer]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top