Creating a new Inno Setup script


An Inno Setup script is simply an ASCII text file with an ISS file name extension. Because it is a text file, one way to create a new Inno Setup script is simply to type it in manually. This can be done using Inno Setup itself or any other text editor. Even simple scripts can become a bit lengthy, though, and creating one manually involves a fair amount of typing not to mention you also need to remember all the required entries and their syntax.

Fortunately, there is an easier way. Inno Setup comes with a nifty tool called the script wizard that makes it easy to create a new script. The script wizard walks you through a sequence of steps that prompt you for the information necessary to create the basic script for your setup. You are asked to make a few simple decisions about your setup along the way. If you ‚ re unsure what to choose, just accept the defaults. No matter what you choose in the script wizard, you can always edit the script and change things later.

In this section of the appendix, we use the script wizard to create the basic installation script for the DeployFox Demo App. In a later section of this appendix we examine the script in some detail, show how to add the VFP Runtime Libraries and other dependencies, and compile it into a SETUP.EXE file.

To start the Inno Setup script wizard, choose File New from the main menu. The script wizard starts with a Welcome screen as shown in Figure 1 . Leave the ‚“Create a new empty script file ‚½ check box unchecked and click Next to proceed to step 2.


Figure 1. The script wizard makes it easy to create a new setup script.

Step 2 of the script wizard asks you to provide the basic information about your application. Subsequent steps prompt you to specify the files you want to install, the choices you want the user to have at installation time, and any additional setup information you may want to provide such as a license agreement. The entries and choices you make in the various steps of the script wizard will be written to the generated script file ‚ the ISS file ‚ where it ‚ s easy to locate and change them later if necessary.


Figure 2. Step 2 of script wizard prompts you for the basic information about your application.

In step 3 of the script wizard, you specify the destination folder for your application. In this step you can also decide whether or not to allow the user to change the destination folder at installation time. As you can see in Figure 3 , the setup we are creating here will install the app to ‚“DeployFox\Appendix D\Demo App ‚½ under the Program Files directory.


Figure 3. Step 3 of the script wizard asks for the default installation directory.

In step 4 of the script wizard, you identify the main executable file for your application. You can also list any other files you want copied to the target computer during installation of your application. Step 4 of the script wizard for our DeployFox Demo App is shown in Figure 4 .


Figure 4. The script wizard allows you to easily specify the main executable file and any other files to be installed.

By default, all of the files you specify in step 4 will be written to the same folder as the main executable file. You can choose a different destination directory for any of the other files by selecting the file in the list and clicking the Edit button. In this example, we want the two database files, CUSTOMERS.DBF and CUSTOMERS.CDX, to be written to a sub-directory named Data under the application directory. Figure 5 shows how to accomplish this in the script wizard using the Edit button. Note that in this example the path to the Data sub-directory is relative to the application directory, chosen by the user at installation time. You can also use the dialog in Figure 5 to specify a custom destination base directory for a file; however, custom destination directories are fixed (not relative) and therefore cannot be changed by the user at installation time. You can also change the destination directory for any file later on by simply editing the script.


Figure 5. The CUSTOMERS.DBF table will be installed to a sub-directory named Data under the directory where the application itself is installed.

You will probably notice right away that the VFP Runtime Libraries are not on the list. The reason for not adding them here is the script entries for installing the VFP Runtime Libraries are somewhat different from the entries for the other files in your setup. Also, the entries for the VFP runtime files will be the same ‚ or at least substantially the same ‚ in all your scripts, so once you have them working in one script you will probably end up simply copying them into your other scripts. We explain how to do this in detail in the section of the appendix entitled ‚“Adding the VFP runtime libraries and other dependencies. ‚½

Step 5 of the script wizard is where you specify the Start Menu folder name for your application, as well as any other icons or shortcuts you may want your installation to create. Note that an ‚uninstall ‚ item is not created on the Start Menu unless you mark the check box for it. Even if you choose not to create an uninstall item on the Start Menu, however, the user can still uninstall the application from the Windows Add/Remove Programs applet.

Figure 6 shows how we configured step 5 of this example. We marked the check box to create an uninstall icon on the Start Menu. The other settings in Figure 6 are the Inno Setup defaults for this step.


Figure 6. Inno Setup lets you give the end user a choice about which Start Menu items and other icons are created at installation time.

Step 6 of the script wizard is where you can specify a license file as well as additional information to show before and/or after installation. The files you specify here can be either rich text format (RTF) or simple ASCII text (TXT) files. The use of rich text format files, easily created with Microsoft Word or other word processing programs, enables you to present your information in a more pleasing format than a simple text file can provide.

If you decide to use RTF files and want your font to be the same as the font used by Inno Setup itself, we found Microsoft Sans Serif 8-pt is the best choice. Arial 10-pt font is also a good choice because it ‚ s very readable. You can use a bold font and/or a slightly larger font size to set off the headings in these files. Of course, these are simply suggestions; your preference may be different, and you can use whatever fonts and styles you want to.

If a license file is specified, Inno Setup displays a license agreement page during setup and requires the user to accept the terms of the license by marking a check box before installation proceeds.

The ‚“information before installation ‚½ and ‚“information after installation ‚½ files can be used to display any additional information you may want to convey to the user during installation. If included, the setup wizard will display these files before and after the actual installation of your application, respectively. Each of these files gets its own page in the setup wizard. As you can see in Figure 7 , we specified an RTF file for all three of these purposes.


Figure 7. If a license file is specified in step 6 of the script wizard, the end user will have to accept the terms of the license at installation time before setup proceeds.

That ‚ s all there is to it. When you click the Finish button in step 7 of the script wizard (not shown), Inno Setup creates a setup script from the information you provided and opens it in the editing window as shown in Figure 8 . Inno Setup also pops up a dialog at this point offering to compile the script. You may or may not want to compile the script right away. If not, just click ‚No ‚ . You can always compile it later by selecting File Compile from the Inno Setup main menu. The next section of this appendix covers compiling the script and installing the application.


Figure 8. When the script wizard finishes, the generated script automatically opens in the Inno Setup edit window.

The script created by the script wizard does not automatically save to disk. Use File Save on the main menu to give your script a name and save it to disk. In Figure 8, the script we created with the script wizard was saved as DEPLOYFOX DEMO APP SCRIPT WIZARD SCRIPT.ISS; you can see this name on the Inno Setup title bar.

You typically use the script wizard only once per application, to create a new script for the first time. After creating, naming, and saving a script you can use Inno Setup or another text editor to make additions and revisions to the script. Regardless of what editor you use to edit a script, you will of course use Inno Setup itself to compile the script into the setup executable for distribution to your users.




Deploying Visual FoxPro Solutions
Deploying Visual FoxPro Solutions
ISBN: 1930919328
EAN: 2147483647
Year: 2004
Pages: 232

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net