*!*************************************************************** * codefile1.prg *!*************************************************************** * FPD26 Example only * Creates a table that stores a code name and code code * Allows program code to be compiled and run on the fly by seeking * the program name to run (stored in cprogram character field) * and running the associated code (stored in mcode memo field) * SET TALK OFF CLEAR IF FILE('codefile.dbf') USE codefile ALIAS codefile ORDER TAG cprogram ELSE RETURN ENDIF lcfunction="" lcFileName = SYS(2015) lcDelete=lcFileName + ".fxp" lcFileName=lcFileName+".prg" IF SEEK('get_ini','codefile','cprogram') IF !FILE(lcFileName) xfileh = FCREATE(lcFileName) ELSE xfileh = FOPEN(lcFileName,2) ENDIF IF xfileh=0 WAIT WINDOW "Cannot create the program." NOWAIT ELSE =FCHSIZE(xfileh,0) FOR i = 1 TO LEN(codefile.mcode) =FWRITE(xfileh,SUBSTR(codefile.mcode,i,1)) ENDFOR =FCLOSE(xfileh) ENDIF IF FILE(lcFileName) wkinifile = LEFT(SYS(2019),RAT('\',SYS(2019)))+'WORKSTAT.INI' PUBLIC lPointSize PUBLIC xreturn PUBLIC lcresult DO (lcFileName) WITH wkinifile,'[Defaults]','FontSize' lcfunction=LEFT(lcfilename,AT('.',lcfilename)-1) commandline="lPointsize="+; lcfunction+"(wkinifile,'[Defaults]','FontSize')" &commandline ?lPointSize ENDIF ELSE WAIT WINDOW "Could Not Find Program to Run." AT 22,35 ENDIF IF USED('codefile') USE IN codefile ENDIF IF FILE(lcFileName) DELETE FILE (lcFileName) ENDIF IF FILE(lcfunction) DELETE FILE (lcFunction) ENDIF IF FILE(lcDelete) DELETE FILE (lcDelete) ENDIF RETURN