I am new to NSIS so bear with me:
I am using NSIS (legacy code...) for making sure that .NET is installed before launching a .NET application.
If it is not installed, I am installing it for the user, but I would prefer getting user's approval before playing hooky with his system.
I was able to display the message to the user:
using this code:
WriteIniStr $MissingItemsIniFilename 'Field 2' 'State' '$R2'
WriteIniStr $MissingItemsIniFilename 'Settings' 'CancelEnabled' 1
InstallOptions::Dialog $MissingItemsIniFilename
Pop $1 ;get button action
my problem is that after user clicks Next the "dialog" is not closing and shows:
So my question is, How can I close the dialog?
Extra information:
I am using InstallOptions for showing the dialog.
I looked into nsDialogs but could not find there a solution that worked for me (might be due to lack of experience in NSIS).
Please let me know if any other information is required...
If you want to hide the entire installer you can do:
HideWindow
ExecWait ...
BringToFront
otherwise you should probably move that ExecWait to a Section...
Related
Hello to you who is reading this post. About a week ago I discovered NSIS and have just about managed to finish my first installer script. I managed to find answers to pretty much all of my questions through web searches, and have managed to create a pretty elaborate installer. There is one issue I can't figure out, as everything I have tried does not work and I can't find a solution online that I understand or is specific enough to be applied to this issue.
I'm using the modern UI "MUI2". I found some code to increase the size of the rich textbox on the license page which works great, but now the text at the bottom of the window (MUI_LICENSEPAGE_TEXT_BOTTOM) overlaps it and causes some visual bugs. Setting it to an empty string does not work and setting it to a single space does not work. I managed to get it to disappear with "FindWindow" and "GetDlgItem", but I'm not exactly a programmer so I don't have the intelligence or knowledge on how to set these up correctly. What I did manage to pull off, it also removed the rich textbox, and after several hours of defeat I finally gave up and turned to the internet.
It's kind of mind blowing to me that NSIS does not provide a simple way to remove controls. I don't want the "text bottom" label there at all, I want it gone or at the very least hidden. I know the handle I'm trying to remove is "1006" because I opened up the installer in Resource Hacker and removed the label from there. What bugs the me most is that actually worked perfectly and removes the label, but it also corrupts the installer and I have to use NCRC on command line to launch it. So scratch that as a workable solution...
TL;DR my question is: how do I hide or get rid of MUI_LICENSEPAGE_TEXT_BOTTOM?
MUI2 already has a variable you can use:
!include MUI2.nsh
!define MUI_PAGE_CUSTOMFUNCTION_SHOW HideMui2Text
!insertmacro MUI_PAGE_LICENSE
!insertmacro MUI_LANGUAGE "English"
Function HideMui2Text
ShowWindow $mui.LicensePage.Text 0
FunctionEnd
If you wanted to do it manually it would be
FindWindow $0 "#32770" "" $HWNDPARENT ; Find inner page
GetDlgItem $1 $0 1006 ; Find control
ShowWindow $1 0
When using Resource Hacker you need to copy the base file from NSIS\Contrib\UIs and in your script define MUI_UI to the path of your modified UI file.
I have created a ListView with checkboxes using the embeddedLists.dll plugin. I need to make the background of the HeadingText transparent for this project.
I used WinSpy++ to get the handle_Id and tried this snippet, but it did not work.
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1211
SetCtlColors $0 "FFFFFF" "transparent"
Any pointers/help is very much appreciated.
Adding screenshot for clarity.
screenshot
Is your installer based on UMUI skin? Some 3rd party plug-ins may have issues with transparency and so on.
Anyway I noticed you use NSIS 2.46 which is pretty old, try to run the example in new NSIS 3 and new UMUI which has many fixes and improvements.
Little self promo: I have developed plug-in for NSIS similar to UMUI called Graphical Installer:
Feel free to try it: Graphical Installer website (Trial)
Thanks for reading this.
I am making a program and I choose to package it using NSIS after getting disappointed by Inno.
I am trying to make a 2 steps install wizard. I could accomplish this by using Nsdialogs and a custom page.
Please see this image: here
Is it possible to change the "Install" button to became "I Agree" as in the license page?
and if this is possible, can this button be colored?
I have searched about this and I found some talk about a plugin called 'Buttonevent'. I download it and I saw the examples. AS I understood this can be used only to Add new buttons Not to change existing ones.
please help me if there is any clues.
That's a lot of code for a one-line solution. LicenseText is the attribute you are looking for. You should also consider using the license page as it is intended, too.
Page License
!include nsDialogs.nsh
Page Custom MyPageCreate
Page InstFiles
Function MyPageCreate
nsDialogs::Create 1018
Pop $0
GetDlgItem $1 $hwndparent 1 ; Get handle to Install/Next button
${NSD_SetText} $1 "$(^AgreeBtn)"
nsDialogs::Show
FunctionEnd
Changing button colors is a lot of work and cannot be done in NSIS without a plugin...
I have my command line options that work for my installer, which involves the plugin NotifyIcon. Because of this plugin, I can not run my installer silently through the command line. It has one custom page MUI page over. Two questions occured to me, so if anyone can help, please do so.
I'm using MUI, so I know I have to use a separate function and then define MUI_CUSTOMFUNCTION_GUIINIT myGuiInit ! I load the code correctly and icon works for me properly.
Running the installation mínimimizado. I've dealt with "HideWindow" on . MyGuiInit OnInit and also in my own functions, and anywhere else I could think of, but that does not work very well. What I need is that the first boot installation window minimized and the icon appears on the task bar (this already works for me) and when you press the icon on the taskbar window is restored installation to continue with the installation normally.
I don't really understand your question but if you want to start the installer minimized you can do:
!define MUI_CUSTOMFUNCTION_GUIINIT myGuiInit
Function myGuiInit
System::Call 'USER32::PostMessage(i$hwndparent,i0x0112,i0xF020,i0)'
FunctionEnd
When I try to give custom icon while creating InternetShortcut that particulat icon is not there in created InternetShortcut. Default icon is comming.
Here is code:
WriteINIStr "$SMPROGRAMS\Launch_APP.url" "InternetShortcut" "URL" "http://localhost:9080/myapp/index.php"
WriteINIStr "$SMPROGRAMS\Launch_APP.url" "InternetShortcut" "IconFile" "$ReadmePath\A.ico"
CreateShortcut uses IShellLink to create shortcuts and is not supposed to be used to create internet shortcuts. The documented interface you are supposed to use to create internet shortcuts is IUniformResourceLocator. NSIS does not have a native instruction for this but it can be called by the system plugin using its COM syntax. To set the icon you would have to QueryInterface for IPropertySetStorage and set PID_IS_ICONFILE. In the end you are just going to end up with the same .ini file which is why a lot of examples (NSIS and other stuff) just write using the .ini API.
You could try adding IconIndex=0 to the .ini but my guess is that the icon path is wrong or icon caching is getting in the way.
Have you tried clearing the icon cache or testing on a different machine?
Thanks for using NSIS.
So - There is function CreateShortCut (nsis.sourceforge.net/Docs/Chapter4.html#4.9.3.4). it is intended to create any shortcut Windows supports. You should use it. If you find some specific case where it does not work, feel free to mail to Devs in NSIS contact list or create ticket in their bug-tracker.