NSIS Skip pages at runtime - nsis

My installer is checking if the program is already installed and I would like to skip the "Enter the path" page in that case.
How can I script that in NSIS 2.0 ?

To skip a page, call the abort instruction in the pre callback function for that page

Related

Can I show the custom window before all the wizard pages in Inno Setup?

I export a function from dll like this:
function IsClientLaunched : Boolean;
external 'IsClientStarted#files:IsStart.dll stdcall setuponly';
I need this function to check if my application is already running or not. It returns True if it's running and false if it's not.
What I need to do is depending on the result of that function I have to show the custom window with the custom message and 2 buttons: Continue and Cancel. So if I close the app and press Continue then the installation process goes on. If I press Cancel then the installer finishes its work and closes. The problem is that I don't know how to show that custom window before all the wizard pages and if it's even possible to do that?
Also, I use ISSI to show the splash screen:
#define ISSI_Splash "C:\InnoSetupProject\Images\client.bmp"
#define ISSI_Splash_T 3
#define ISSI_Splash_X 500
#define ISSI_Splash_Y 220
There's also one problem with that. If I show the MsgBox dialog before the first wizard page and press Cancel on it I want my setup program to close, but instead it shows me the splash screen anyway and then closes. Can I somehow cancel it if I need it in InitializeSetup?
Use the code from:
Is it possible to check if program is already running before trying to install it? (Inno Setup)
(it's your question!)
And just replace IsAppRunning with your IsClientLaunched.
Though, now the question is, whether you need your custom IsClientLaunched at all. You can use the IsAppRunning instead.
According to the CreateCustomPage documentation the parameters for creating a custom page are as follows:
function CreateCustomPage(const AfterID: Integer;
const ACaption,
ADescription: String): TWizardPage;
As you can see, you are providing AfterID which implies you can tell it to show a custom page after a specific builtin page.
But, have you considered using PrepareToInstall? It says:
You can use this event function to detect and install missing
prerequisites and/or to shutdown any application which is about to be
updated.
So maybe you can do your tests there and show any needed pop-up message box. Then, based on the reply, you can return with the appropriate error message. The documentation explains.
There might be other ways to do what you want.

NSIS to check installation location is empty or not

How to add functionality about to display override dialog for the installation location.
If user already installed the software, and he is trying to reinstall the software in the same location then i wanted to show information whether do you need to overwrite or not?
I have used below function but it is invoking before opening the location page.
Function .onVerifyInstDirIfFileExists "$INSTDIR\temp.xls" PathGood
PathGood:
MessageBox MB_OKCANCEL "Do you want to overwrite the location with new installer ?" IDOK lbl_ok IDCANCEL lbl_cancel
lbl_ok:
lbl_cancel:
Quit
FunctionEnd
.onVerifyInstDir is used to disable the Next button, it should not display UI:
This code will be called every time the user changes the install directory, so it shouldn't do anything crazy with MessageBox or the like. If this function calls Abort, the installation path in $INSTDIR is deemed invalid.
If you want to display a message you must use the page leave callback instead:
!include LogicLib.nsh
Function MyDirLeave
${If} ${FileExists} "$INSTDIR\temp.xls"
MessageBox MB_OKCANCEL "Do you want to overwrite the location with new installer?" IDOK +2
Abort ; Stay on the current page
${EndIf}
FunctionEnd
Page Directory "" "" MyDirLeave
Page InstFiles

How can I remove the target directory selection in Qt installer?

I am trying to make an installer on Linux with Qt Installer Framework and I'd like to set a fixed target dir and remove that page from the installer. I've managed to do this with a script and using setDefaultPageVisible. This works but I have to press the next button twice in order to get past it.
Is this a known issue or is there a better way to achieve this?
For the benefit of others, I found a solution. It seems that you need to remove the Introduction page as well as TargetDirectory as there appears to be a duplicate Introduction page otherwise.
function Component()
{
installer.setDefaultPageVisible(QInstaller.Introduction, false);
installer.setDefaultPageVisible(QInstaller.TargetDirectory, false);
}
You can disable the line edit with currentPage.TargetDirectoryLineEdit.enabled = false;

CRM 2011 Case Entity Event Handler not executing each time

I have my javascript file case_Javascript.js and it have a function poupulate javascript.
I have call this function on OnLoad of case entity.
I have used an alert("script runing") in the start of the js file. Only first time the alert() is shown. And its not runing then. I have to reset iis and publish each time to run this and it wont run again. I am stuck. Any Solution to get around?
This could be the settings of your IE.
IE >Tools > Internet Options > General Tab > Browsing History Settings >
Check for newer version of stored pages > Option "Never" radio button is checked or not
Set this to "Automatically".

How can I disable a button in NSIS while installation?

I am creating a installer which is having multiple component to install(checkbox are provide to select the desired component).
Now, suppose user has not selected any option, even then Next button on the component page is activated.Here I want to disable that next button when no option is selected.
Can anybody tell me how I can do that ?
Please Help me
your problem is really hard to solve if you use standard collection windows as MUI or XPUI, if you are using Modern UI (MUI) then the next code could help you to code the functionality you need (in the XPUI case this does not work at all)
WARNING :
I did NOT tested the next procedures (just compiled), because i'm currently using XPUI and i have deprecated the MUI in my installer, moreover i have provided no logic to re-enable the "next" button in the OnChange_Service function.
handle the event change on your target section, i do not know if it works, but i propose to use the NSD_OnChange procedure (defined in nsdialogs)
!include 'nsdialogs.nsh'
Function <...>
${NSD_OnChange} <... name of the target section ...> OnChange_Service
FunctionEnd
In the event handler function place the code to disable your button
function OnChange_Service
var /GLOBAL NextButton
GetDlgItem $NextButton $HWNDPARENT 1
SectionGetFlags <... name of the target section ...> $0
IntOp $0 $0 & ${SECTION_OFF}
StrCmp $0 "1" DISABLENEXT
GOTOENDONCHANGE
DISABLENEXT:
EnableWindow $NextButton 0
GOTOENDONCHANGE:
functionend
Anywhere i think it is better to use custom window if you need to do some manipulations on the window control state.
Make me know if it works in your project
(If you want to use boolean operator in your code, then use the LogicLib plugin)

Resources