I been using NSIS for simple installers. I am now at a point where i need to install files to a user's specific location. For example, in my case, the palette directory where i need to put the new palettes is C:\Users\Russ\Documents\My Palettes.
How can i determine, automatically, the current user (Russ) when the installer executes. (Or is this something i have to prompt the user for?)
I've looked at other NSIS constants, but couldn't find something particular for this.
My documents is listed in the constants list.
MessageBox mb_ok "$Documents\My Palettes"
Related
I have seen this was asked in the bask back in 2008 and can't find anything newer on the subject so I am bring it up again.
Is there a way to prevent a user from extracting the files from the installer and reading the nsi file.
I read something the opcode needs to be changed in the exe of nsis. Has NSIS come up with a plugin or something so users do not have to modify the exe?
If there an easy way or is it still messing with the exe. and if so can you point me in the right direction on how to do this or if someone has already posted a version
Thank!
NSIS is open source so it is not unsurprising that people are able to write decompilers.
There is no easy way to prevent it and the recommended method is still the same; change the order of the opcodes in \Source\exehead\fileform.h and compile NSIS.
To prevent most people from getting access to your files you can use one of the zip/7z/rar plug-ins from the NSIS Wiki that accepts a password and include a password protected archive in your installer. Keep in mind that a sophisticated user can run the installer in a debugger and find your password when you call the plug-in to extract the files.
I have a customer using Host Intrusion Protection and has set every User's temp folder not to allow execution (C:\users\\AppData\Local\Temp). NSIS extracts all plugin dlls and its own dlls into a folder below %TEMP%. The problem is nothing is allow to execute from temp so the entire install fails. What I need to know is how to tell NSIS to use a different folder. The only work around I can find is to edit the TEMP and TMP values under the registry key HCU\Environment from "%USERPROFILE%\AppData\Local\Temp" to something like C:\NSISTEMP. However even though this works changing the registry and then putting it back is not really an option. I also cannot just redirect InitPluginDir as that only effects plug-ins and not the rest of what NSIS extracts (icons xml files etc...). Any ideas?s
You can set %TMP% in a terminal/console window before running the installer, there is no need to edit the registry.
In NSIS v3+ you can use UnsafeStrCpy:
Function .onInit
UnsafeStrCpy $Temp "c:\foo\bar"
CreateDirectory "$Temp"
FunctionEnd
The real problem is the security "solution", why would preventing execution from %Temp% but not from other directories really provide any protection after the bad guys find out about this restriction?
If the installer is started with the special _?=$InstDir parameter then it is not copied to %Temp%.
Try this (look for more info in documentation) maybe it is safer than overriding $Temp folder and so on.
I am making an inno setup script. My setup really needs the user to choose to two customized install locations.
But there is only one {app} variable in inno.
Our software is an audio plugin software, the common way in this field is to choose one location for the program and the other location for audio sample/data (which is very large so users usually want to install at a dedicated place for storage and also performance purpose).
Is there any way to get around this condition?
Thanks a lot!
There are many other variables (Directory Constants) which you can use, most common ones:
{app} - The application directory (user chooses this derectory in Wizard dialog)
You can create subdirectories like {app}\Data
{win}
The system's Windows directory.
{sys}
The system's System32 directory.
{pf}
Program Files.
{cf}
Common Files.
And many, many others.
The modern installers store application in one directory - {app} and user's files in every user's custom directory - e.g. {localappdata}.
And if this is still not enough you can create your own dialog (wizard page) that contains edit boxes and Browse buttons for selecting directories.
Use function CreateInputDirPage() for this purpose.
See manual - Pascal Scripting: CreateInputDirPage for more info.
Take a look at the included CodeDlg.iss example that shows how to add an extra page for a data directory and hwo to use that value in [Code].
I'm looking for assistance to create some Notes toolbar buttons to move selected documents to a favorite folders. I just want to hardcode a specified folder per button.
I'm not familiar with Notes Formula language or creating buttons so any tips would be helpful.
thanks.
#Command([Folder]; "folderName") will copy the selected document to "foldername"
Create Action on the view you wish to copy documents from and drop the above code in. You can play around with the Actions properties to control appearance, location etc.
Use a formula like this
#Command( [Folder] ; folderName ; moveOrCopy )
The following formula will move the selected document to the folder named "My Favorite":
#Command( [Folder] ; "My Favorite" ; "1")
If you omit folderName the Move To Folder dialog will be displayed.
The moveOrCopy parameter is optional. A value of "1" moves the document to the folder. A value of "0" copies the document to the folder. If you omit this parameter, Folder assumes a value of "0" (copy).
Also, if you have a subfolder, you can specify it with a double backslash like this:
#Command( [Folder] ; "My Favorite\\My Subfolder" ; "1")
I recently learned how to do this myself so I could create two different buttons with hardcoded folder locations. I used the following:
#Command([FolderDocuments];"Foldername";"1")
Of course, replace "Foldername" with the name you need and be sure to leave in the quotes.
Where it got a little tricky for me was trying to move an email to a subfolder of a folder. The normal backslash didn't seem to work. I don't know what made me think of it, but I tried two backslashes and that worked fine.
#Command([FolderDocuments];"Foldername\\subfolder";"1")
I know you're looking to hardcode the buttons, but if you're looking to create more than 2-3 buttons, I'd suggest looking to use a simple popup that lets you choose from a list of choices. That way you don't have to memorize which button is which and you won't run out of room on your toolbar.
The answer depends on a lot of factors that you've not specified here.
Is this for the Notes client? For a single database? Is the objective a personal favorites list for each user, or a shared favorites list? If yes for all of these, then why do you want to use a toolbar button for this? Just set up a 'Favorites' folder in the application, mark it as 'Shared, personal on first use', and teach users to move selected documents to it via drag and drop.
If it's for web browser users but still for a single database, drag and drop won't work so OTTA's answer is correct.
But if what you are trying to do is create a unified 'Favorites' feature that spans multiple databases, whether it's personal or otherwise... there's considerably more programming to do.
You may also want to take a look at SwiftFile, which learns from your behaviour and suggest folders to sort into. SwiftFile comes "for free" with your Notes Licence & Install SW.
http://www.research.ibm.com/swiftfile/
I wanted to write an NSIS script, let's call it for now setup.nsi, and check
if several required dll files already exists in $SYSDIR
Let me emphasize on the word "several"
What I understand from nsis IfFileExists documentation is that if I type in:
IfFileExists $SYSDIR\blabla.dll +2 +1
then it checks if blabla.dll is in $SYSDIR .. but what if I want to know if *.dll from where setup.nsi copies the file (i.e. the *.dll's that I am interested in installing in.. and they are a lot of them.. so I can't just go around checking for all the names) exists in $SYSDIR
During uninstallation I want to then be able to delete them from $SYSDIR (using some uninstall.log to see if I really copied them in $SYSDIR.. and again the wildcard question).
Please be patient with me as I am really new to NSIS scripts.
Is it REALLY necessary to write and delete in $SYSDIR ? Unless yours is a system file, there's no reason for it to be in $__SYS__DIR. If you need to use a specific version of a library, consider DLL redirection (put your DLL in your app dir and use the .local feature) - see the MSDN article on DLL redirection and Side-by-side assemblies.
Plus, you are one typo away from wrecking the user's computer ("Deleted: C:\Windows\System32\user32.dll").
As Piskvor mentions, I don't think you should be worrying about deleting system DLLs in the uninstaller. In case you want to overwrite system DLLs with an updated version, you may want to look at the SetOverwrite command. It lets you overwrite files if what you've got is newer.
Windows XP (SP2?) and up has file protection for system32, so you can't overwrite system critical files in there.
Do try to stay away from that.
Also, to check for your file specifically, see if there's a plugin for NSIS that can calculate checksums and compare that on uninstall. That's probably the safest, IF you really need to do it.
I'd suggest install files somewhere else and add that to PATH.