Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Startup Program
Message
De
27/01/2005 06:23:53
 
 
À
27/01/2005 05:40:16
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 7
OS:
Windows XP
Network:
Novell 4.x
Database:
Visual FoxPro
Divers
Thread ID:
00981133
Message ID:
00981140
Vues:
35
Hi Saifuddin,

here is my startup program, called STARTOPP which is startup in norwegian. I have used this program since VFP6 or VFP7, so it could probably be improved, but 'if it ain't borke don't fix it'!

In my systems, all the program files are run from the local machine, C:\BEAS. My program set a few parameters before it checks if the local PRGs are older than the PRGs on the server, and if so, they are updated. For a new computer, the local directory is first created, and all the PRGs are copied. Also most settings are in the OPPSTART.DBF, so they can easily be changed. The important thing is that the startup should be made only once, and then, hopefully, never changed. The OPPSTART.DBF however is frequently updated.
LPARAMETER lcStartProg
LOCAL llForce
IF pcount()>0 and vartype(lcStartProg)='L'
  llForce=lcStartProg
ENDIF
IF vartype(lcStartProg)#'C'
  lcStartProg=''
ENDIF
set library to
set defa to p
SET TALK OFF
* SET AUTOSAVE OFF
* SET BELL OFF
* SET CURRENCY LEFT
* SET CURRENCY TO  "Kr."
* SET DATE ITALIAN
* SET EXCLUSIVE OFF
* SET HEADINGS OFF
* SET HOURS TO 24
* SET NEAR ON
* SET STATUS OFF
LOCAL lcCaption,lcLocalDrive,lcLockFile,lnArrayElement,lcOldcaption,lcScript,llcopy
LOCAL lcStartProg,lnFileCntOrg,lnFileCntNew,lnSelect,lnCounter,llKopier,lcFileToCopy
*!*  LOCAL lcCaption,lcNetFile,lcLocalDrive,lcLockFile
*!*  LOCAL lcStartProg,lnFileCnt,lcDrive,lcTextFile,lnSelect
#DEFINE CRLF CHR(13)+CHR(10)
lnSelect=SELECT()
lcOldcaption=_screen.Caption

IF USED('oppstart')
  SELECT oppstart
ELSE
  SELECT 0
  USE oppstart shared
ENDIF
lcScript=''
SCAN FOR UPPER(jobbid)='SET'
  lcScript=lcScript+'SET '+trim(jobb)+' '+target+CRLF
ENDSCAN
=EXECSCRIPT(lcScript)
LOCATE FOR UPPER(jobbid)='OVERSKRIFT' && OVERSKRIFT=Caption
lcCaption=TRIM(jobb)
IF EMPTY(lcStartProg)
  LOCATE FOR UPPER(jobbid)='STARTPRG'
  lcLocalDrive=TRIM(target)
  lcStartProg=TRIM(target)+TRIM(jobb)
ENDIF
LOCATE FOR UPPER(jobbid)='LOCKFILE'
lcLockFile=TRIM(jobb)
CLEAR SCREEN
_screen.Caption=lcCaption
IF FILE(lcLockFile)
  WAIT WINDOW 'Can not copy new program files, old are used' NOWAIT TIMEOUT 5
  USE
  SELECT (lnSelect)
  DO (lcStartProg)
  _screen.Caption=lcOldcaption
  RETURN .t.
ENDIF
SCAN FOR !EMPTY(target)
  IF ADIR(xx,lcLocalDrive,'D')=0
    MD (lcLocalDrive)
  Endif
  RELEASE xx
ENDSCAN

SCAN FOR UPPER(jobbid)='KOPIER'
  RELEASE laFraFil,laTilFil
  lnFileCntOrg=ADIR(laFraFil,TRIM(base)+TRIM(jobb))

  IF lnFileCntOrg>0
    lnFileCntNew=ADIR(laTilFil,TRIM(target)+TRIM(jobb))
    FOR lnCounter=1 to lnFileCntOrg
      lcFileToCopy=laFraFil(lnCounter,1)
      llkopier=.F.
      IF lnFileCntNew>0
        lnArrayElement=ASCAN(laTilFil,lcFileToCopy,1,0,1,9)
        IF lnArrayElement=0 OR laTilFil(lnArrayElement,2)#laFraFil(lnCounter,2);
          OR laTilFil(lnArrayElement,3)<laFraFil(lnCounter,3)
          llKopier=.T.
        ENDIF
      ELSE
        llKopier=.T.
      ENDIF
      IF llKopier or llforce
        llcopy=.T.
        WAIT WINDOW (laFraFil(lnCounter,1)) NOWAIT
        COPY FILE (TRIM(base)+laFraFil(lnCounter,1)) TO (target+laFraFil(lnCounter,1))
      ENDIF
    NEXT
  ENDIF
ENDSCAN
IF llCopy
  WAIT WINDOW 'Finished updating!' TIMEOUT 5
ENDIF

USE
SELECT (lnSelect)
_screen.Caption=lcOldcaption
DO (lcStartProg)
Structure of OPPSTART.DBF:
Field Name      Type                Width
JOBBID          Character              10 
JOBB            Character              20 
BASE            Character              20 
TARGET          Character              20
Sample data from OPPSTART.DBF
  JOBBID     JOBB                 BASE                 TARGET
------------------------------------------------------------------
  kopier     *.prg                prog\                C:\BEAS\            
  kopier     *.h                  prog\                C:\BEAS\            
  startprg   mainwin                                   C:\BEAS\            
  lockfile   lockfile.txt                                                  
  overskrift Oppstart-program                                              
  set        autosave                                  off                 
  set        bell                                      on                  
  set        currency                                  left                
  set        currency                                  to 'Kr.'            
  set        date                                      italian             
  set        exclusive                                 off                 
  set        headings                                  off                 
  set        hours                                     to 24               
  set        near                                      on                  
  set        status                                    off                 
  set        safety                                    off
>Hi,
>
>I have a password form but before that I want to run a startup.prg in which all path, variables and other parameters should be defined. Can anyone give me a professional approach to define this prg.
>
>Thanks/Regards - Saif
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform