1. Overlay installation
When the program is installed for the second time, this is the program that overwrites the original program or the original directory.
1. First, write the registry in the computer and record the program installation directory
After the program is installed, in On Preload
Set the registry installation path
Registry.SetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\JMElectInstallInfo", "JMElectInstallLocation", SessionVar.Expand ("%AppFolder%"), REG_SZ);
2. At startup, check whether there is an installation path key in the registry
local IsJMElectInstall = Registry.DoesKeyExist(HKEY_LOCAL_MACHINE, "SOFTWARE\\JMElectInstallInfo");
if(IsJMElectInstall == false)then
Registry.CreateKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\JMElectInstallInfo"); --注册键
end
local JEtInstallLocation = Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\JMElectInstallInfo", "JMElectInstallLocation",true);--Get the project installation path
if(JEtInstallLocation ~= "")then --Determine whether the key value exists
local JMElectProductName = SessionVar.Expand ("%ProductName%");
Qid = Dialog.Message(JMElectProductName, String.Concat("Detected that the software has been installed",", if you reinstall, you cannot change the installation directory. If you want to change the directory, please uninstall and then install. Are you sure you want to reinstall ? "), MB_OKCANCEL, MB_ICONQUESTION, MB_DEFBUTTON1);
if(Qid == IDCANCEL) then -- Qid is a global variable, other forms are available.
Application.Exit(); -- exit if not reloaded
else
local resultAppFolder = Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\JMElectInstallInfo", "JMElectInstallLocation", true); -- Get the original installation directory.
SessionVar.Set("%AppFolder%", resultAppFolder); -- set the installation directory to the original installation directory
end
end
3. Set some interfaces to automatically jump
In "Start Installation" and "Select Installation Folder" On Preload
if Qid==1 then -- if there is an installed system, skip setting the installation directory
Screen.Next();
end
But it seems that the "license agreement" cannot set the jump, and friends who know it can tell me.
The above operation is basically completed.
2. After the installation is complete, set the option to run immediately
Delete the interface after installation and make an interface yourself
1. Add a check box, leave only one check box, and remove the others. Edit the information, the final picture is as follows
2. Write code to achieve the effect
Write the following code in Edit On Next (JMElect.exe is your application name)
Screen.Next();
if (check01) then
Shell.Execute(SessionVar.Expand("%AppFolder%\\JMElect.exe"), "open", "", "%AppFolder%", SW_SHOWNORMAL);
end
Finally, you can publish the component.