J.M.,
This one is for you!
Five (5) easy steps to understand the entire process and
Running R:BASE Your Way!
Enjoy and make sure to have fun.
Very Best Regards,
Razzak.
September 4, 2001
==================================================================
>From the Edge: Understanding QUIT TO CodeLockedFile Command
Section: Distributing Your Applications (Code Lock)
Chapter: Running R:BASE Your Way!
Platform: R:BASE 2000 (ver 6.5) and Higher (DOS/Windows)
Build: 1.835xRT03 and Higher ...
==================================================================
Background:
The new QUIT TO Codelocked_FileName command files was first
supported on September 22, 2000 with the beta release of R:BASE
2000 (ver 6.5) for Windows - Pre In-Line Patch-3 (1.835axRT03).
The purpose of this feature was to support our CURRENT R:BASE
2000 (ver 6.5) customers who DID NOT use Application Express,
and wanted to distribute their completely menu-driven application
using individual commands which use QUIT TO another command file
to navigate their applications.
The typical example would be to have a startup DAT file which
will create application environment, initialize all global
variables, display startup welcome screen, show copyright stuff
and then QUIT TO MainMenu.RMD. And then, MainMenu.RMD displays
the main menu options on the form and based upon which button
was pressed, QUIT TO SubA.RMD. Once the SubA menu options are
displayed, the user clicks on any button on SubA menu which
QUIT TO SubA1.RMD and so on... Accordingly, SubA1.RMD has an
option to either QUIT TO SubA.RMD or can directly QUIT TO
MainMenu.RMD.
In order to understand this very simple philosophy, let's
create a simple codelocked application using the QUIT TO
options in your command file.
Using The Glorious R:BASE 2000 (ver 6.5++) Build:1.842 for
Windows, you can follow these steps:
Database: NewStuff (included with 6.5++ for Windows)
Forms: Copyrights (included)
MainMenu (included)
NewCVALFunctions (included)
NewGETVALFunctions (included)
NewGetDateFunction (included)
NewLaunchCommand (included)
NewPhoneCommand (included)
NewSetClipBoardCom (included)
New Startup: NewStuff.DAT
New Files: MainMenu.RMD
CVALFunc.RMD
GetValF.RMD
GetDate.RMD
Launch.RMD
RPhone.RMD
SetClpBD.RMD
EEPs: Button.EEP (included)
ClpBoard.EEP (included)
Computer.EEP (included)
CPrinter.EEP (included)
DialPhon.EEP (included)
Drives.EEP (included)
EMail.EEP (included)
GDReady.EEP (included)
GetVol.EEP (included)
GetPAE.EEP (included)
GetVPAW.EEP (included)
Launch.EEP (included)
NetUser.EEP (included)
Printers.EEP (included)
ScrnSize.EEP (included)
SetClpBD.EEP (included)
UserID.EEP (included)
USDomain.EEP (included)
WordDoc.EEP (included)
WordPerf.EEP (included)
Misc. Files: RBW65PP.TXT (included)
MailMrge.DOC (included)
MailMrge.WPD (included)
Step 00:
Copy NewStuff database (four files), twenty (20) EEPs and
three (3) miscellaneous files listed above to a temporary
Learning directory.
Example:
MD \Learning
CD \Learning
COPY C:\RBTI\SAMPLES\NewStuff\*.RB?
COPY C:\RBTI\SAMPLES\NewStuff\*.EEP
COPY C:\RBTI\SAMPLES\NewStuff\*.TXT
COPY C:\RBTI\SAMPLES\NewStuff\*.DOC
COPY C:\RBTI\SAMPLES\NewStuff\*.WPD
Step 01:
Launch The Glorious R:BASE 2000 (ver 6.5++) for Windows and
then switch the current working directory to C:\Learning
CONNECT NewStuff
Step 02: Create startup (.DAT) and command (.RMD) files.
Step 02-A: Create Startup NewStuff.DAT file.
RBEdit NewStuff.DAT (copy and paste the following code...)
and make sure to save the file.
-- NewStuff.DAT Application Startup File
SET RBGSIZE CENTER CENTER 800 600
MAXIMIZE
CLS
SET MESSAGES OFF
CONN NewStuff
SET QUOTES=NULL
SET QUOTES='
SET DELIMIT=NULL
SET DELIMIT=','
SET LINEEND=NULL
SET LINEEND='^'
SET SEMI=NULL
SET SEMI=';'
SET PLUS=NULL
SET PLUS='+'
SET SINGLE=NULL
SET SINGLE='_'
SET MANY=NULL
SET MANY='%'
SET IDQUOTES=NULL
SET IDQUOTES='`'
SET CURRENCY '$' PREF 2 B
SET CAPTION ' '
SET NULL ' '
SET VAR RBTI_NoStatus INTEGER = 1
SET VAR vCaption = 'R:BASE 2000 (ver 6.5++) for Windows!'
CLS
RHIDE
EDIT USING Copyrights CAPTION .vCaption NOHEADER
CLS
QUIT TO MainMenu.RMD
Step 02-B: Create MainMenu.RMD (copy and paste the following
code...) and make sure to save the file.
-- MainMenu.RMD Application Main Menu Options File
CLEAR ALL VAR EXCEPT RBTI_NoStatus, vCaption
SET CAPTION ' '
SET VAR vButton INTEGER = 99
LABEL Start
CLS
RHIDE
EDIT USING MainMenu CAPTION .vCaption NOHEADER
CLS
IF vButton = 99 THEN
GOTO Done
ENDIF
SWITCH (.vButton)
CASE 1
-- New CVAL Functions
QUIT TO CVALFunc.RMD
BREAK
CASE 2
-- New GETVAL Functions
QUIT TO GetValF.RMD
BREAK
CASE 3
-- New GETDATE Function
QUIT TO GetDate.RMD
BREAK
CASE 4
-- New LAUNCH Function
QUIT TO Launch.RMD
BREAK
CASE 5
-- New PHONE Command
QUIT TO RPhone.RMD
BREAK
CASE 6
-- New SET ClipBoard Command
QUIT TO SetClpBD.RMD
BREAK
DEFAULT
PAUSE 2 USING 'Under Construction' CAPTION .vCaption AT 16 32
BREAK
ENDSW
GOTO Start
LABEL Done
DEBUG RSHOW
DEBUG CLEAR ALL VAR
DEBUG SET MESSAGES ON
DEBUG SET ERR MESS ON
DEBUG RETURN
EXIT
Step 02-C: Create CVALFunc.RMD (copy and paste the following
code...) and make sure to save the file.
-- CVALFunc.RMD
CLEAR ALL VAR EXCEPT vCaption, RBTI_NoStatus
SET VAR vCurrentPrinter TEXT = NULL
SET VAR vPrinters TEXT = NULL
SET VAR vDrives TEXT = NULL
SET VAR vScreenSize TEXT = NULL
SET VAR vUserID TEXT = NULL
SET VAR vNetUser TEXT = NULL
SET VAR vComputer TEXT = NULL
SET VAR vUserDomain TEXT = NULL
SET VAR vClipBoardText TEXT = NULL
CLS
RHIDE
EDIT USING NewCVALFunctions CAPTION .vCaption
QUIT TO MainMenu.RMD
RETURN
Step 02-D: Create GetValF.RMD (copy and paste the following
code...) and make sure to save the file.
-- GetValF.RMD
CLEAR ALL VAR EXCEPT vCaption, RBTI_NoStatus
SET VAR vGetDriveReady TEXT = NULL
SET VAR vGetVolumeID TEXT = NULL
SET VAR vPlayAndWait TEXT = NULL
SET VAR vPlayAndExit TEXT = NULL
CLS
RHIDE
EDIT USING NewGETVALFunctions CAPTION .vCaption
QUIT TO MainMenu.RMD
RETURN
Step 02-E: Create GetDate.RMD (copy and paste the following
code...) and make sure to save the file.
-- GetDate.RMD
CLEAR ALL VAR EXCEPT vCaption, RBTI_NoStatus
SET VAR vGetDate DATE = NULL
CLS
RHIDE
EDIT USING NewGetDateFunction CAPTION .vCaption
QUIT TO MainMenu.RMD
RETURN
Step 02-F: Create Launch.RMD (copy and paste the following
code...) and make sure to save the file.
-- Launch.RMD
LABEL NewLaunch
CLEAR ALL VAR EXCEPT vCaption, RBTI_NoStatus
SET VAR vButton INTEGER = 99
CLS
RHIDE
EDIT USING NewLaunchCommand CAPTION .vCaption
IF vButton = 1 THEN
LAUNCH RBW65PP.TXT
GOTO NewLaunch
ENDIF
QUIT TO MainMenu.RMD
RETURN
Step 02-G: Create RPhone.RMD (copy and paste the following
code...) and make sure to save the file.
-- RPhone.RMD
CLEAR ALL VAR EXCEPT vCaption, RBTI_NoStatus
SET VAR vYesNo TEXT = 'No'
CLS
RHIDE
EDIT USING NewPhoneCommand CAPTION .vCaption NOHEADER
QUIT TO MainMenu.RMD
RETURN
Step 02-H: Create SetClpBD.RMD (copy and paste the following
code...) and make sure to save the file.
-- SetClpBD.RMD
CLS
CLEAR ALL VAR EXCEPT vCaption, RBTI_NoStatus
RHIDE
EDIT USING NewSetClipboardCom CAPTION .vCaption NOHEADER
QUIT TO MainMenu.RMD
RETURN
So, at this point we have the following ASCII command files:
. NewStuff.DAT (Step 02-A)
. MainMenu.RMD (Step 02-B)
. CVALFunc.RMD (Step 02-C)
. GetValF.RMD (Step 02-D)
. GetDate.RMD (Step 02-E)
. Launch.RMD (Step 02-F)
. RPhone.RMD (Step 02-G)
. SetClpBD.RMD (Step 02-H)
Step 03: Test Your Code and RENAME ASCII files ...
At the mighty R> prompt:
SET DEBUG ON
RUN NewStuff.DAT
. Check at least first eight options on the menu
. Click on Exit to get back to the R> prompt
. If DEBUG is SET to OFF, it will EXIT the application
. Once tested and verified, let's RENAME above eight files
RENAME NewStuff.DAT NewStuff.ASC
RENAME MainMenu.RMD MainMenu.ASC
RENAME CVALFunc.RMD CVALFunc.ASC
RENAME GetValF.RMD GetValF.ASC
RENAME GetDate.RMD GetDate.ASC
RENAME Launch.RMD Launch.ASC
RENAME RPhone.RMD RPhone.ASC
RENAME SetClpBD.RMD SetClpBD.ASC
Step 04: Now, let's CODELOCK above eight (8) ASCII files
to Binary Codelocked Command Files:
CODELOCK 1 NewStuff.ASC NewStuff.BAK NewStuff.DAT
CODELOCK 1 MainMenu.ASC MainMenu.BAK MainMenu.RMD
CODELOCK 1 CVALFunc.ASC CVALFunc.BAK CVALFunc.RMD
CODELOCK 1 GetValF.ASC GetValF.BAK GetValF.RMD
CODELOCK 1 GetDate.ASC GetDate.BAK GetDate.RMD
CODELOCK 1 Launch.ASC Launch.BAK Launch.RMD
CODELOCK 1 RPhone.ASC RPhone.BAK RPhone.RMD
CODELOCK 1 SetClpBD.ASC SetClpBD.BAK SetClpBD.RMD
At this point, you have the original *.ASC files,
backup *.BAK files, along with codelocked *.DAT and
*.RMD files!
Step 05: Let's test QUIT TO CodeLocked Command Files:
RUN NewStuff.DAT
Everything SHOULD work accordingly!
Keep in mind that EVERY command file is codelocked and
includes the statement like QUIT TO another codelocked
binary command file.
There you have it ...
Can't get any simpler than that to understand the logic.
Very complex applications can be designed using that
very simple methodology.
Please send any comments to: mailto:[EMAIL PROTECTED]
===================================-============================
Official R:BASE List Server: mailto:[EMAIL PROTECTED]
RBTI Events/Training: http://www.rbase2000.com/events
R:DCC Members: http://www.rbase2000.com/rdcc
================================================================
R:BASE, Oterro & R:Tango are registered trademarks of RBTI.
==================================-=============================