Archive: Problems Replacing Lines in File


Problems Replacing Lines in File
Ok, so I have this installer that installs a mod for a game, and you need to configure certain settings in this file to get it set up.

I'm using the function from the wiki:
http://nsis.sourceforge.net/Write_to...le_line_number

Now, the problem is, it's deleting the file!
Is there a better function to use? The file is already written when I install, and I'm going into the file and replacing certain lines with a different value depending on what the user said.

I know what the line number is that I need to replace, so I don't need a function to search - just to replace a whole line.


Use ConfigWrite from the NSIS documentation. It's under Useful Headers.

-Stu


Ok, one other problem I need to enable/disable some text boxes depending on the state of a checkbox. Any way to do this? I did a search and I only came up with some old threads from years past.


Have a look at Examples\InstallOpions\testnotify.nsi

-Stu


Ah, that won't work, Afrow. Here's what my file looks like: (It's LUA)


ECS_ADMINS_IMPORTULX = true; -- Import admins from ULX?
ECS_ADMINS_IMPORTMANI = false; -- Import admins from Mani?

ECS_ADMINS_ULX_REQACCESS_R = "NONE"; -- Required flag in ULX to be a restricted user. (Can't use it all)
ECS_ADMINS_ULX_REQACCESS_B = "r"; -- Required flag in ULX to be an advanced user
ECS_ADMINS_ULX_REQACCESS_A = "e"; -- Required flag in ULX to be an admin
ECS_ADMINS_ULX_REQACCESS_S = "a"; -- Required flag in ULX to be a super admin


Well, for example, I need to replace the first line with ECS_ADMINS_IMPORTULX = false; or ECS_ADMINS_IMPORTULX = true;, depending on what the user says.

This is probably better for what you need then:
http://nsis.sourceforge.net/Replace_...ecified_string

-Stu