InstallShield Detailed production Instructions (iii) __installsheild

Source: Internet
Author: User
Tags goto

VIII. License Agreement

Open "Installation Designer"-> "Behavior and Logic"-> "Support files/billboards" panel

Here "Language Independent" refers to the settings will be in any language will play a role equivalent to the default, the following is also "Chinese (Simplified)", which is equivalent to the branch, only Chinese under the effect. Here we will only do generic, in "Language independent", add "Software license agreement. txt" file.

Then, click on "Disk1", where we store some of the prerequisites for running the system, which will not be packaged into the Setup.exe, but with Setup.exe, because these conditions are not required for every machine and are not part of the product.

Nine, install the script

This part is the most complex and most important. Open "Installation Designer"-> "Behavior and Logic"-> "InstallScript" panel

There are three main categories of scripting events: Before move data (before the installation date), move data (during installation data), and after move data (after installing data).

Onbegin: After initialization, is called

Onfirstuibefore: The first time you install, the events that are triggered before you copy the installation data, the script that changes this event can customize the installation steps (generally we are modifying this)

Onmainuibefore: When you modify or uninstall, events that are triggered before you copy the installation data, such as when the installer adds a service during installation, and the installer does not reinstall the service on uninstall, this requires a script removal service.

ONSQLLOGIN:MS the SQL Server database to install the login function.

Movedata: Usually very few people will change

Onfirstuiafter: The first installation, after copying the installation data triggered events, such as some places need to set the path, the path does not exist before installation, must be installed before setting.

Onmainuiafter: Events that are triggered after the data is modified or unloaded when modified or unloaded

OnEnd: The event that is triggered after the installation completes, that is, the event that is triggered when the "Finish" button is clicked.

We first write the license agreement interface, and we can see that the script is now empty. On the right, select the Drop-down list as "Beforemovedata" and "Onbegin". Note here do not look at the current is Onbegin, do not choose, be sure to choose, will trigger code generation. The content between Begin and end is the action that we want to do specifically.

function Onbegin ()

Begin

Disable the previous step

Disable (Backbutton);

Determine what state the installer is in, install, repair, reinstall, or uninstall the state, and the latter are in the maintenance state, so that the license agreement is only displayed in the normal installation state

if (! maintenance) Then

True indicates default check acceptance protocol

SDLICENSE2 ("Software license Agreement", "" "," ", supportdir^" software license agreement. txt ", TRUE);

endif

End

SdLicense2 (sztitle,szopt1,szopt2,szlicensefile,blicenseaccepted);

Parameter sztitle: the title of the upper-left corner of the interface, fill in "" then default to "License agreement"

Parameters szOpt1, SzOpt2: Two options "agree" and "disagree". Default value "I accept the terms of the license Agreement" and "I do not accept the terms of the license Agreement"

Parameter szlicensefile: Specifies the document to display, including the path and the name of the document with the extension. "Software license agreement. TXT" is placed under the Supportfile, the path in the InstallShield has a special static variable, that is, Supportdir, followed by the filename, with the ^ to connect, the filename needs to be quoted

Here's a SdLicense2, you can go to "User Interface"-> "Dialogs", the following a bunch of dialog boxes, you can also customize the dialog box. So the above SdLicense2 directly is the name of the dialog box, this usage is the same as the constructor, that parameter, you can see the dialog box right below, there is a simple explanation, you click on the link will open the API document, there will explain the meaning of each field in detail.

Below, add prerequisites and installation paths to the Onfirstuibefore and click the dropdown to generate the code

If the above you have tried to compile, you will find that the installation of a lot of steps, in fact, each step corresponds to the generated code in the DLG_XXXXXX, there are many possible you do not need, the following is my revised code. The main thing is to check whether the Netframework,mysql is installed, no installation, and the other is to let the user specify the feature to install. Dlg_xxxxxx are executed sequentially, and of course you can also see through goto you can jump.

function Onfirstuibefore ()

Number Nresult, Nsetuptype, Nvsize, Nuser;

STRING SzTitle, szmsg, Szquestion, Svname, Svcompany, Szfile;

STRING Szlicensefile;

BOOL bcustom, BIgnore1, BIgnore2;

STRING Setupexedir[max_path + 1]; Gets the path where the installer Setup.exe itself

Number Nbuffer; Local buffer-size variable

STRING Svmsiexec,svmsipackage,svparam;

Begin

if (removeonly) then

Disable (Dialogcache);

szmsg = sdloadstring (ids_ifx_error_product_not_installed_uninst);

Sdsubstituteproductinfo (szmsg);

MessageBox (szmsg, SEVERE);

Abort

endif

Nsetuptype = typical;

Dlg_sdwelcome:

SzTitle = "";

szmsg = "Click Next", will install the XX product, if has the prerequisite not installs, will install the prerequisite first ";

Nresult = SdWelcome (SzTitle, szmsg);

if (nresult = NEXT) Then

Check Prerequisites

Sets the default registry key value the root node is HKEY_LOCAL_MACHINE

Regdbsetdefaultroot (HKEY_LOCAL_MACHINE);

Msigetproperty (Ismsi_handle, "Setupexedir", Setupexedir, Nbuffer);

Judgment. NETFramework 4.0

if (Regdbkeyexist ("Software\\microsoft\\net Framework setup\\ndp\\v4\\full") <0) Then

if (launchappandwait (setupexedir^ "Dotnetfx40_full_x86_x64.exe", "", laaw_option_wait) <0) Then

MessageBox ("Installation NetFramework4.0 failure", information);

endif

Else

MessageBox ("System installed NetFramework4.0", information);

endif

Judge MySQL

if (Regdbkeyexist ("Software\\mysql AB") <0) Then

if (launchappandwait (setupexedir^ "Install_mysql.bat", "", laaw_option_wait) <0) Then

MessageBox ("Install MySQL failed", information);

endif

Else

MessageBox ("System installed MySQL", information);

endif

Goto Dlg_sdfeaturedialog;

endif

Dlg_sdfeaturedialog:

SzTitle = "";

szmsg = "";

Nresult = Sdfeaturedialog (SzTitle, szmsg, INSTALLDIR, "");

if (nresult = back) goto dlg_sdwelcome;

Added in is 2009-set appropriate statusex static text.

Setstatusexstatictext (sdloadstring (Ids_ifx_statusex_statictext_firstui));

Setup Default Status

Enable (Statusex);

return 0;

End

The above call MySQL with the use of the bat indirect call, MSI seemingly can call directly, but I tried a lot, did not try to come out, if you try to tell.

Here I did not study too much script code, but basically realize their own needs, some difficulties are used database.exe way to achieve, have to admit that the study is really a headache, need in-depth research colleagues, can learn more.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.