NSIS: How to delete file matching wildcat pattern in nsis script - nsis

When users install my software, it creates shortcut on the user's desktop. The name of the shortcut also reflects the version being installed.
It turns out that some of my clients do install multiple versions (although that is no problem, no conflicts or whatever) but it means that user's desktop is bloated with lots of shortcuts for the several various different versions that they have installed over time. (e.g. SchoolServer 7.1.lnk, SchoolServer 7.2.lnk, SchoolServer 8.5.lnk and then the current SchoolServer 9.0.lnk)
They have to be deleting these obsolete shortcuts manually.
How can I achieve this in my NSIS script?
Note: I have tried deleting the shortcuts on the desktop with wildcat for all versions and then create the shortcut for the installed version, but it created the new shortcut and still left the old shortcuts there. Code I used is below:
;first delete stale shortcuts matching the wildcat
Delete "$DESKTOP\SchoolServer *.lnk"
;create the new shortcut
CreateDirectory "$INSTDIR"
CreateShortCut "${ICON_URL}" "$INSTDIR\SchoolServer.exe" "" "" "" SW_SHOWMAXIMIZED ALT|CONTROL|SHIFT|F5 "SchoolServer"

Use SetShellVarContext prior to deleting, to switch to the current user:
SetShellVarContext current
Delete "$DESKTOP\SchoolServer *.lnk"
SetShellVarContext all

Related

Is there a way to make an Installshield 2015 installer always run silent without a command line?

I've searched all over and have not found this. I need to make an Installshield 2015 installer that just installs unattended. No next clicking, no finish button to click, just installs and closes. I don't care if it is visible or not. No using a command line switch.
After some experimentation i figured out a way to do it.
Unload the VS installer project.
Open the .isl file in your text editor of choice located in the installer projects folder
Do a search for InstallUISequence
Remove the following lines from the section:
<row><td>InstallWelcome</td><td>Not Installed</td><td>1210</td><td>InstallWelcome</td><td/></row>
<row><td>SetupCompleteError</td><td/><td>-3</td><td>SetupCompleteError</td><td/></row>
<row><td>SetupCompleteSuccess</td><td/><td>-1</td><td>SetupCompleteSuccess</td><td/></row>
You can optionally remove this if you want no progress bar:
<row><td>SetupProgress</td><td/><td>1240</td><td>SetupProgress</td><td/></row>
Save the file in the text editor
Reload the project in visual studio and build the file.

Preventing a Shortcut on the Start Menu from Being Highlighted installshield 2012

My Basic MSI project aims to install two different shortcuts in the Windows startup menu:
one advertised shortcut which proceeds to repair if something is wrong whith the software installation (reset accidentaly removed DLLs for example). This shortcut is only used by the support team if something gone wrong.
one not-advertised shortcut which is the mainly used by the user
After installation, the repair shortcut is highlighted in the startup menu but the main shortcut isn't.
I specify here having tested these manipulations on a Windows Seven operating system with Windows Installer version> = 5.0
I tried the solution from the Installshield Documentation which consists to add a spécific Shell Shortcut Property
Repair Shortcut settings:
Shell Shortcut Property
Key Name = System.AppUserModel.ExcludeFromShowInNewInstall
value = 1
It doesn't work. The repair Shortcut is still highlighted after install.
I tried to set the System.AppUserModel.ID property first like this link indicates
Repair Shortcut settings:
Shell Shortcut Property
Key Name = System.AppUserModel.ID
value = 1
Key Name = System.AppUserModel.ExcludeFromShowInNewInstall
value = 1
It doesn't work,The repair Shortcut is still highlighted after install on the same configuration.
My main objective is to prevent the repair shortcut from being Highlighted and to activate shortcut highlighting for the main shortcut only.
Thank you for your help.

How to add gvim icon to openwith menu

I have installed gvim in windows 7. When I right click on a file, I get list of editor to be opened with. I see a icon for notepad++, 7zip and beyond compare, but not for vim. it is tough to search "Edit with Vim" in the big list. Is it possible to add icon to "Edit with Vim". I tried setting ICON in registry to gvim.exe path, but that didn't work
I am currently having a crack at coding this up "for real" (but no success yet).
In the meantime, here's what I did on my machine as a sort of workaround:
Create a new text file and call it (for example) vim.reg
and paste this into the file:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\Edit with Vim]
"Icon"="\"C:\\Program Files (x86)\\Vim\\vim74\\gvim.exe\""
[HKEY_CLASSES_ROOT\*\shell\Edit with Vim\command]
#="\"C:\\Program Files (x86)\\Vim\\vim74\\gvim.exe\" \"%1\""
and then right-click on the file and select Merge.
Or just manually add those keys directly in RegEdit if you're comfortable with that.
You may need to restart Explorer.exe (eg. log out and back in) for it to take effect.
This will add a new "Edit with vim" entry, with the icon, to the context menu for every filetype.
If you want it only for text files, for example, then change the two occurrences of "*" in the file to "txtfile".
The other vim context menu entries (eg. open with existing vim session) will not be affected - they will still not have icons.
UPDATE:
From the bug report that Christian mentioned, it looks like someone else has now implemented this, in version 7.4.724.
Vim.org reports that the currently release is 7.4.729, so it should include that.
The only trouble is that the Windows binaries available for download from the site are from 2013.
But vim.org also suggests a way to get the latest version, precompiled for Windows:
For the latest version with all patches included see Cream below.
These versions are unofficial, but the download number is high and
complaints are few.
And
For an unofficial version that does include all the latest patches and
optionally a bit more: Cream.
The "one-click installer" mentioned includes the Cream changes.
For the "real Vim" use the "without Cream" version listed further down.
As far as I know, this is not possible yet. There is a whishlist bug that requests this feature, but no one has contributed code yet.

nsis createting InternetShortcut not displaying icon

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.

What sort of resharper specific files does resharper generate in your vs.net project?

What sort of resharper specific files does resharper generate in your vs.net project?
(BTW, did you guys get the full version or just the C# version?)
The "_Resharper.[Solution Name]" folder stores the Resharper specific cache. You can go to Resahrper > Options dialog and select "Store caches in: system TEMP folder" so that your solution folder is not cluttered.
I personally prefer to use the TEMP folder so that the cache does not accidentally get added to the version control. Also, in case you want to clean the cache you can use the "Clear Caches" button on the Resharper Options dialog.
Couple of different things:
A folder called "_ReSharper.[Solution Name]" which then contains a collection of files and folder beneath that
A file called "[Solution Name].[ReSharper Version].resharper.user"
Both are created in the root of solution next to the .sln file. You can delete them if necessary and ReSharper will just recreate them on next load. Keep them out of your source control management system - they serve no purpose under verison control.

Resources