nsis createting InternetShortcut not displaying icon - nsis

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.

Related

Choose a folder dialog for nsis

I have a problem with the skin that I am using for my nsis installer.
Is there a way to control to not apply skin to choose a folder dialog.
I am using Skincrafter plugin to apply this skin.
Generally if I load it after initializaiton, it applies to all pages/inner dialogs and child dialogs. I do not want Browse for a folder dialog to have a skin.
Can someone please provide any suggestions?
There is no way how to fix this from NSIS.
Asks the authors to add this feature for you or (if the sources are available) modify the it by yourself to fit your needs.
There are also some other skinning systems for NSIS - e.g. mine Graphical Installer (sorry for this little promo :) so you can try to use them.

Run installer minimized + NotifyIcon

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

NSIS MUI language popup not appearing

I am using NSIS to create an installer for my application. NSIS Mondern UI, to be specific.
This installer is multi-lingual and I am using
!insertmacro MUI_LANGDLL_DISPLAY
!insertmacro MUI_LANGUAGE
etc to ask the language input to the user. On one of the machines, I am not getting the "Select Language" popup. But if I use the normal NSIS commands (not MUI) like LoadLanguageFile, LicenseLangString etc., it works perfectly fine.
What could be the reason for this behavior? Is it related to any other system/Windows level setting??
Other MUI commands/instructions work perfectly on this machine. Any help greatly appreciated.
There are a couple of things that could be going on here:
If you use the MUI_LANGDLL_REGISTRY_* defines, NSIS will try to remember the language and not ask again (MUI_LANGDLL_ALWAYSSHOW turns this off)
If NSIS decides that this machine is only able to display one language (code page issues etc) it will not show the dialog, you can override this with MUI_LANGDLL_ALLLANGUAGES

NSIS scripts-Changing header text. Also using same variable in both installer and uninstaller section

I am writing an installer using NSIS. I wanna know how to change or write a description(text on white header)on custom pages? For eg: I am inserting a customized page after the directory page and the description remains the same i.e Choose Install Location...
But I wanna change it according to my page requirement. How should I change this text?
Also I wanna access a variable in uninstaller section which is set with some string in installer section. Please help me on this...
Okay, you seem to have two questions there.. probably best to post them separately :)
For setting the title of the customized page, simply use the following macro (I've got mine placed just prior to calling nsDialogs::Create)
!insertmacro MUI_HEADER_TEXT $(MY_CUSTOM_TITLE) $(MY_CUSTOM_SUBTITLE)
Where MY_CUSTOM_TITLE and MY_CUSTOM_SUBTITLE are variables set elsewhere.
You will need to save the string value of the variable during installation by writing it out to a file or registry setting, and then later during uninstallation reading that value from the same location.
I think you need to do this:
!define MUI_DIRECTORYPAGE_TEXT_DESTINATION "My alternate Choose Install Location text"
You could also edit the language files. This is assuming you are using MUI for your custom pages:
http://nsis.sourceforge.net/Docs/Modern%20UI/Readme.html

NSIS license page

Is there anyway you could resize the rich textbox in the license page of an NSIS installer?
Thanks...
there are several choices that affect the size a little bit, checkbox vs button etc
Switch to the Modern UI if you are not already using it
Copy and resize one of the dialogs in \Contrib\UIs with resource hacker and use ChangeUI in your script
Call GetWindowRect/ScreenToClient/SetWindowPos with the system plugin at runtime in the show callback function for the page

Resources