Olaf & company,
If it weren't for the understaffing and backlog of work I'm facing, I think it might be better to redesign this system launch via a proper prg and DO FORM followed bythe READ EVENTS and closing cleanup code I usually use. I'm going to throw this whole mess out there in case somebody has the time and sees something i'm not seeing. The timer is one thing I can't fathom in a screen as opposed to a form.
I gave him an AutoUpdate framework which i use everywhere. He cut it down to about 1/10th the original size and I've included his version here. My other systems have many of the usual features you'd expect including the RUN /N WHATEVER.EXE name line so the auto updater can unload once the real exe is downloaded and launched. This is also missing all the code i use to compare and check for newer versions before launching the app. I also use version checker code for time and date comparisons to keep people from launching outdated EXEs in both the autoupdaters launching them and the main EXE repeats the code in case any wise guys make their own shortcuts or try and run from the server.
This is what I found in his auto-updater.
set talk off
set safety off
m.nFileHnd = fopen("c:\fsrecertfso\fsrecertfso.exe" , 12)
if m.nFileHnd > 0
m.lSuccess = fclose(m.nFileHnd)
if dtoc(fdate("j:\fsrecertfso\fsrecertfso.exe")) + ftime("j:\fsrecertfso\fsrecertfso.exe") <> dtoc(fdate("c:\fsrecertfso\fsrecertfso.exe")) + ftime("c:\fsrecertfso\fsrecertfso.exe")
copy file j:\fsrecertfso\fsrecertfso.exe to c:\fsrecertfso\fsrecertfso.exe
endif
do c:\fsrecertfso\fsrecertfso.exe
endif
Back to thwe opening of the actual application's prg, I repeat those lines here.
set sysm off
*
_screen.windowstate = 2
_screen.caption = 'Food Stamp Recertifications FSO'
_screen.closable = .f.
_screen.minbutton = .t.
_screen.maxbutton = .t.
_screen.picture = 'recertFSO.bmp'
_screen.icon = 'recertFSO.ico'
m.recNumber = 0
m.cSearchStr = ''
m.retvalue= ''
m.insystem = .t.
m.rdate = {}
m.cunit = ''
m.unit = ''
m.casenum = ''
m.reschDate = datetime()
m.from = datetime()
m.to = datetime()
m.name = ''
Then his timer object checks for the absence of a file I use to clear all users in case of no IT staff in the office - which is where my problem may be...
otimer = createobject("mytimer")
That timer Event uses the following code in the user event:
if file("keepthem.out")
if _screen.formcount = 0
ACTIVATE POPUP file
keyboard "{ALT+X}"
endif
for i = 1 to _screen.formcount
_screen.activeform.release
endfor
m.insystem = .f.
endif
This same timer control is used on one from from the menu, the schedule display) at 1200000 milliseconds if the user opens the schedule which should not even come into play as we're not even using the menu
The screen params fire first then the logon form is opened by the prg and if the user gets their userID and Password coerrect, it set a variable (m.insystem) and unloads. The m.insystem condition is used by the prg again after the form unloads. If it's true, you remain in the prg. It also used as a set condition to to exit the menu.ppr. Anyway -
A table is selected, a record appended, and it records a time stamp, username and time logged in.
if m.insystem
use schedule in 0 order dateunit
use resch in 0
use monthly in 0
use noshows in 0
use user in 0
sele user
append blank
* repl username with "JOHN MOJTA"
repl username with subs(sys(0), at("#", sys(0)) + 2)
repl machine with subs(sys(0), 1, at("#", sys(0)) - 2)
repl login with datetime()
repl loginid with users.username
The next exec statement in the prg is to do Main.mpr. The m.insystem value is used in decisions as you navigate through the program and is can also be reset by the Exit option of the menu to .f.
DO Main.mor
endif
After the menu exit, the prg will select the same table and record that you time stamped on your way in time stamp your time you log off. End of prg is:
close all
clear all
release all
set sysm to defa
_.screen.picture = ''
_screen.caption = 'Microsoft Visual FoxPro'
so the original developer can go back to the VP platform .
I do not see where a loop is running except the timer cycling(?) every 60 seconds.
The unsettling part of this is that there is no Read Events line anywhere.
I know from experience the original developer couldn't really use a report generator either so I can't say where his FoxPro experience left off - he was especially co-operative and was let go years ago.
FYI - I've included the following which is the entire MPR code below this point in case you're curious. Thank you for your time and any ideas greatly appreciated
:
* *********************************************************
* *
* * 04/11/14 MAIN.MPR 15:36:25
* *
* *********************************************************
* *
* * Author's Name
* *
* * Copyright (C) 2014 Company Name
* * Address
* * City, Zip
* *
* * Description:
* * This PROGRAM was automatically generated BY GENMENU.
* *
* *********************************************************
* *********************************************************
* *
* * Menu Definition
* *
* *********************************************************
*
SET SYSMENU TO
SET SYSMENU AUTOMATIC
DEFINE PAD _41j0xg8s3 OF _MSYSMENU PROMPT "\<File" COLOR SCHEME 3 ;
KEY ALT+F, ""
DEFINE PAD _41j0xg8s4 OF _MSYSMENU PROMPT "\<Utility" COLOR SCHEME 3 ;
KEY ALT+U, ""
DEFINE PAD _41j0xg8s5 OF _MSYSMENU PROMPT "\<Reports" COLOR SCHEME 3 ;
KEY ALT+R, ""
DEFINE PAD _41j0xg8s6 OF _MSYSMENU PROMPT "Repro-\<Graphics" COLOR SCHEME 3 ;
KEY ALT+G, "" ;
SKIP FOR GL_RUNLETTERS = .F.
ON PAD _41j0xg8s3 OF _MSYSMENU ACTIVATE POPUP file
ON PAD _41j0xg8s4 OF _MSYSMENU ACTIVATE POPUP utility
ON PAD _41j0xg8s5 OF _MSYSMENU ACTIVATE POPUP reports
ON PAD _41j0xg8s6 OF _MSYSMENU ACTIVATE POPUP reprograph
DEFINE POPUP file MARGIN RELATIVE SHADOW COLOR SCHEME 4
DEFINE BAR 1 OF file PROMPT "\<View Sch"
DEFINE BAR 2 OF file PROMPT "E\<xit"
ON BAR 1 OF file ACTIVATE POPUP viewschedu
ON SELECTION BAR 2 OF file m.insystem = .f.
DEFINE POPUP viewschedu MARGIN RELATIVE SHADOW COLOR SCHEME 4
DEFINE BAR 1 OF viewschedu PROMPT "Unit B\<C F/S Dept"
DEFINE BAR 2 OF viewschedu PROMPT "Unit B\<E"
DEFINE BAR 3 OF viewschedu PROMPT "Unit B\<G"
ON SELECTION BAR 1 OF viewschedu ;
DO _41j0xg8s7 ;
IN LOCFILE("FSRECERTSFSO\MAIN" ,"MPX;MPR|FXP;PRG" ,"WHERE is MAIN?")
ON SELECTION BAR 2 OF viewschedu ;
DO _41j0xg8s8 ;
IN LOCFILE("FSRECERTSFSO\MAIN" ,"MPX;MPR|FXP;PRG" ,"WHERE is MAIN?")
ON SELECTION BAR 3 OF viewschedu ;
DO _41j0xg8sj ;
IN LOCFILE("FSRECERTSFSO\MAIN" ,"MPX;MPR|FXP;PRG" ,"WHERE is MAIN?")
DEFINE POPUP utility MARGIN RELATIVE SHADOW COLOR SCHEME 4
DEFINE BAR 1 OF utility PROMPT "\<Make Schedule" ;
SKIP FOR GL_MAKESCHED = .F.
DEFINE BAR 2 OF utility PROMPT "Select \<Printer"
DEFINE BAR 3 OF utility PROMPT "Re\<index"
ON SELECTION BAR 1 OF utility do form makesch
ON SELECTION BAR 2 OF utility set printer to name getprinter()
ON SELECTION BAR 3 OF utility do form reindx
DEFINE POPUP reports MARGIN RELATIVE SHADOW COLOR SCHEME 4
DEFINE BAR 1 OF reports PROMPT "\<Schedules"
DEFINE BAR 2 OF reports PROMPT "\<Reschedules"
DEFINE BAR 3 OF reports PROMPT "\<No Shows"
DEFINE BAR 4 OF reports PROMPT "\<Case Numbers"
DEFINE BAR 5 OF reports PROMPT "\<Homeless List"
ON SELECTION BAR 1 OF reports do form prtsch
ON SELECTION BAR 2 OF reports do form prtresch
ON SELECTION BAR 3 OF reports do form prtnshow
ON SELECTION BAR 4 OF reports do form numsumm
ON SELECTION BAR 5 OF reports do form homelist
DEFINE POPUP reprograph MARGIN RELATIVE SHADOW COLOR SCHEME 4
DEFINE BAR 1 OF reprograph PROMPT "\<Letters"
DEFINE BAR 2 OF reprograph PROMPT "\<Archive Addresses"
DEFINE BAR 3 OF reprograph PROMPT "\<Reprint Letters"
ON SELECTION BAR 1 OF reprograph do form prtlet
ON SELECTION BAR 2 OF reprograph do prg_archiveaddrs
ON SELECTION BAR 3 OF reprograph do form prtltr
* *********************************************************
* *
* * Cleanup Code & Procedures
* *
* *********************************************************
*
do while m.insystem
activate menu _msysmenu
enddo
* *********************************************************
* *
* * _41J0XG8S7 ON SELECTION BAR 1 OF POPUP viewschedu
* *
* * Procedure Origin:
* *
* * From Menu: MAIN.MPR, Record: 7
* * Called By: ON SELECTION BAR 1 OF POPUP viewschedu
* * Prompt: Unit BC F/S Dept
* * Snippet: 1
* *
* *********************************************************
*
PROCEDURE _41j0xg8s7
sele schedule
set order to tag dateunit
m.cUnit = "BC"
set filter to unit = m.cUnit
go top
if eof()
messageBox("No appointments scheduled for this unit yet", 16, "Error Message")
set filter to
return
endif
m.rdate = dateX
do form sch
* *********************************************************
* *
* * _41J0XG8S8 ON SELECTION BAR 2 OF POPUP viewschedu
* *
* * Procedure Origin:
* *
* * From Menu: MAIN.MPR, Record: 8
* * Called By: ON SELECTION BAR 2 OF POPUP viewschedu
* * Prompt: Unit BE
* * Snippet: 2
* *
* *********************************************************
*
PROCEDURE _41j0xg8s8
sele schedule
set order to tag dateunit
m.cUnit = "BE"
set filter to unit = m.cUnit
go top
if eof()
messageBox("No appointments scheduled for this unit yet", 16, "Error Message")
set filter to
return
endif
m.rdate = dateX
do form sch
* *********************************************************
* *
* * _41J0XG8SJ ON SELECTION BAR 3 OF POPUP viewschedu
* *
* * Procedure Origin:
* *
* * From Menu: MAIN.MPR, Record: 9
* * Called By: ON SELECTION BAR 3 OF POPUP viewschedu
* * Prompt: Unit BG
* * Snippet: 3
* *
* *********************************************************
*
PROCEDURE _41j0xg8sj
sele schedule
set order to tag dateunit
m.cUnit = "BG"
set filter to unit = m.cUnit
go top
if eof()
messageBox("No appointments scheduled for this unit yet", 16, "Error Message")
set filter to
return
endif
m.rdate = dateX
do form sch