Alpha FOUR Runtime The Alpha Four Runtime program lets you run customized database applications that were created in Alpha FOUR. The Runtime program protects the application you design from being edited or changed and gives your users the specific functionality you have designed into the application. Purpose of the runtime program The Runtime program allows developers to offer custom made applications to their clients without the need for Alpha Four. This process will shield the application and gives the users the appropriate functions. Advantage: Runtime is capable of protecting the application from any changes. The client must go back to the original developer to request any enhancements. Utilize specific functions of Alpha Four without the need of the software. Using the runtime version of Alpha FOUR could save money and memory space. Disadvantage: Any alteration of the application would not be possible within Runtime. Changes to the application have to be made within Alpha Four. Requires a well designed application to avoid problems. Steps in developing a runtime application The following represent a step-by-step procedure for developing a runtime program from you application. Some of these steps are optional. 1. Create your Application using Alpha FOUR. 2. Encrypt the Application using A4ENC.EXE. This provides protection for your application by allowing only the runtime program to run the application. Remember an encrypted application cannot be changed. You must keep a copy of the original application if you plan to make future changes. 3. Create a startup EXE file using A4EXEMKR.EXE. This allows you to create an EXE file to start the application with. This EXE file will include the application to run, startup database, shared path and script path to be used along with the runtime "engine." 4. Strip the desktops of drive and path references using A4STRPDT.EXE. This will remove any drive and path references that may be in your desktops. This allows you maximum flexibility when developing your application because you will no longer have to hard code the drive and path in the desktop. All data files should be stored in the startup directory. 5. Strip the Application and Field Rules of invalid drives and paths using A4MOVAPP.EXE. This allows you to remove any invalid drive and path references that may be in your Application Parameters or Field Rules. This gives you maximum flexibility when developing your application because you will no longer have to hard code the drive and path in the Application Parameters or Field Rules. All data files and script files should be stored in the startup directory. 6. Break apart large files using SPLIT.EXE. This will allow your application to be transferred to the client site on multiple disks. 7. Create your SETUP.DTA file for installation. By creating a setup file, it will ease the process of installation. This file will contain the necessary commands to stall your application and other essential files. 8. Copy the application onto the appropriate disks. Runtime Functions Display a custom design banner screen Encrypt the application (protection) Create an executable file Split any large file(s) into smaller ones Strip the path from Desktops Change any invalid drive and path Provide information to create a "SetUp" file for installation Creating the Application By planning ahead, and creating the databases & scripts in the directories you would want to store them in when installing, you can avoid the hassle of trying to move things around when you or the client installs your application at their site. The downside to this is that when you install, you have to decide whether or not you want to give your users the option of where to install your application. If you want to give them that option, then your application must be written as flexible as possible. If you do not want to give them that option, then you could hard code the data paths into the application. You may want to think about using desktops in your application instead of opening databases separately. This will help by allowing you to group commonly used databases together. Also, this will allow you to take full advantage of the A4MOVAPP.EXE program provided with Alpha Four Runtime. This will be covered in the section on A4MOVAPP.EXE. Script Libraries Advantages: All scripts are placed into 1 file - so that when you copy the scripts, you don't have many files to deal with. Any scripts sent out as part of an application cannot be edited, so you protect the integrity of your application. Disadvantages: Any scripts sent out as part of an application cannot be edited - if changes need to be made you must have a copy of the original scripts, edit that copy, and then recreate the library. To use the library you must run a script that "opens" the library. After you do this you can play any of the scripts contained in the library; but by hitting ALT-F3, Play a script or hitting ALT-F4, you can't play one contained in the library. Using the Quit command instead of escape to exit your Application When running an application through runtime, if you press the escape key from the application main menu, you will be asked to choose a new application to run. To avoid this, set up a menu item that "quits" from the application. Document what you create There are many types of files that will be created when building an application - DBF, DBT, SET, INx, RNx, RLN, SCP, PNx, etc. By keeping notes on everything that is created, it will be much easier to get things organized when you are ready to turn the application into a runtime application. Preparing for shipping Banner Screen When creating an application with Alpha FOUR, you are given the option of creating your own customized banner screen. When using Runtime, you can have this banner screen come up automatically when starting your application. You can do this by specifying your application as the startup application in 1 of 2 ways: 1. Use a DOS batch file to start the runtime application and use the -A parameter (ex:. A4RT -A=C:\A4RT\MYAPP). This "-A" parameter tells Alpha FOUR to automatically invoke the application. 2. Use the A4EXEMKR to create an executable file that will do this for you. A4EXEMKR is described in more detail later in the documentation. One thing to note about the banner screen that will come up. You will still see the Alpha Copyright information on the banner screen, but the rest of it will be your own. Printer Drivers Alpha Runtime does not come with any printer drivers of it's own. However printer configurations can be included with your application 2 different ways: 1. When creating the application in Alpha Four, choose the specific printer configurations your client will need. They will be contained in files with the name A4.PNx (refer to the listing of file names on page 9 of the Runtime User's Guide). Make sure to include these files with the application. The runtime user would then have these printer drivers, AND ONLY THESE DRIVERS to choose from when printing. 2. Include the PRINTER.DTA file in with your shipped application, and build into the Application the ability to choose a driver from the file. The PRINTER.DTA file contains all of the printer configurations Alpha currently supports. In this manner, the application does not become out of date when you buy a new printer. Note: If you are using a Postscript Printer, there are specific configurations for Postscript printer driver. These files have the extension of ".PS". For more detail information, please refer to the listing of file names on page 9 of the Runtime User's guide. Encrypting the Application Alpha Runtime allows you the option of encrypting your application. This procedure helps you to keep your application safe from alterations, even if your users have a copy of regular Alpha Four. The encrypted application can ONLY be used with the Runtime version of Alpha; it cannot be edited or run in regular Alpha Four. Please keep this in mind because if any changes do need to be made in the application, they could only be made to an UN ENCRYPTED application. So remember to keep a backup copy of your application. To encrypt an application use the A4ENC program: A4ENC [app to encrypt] [name of resulting file] (ex. A4ENC MYAPP ENC_APP). Using A4EXEMKR Instead of using a batch file to load your application, you have the option of creating an EXE file to do the same thing. The advantage to this is that the EXE really cannot be changed, whereas a batch file is very simple to edit. This also assures you that your application will always be starting with the same startup database, and any other optional parameters. Using SPLIT SPLIT.EXE is a utility provided with runtime that enables you to split large files into smaller pieces. If you are dealing with a large application that cannot fit onto a single disk (especially if you are using 5.25" DD floppies) then this program will come in very handy. SPLIT will break up your file into whatever size pieces you specify (it's default is 360K). When SPLIT breaks up a file, it breaks it into as many pieces as necessary, giving each piece a numbered extension starting with 1. The syntax for SPLIT is as follows: SPLIT filename.ext [file size] Examples: SPLIT MYAPP.APP Would split MYAPP.APP into 3 files each no more than 360K, if MYAPP.APP has a length of 1MB. The filenames would be MYAPP.1 (360K), MYAPP.2 (360K), and MYAPP.3 (240K). SPLIT MYAPP.APP 720000 Would split MYAPP.APP into 2 files each no more than 720K, if MYAPP.APP has a length of 1 MB. The filenames would be MYAPP.1 (720K) and MYAPP.2 (280K). To get additional help on using the SPLIT program, type SPLIT. To put the file back together you would type in the following: COPY /B MYAPP.1 + MYAPP.2 + MYAPP.3 MYAPP.APP The previous command would take the files MYAPP.1, MYAPP.2 and MYAPP.3, and combine them back into the file MYAPP.APP. Using A4STRPDT A4STRPDT.EXE is designed to remove all drive and path specifications within a desktop. This is helpful if the drive and path is different on the computer where you are installing. By stripping out the drive and path, you always know that you are starting from the root directory. Using A4MOVAPP A4MOVAPP.EXE is design to change any invalid drive and path in an Application (.APP) and Field Rules (.RLN). The A4MOVAPP will check the drive and path in the Application Parameters, BUT NOT THE MACROS within the application. This process is necessary if the installing computer has different drive and path. There are two ways of using A4MOVAPP. Method 1: A4MOVAPP (you have the control of entering a correct drive and path) Method 2: A4MOVAPP -C (change invalid drive and path into your current location) Customizing the Installation Using SETUP.DTA The final step in creating a Runtime application is to create an easy installation process. By creating a SETUP.DTA file, this will automate the process of installation. The benefit of using a batch file is to ensure a simple, easy installation procedure. For an example of the SETUP.DTA file, you can look on either the Alpha Four installation disks, or the Runtime installation disks. The SETUP.DTA file that is contained on either of those is the actual file used during the installation process. The following is an example of SETUP.DTA file to install the an application created from the tutorial - AVSYSTEM.APP BANNER " Alpha Four Version 2 - Multi User Runtime Installation" CONFIG "%BOOT\CONFIG.SYS" "%DEST\CONFIG.SYS" 80 32 #create a sample Config.sys file where the file handler is set at 80 & buffer is set at 32 SET %DiskSpaceNeeded "3000000" # this is a useless statement SET %DestExe "C:\PeterC" # set the destination drive and path GETPATH %DestExe CREATE "Please enter the drive and path in which you wish to" "install the Alpha Four Runtime program." DISKSPACE %SPACE %DestExe 3000000 # verify the destination and disk space at that location IF NO %SPACE BEEP ERROR "Alpha Four Runtime can not be installed." "You need 3MB of free disk space to install Alpha Four Runtime." END ENDIF PROGRESS 10 DISK "Disk 1" # begin installing the main program COPY %Source\RTREADME.DOC %DestExe\RTREADME.DOC IF EXISTS %DestExe\A4RT.NET BUMP %Source\A4RT.NET %DestExe\A4RT.NET ELSE COPY %Source\A4RT.NET %DestExe\A4RT.NET ENDIF DISK "DISK 2" # installing the Runtime executable file # the A4RT is split in three parts, it has to "APPEND" back into one file COPY %Source\a4rt.1 %DestExe\A4RT.EXE PROGRESS 20 DISK "DISK 3" COPY %Source\a4rt.2 %DestExe\a4.2 PROGRESS 30 DISK "DISK 4" COPY %Source\a4rt.3 %DestExe\a4.3 APPEND %DestExe\a4.2 %DestExe\a4rt.exe APPEND %DestExe\a4.3 %DestExe\a4rt.exe DEL %DestExe\a4.1 DEL %DestExe\a4.2 DEL %DestExe\a4.3 CLS PROGRESS 40 MSG "Install Database Files!" # begin installing the necessary files # dbf -database files # dbt -memo field files # ndx -index files # ina -form design files # idn -index definition files # udn -color configuration, form id, and browse table id # files for each individual database MD %DestExe\Data COPYALL *.dbf %Source %DestExe\Data COPYALL *.dbt %Source %DestExe\Data COPYALL *.ndx %Source %DestExe\Data COPYALL *.ina %Source %DestExe\Data # copyall command is capable of copying all the files with a specify extension PROGRESS 50 COPYALL *.idn %Source %DestExe\Data COPYALL *.udn %Source %DestExe COPY %Source\avmovies.snm %DestExe\Data\avmovies.snm CLS MSG "Install Application!" # begin installing the application # exe -executable application from a nonencrypt version # -executable application from an encrypt version # app -copyall allow you to copy all the application at one time # as4 -banner screen file PROGRESS 60 COPY %Source\avsystem.exe %DestExe\avsystem.exe COPY %Source\avsystwo.exe %DestExe\avsystwo.exe COPYALL *.app %Source %DestExe PROGRESS 70 COPYALL *.as4 %Source %DestExe MSG "Installing the Library Scripts" # begin installing the script library # A4.DFL -configuration file which contain the last database name, # default setting, color setting, current symbol, and default printer COPYALL *.scp %Source %DestExe COPY %Source\a4.dfl %DestExe\a4.dfl PROGRESS 80 CLS PROGRESS 97 BEEP MSG "Alpha Four Runtime Installation complete." "Please read the RTREADME.DOC file for additional" "information on the Alpha Four Runtime program." RUNTIME QUESTIONS AND ANSWERS Q I know that I can strip the paths from my application, field rules and desktops, but how do I take the path out of my sets? A When you create a set in Alpha FOUR, it will only place the path for the file in the set definition if the child database or set is stored in a different subdirectory than the set. So when creating your sets, keep all of your files in the same directory. It's very important to remember that the A4STRPDT.EXE and A4MOVAPP.EXE programs do not remove path references in the macros of an application. It could not remove those keystrokes because it would be impossible for the programs to tell the difference between an actual drive and path reference, and a series of keystrokes that you want to have in your macro. Therefore it is probably better to use desktops as much as possible in your application. Using the desktops will allow you a maximum amount of flexibility in application. Q How do I use my own .DTA file with the SETUP.EXE program? A If you were to create an installation file with the name MYAPP.DTA (for example), to run it you would just type the command SETUP MYAPP.APP. This will tell the setup program to use your own .DTA file instead of the SETUP.DTA file. You can also do this by using the installation program RUN. This command allows you to run any DOS programs (i.e. COM, EXE, or BAT files). A batch file could be created that would run the SETUP program with your own .DTA file. Q When running my Runtime application, I get the error message "OPTION NOT SUPPORTED IN RUNTIME VERSION" when trying to create an index or reconfigure a database. What is going wrong? A The Runtime version of Alpha has certain safeguards in it that help you to protect your applications. There are several Alpha procedures that have been disabled in Runtime; this has been done to help you keep the application you create safe from changes. A listing of the disabled procedures can be found in the Runtime Documentation booklet. Q When developing my application, how do I adjust for mono or color monitors? A The A4.DFL is a configuration file which contains the color settings for Alpha Four. If you define Alpha Four to set screen color to monochrome, the A4.DFL will set for mono-monitor. So you would have to define a DFL for each type of monitor. As for the UDN file, each database has its own user definition file. If you don't has one, Alpha Four will generate a new one for you. That means you don't need to transfer this file along with your database. Q What happen when the start-up database file cannot be loaded? A At the application parameter screen, you have defined your start-up database for you application. It also contains the exact drive and path where the database is located. If you move your database to a different location, you would have to change the drive and path accordingly.