0

I need to edit an INI file that contains no sections. Inno's internal INI "editor" (or whatever) won't allow writing "outside" of a section. So, by what other means can I assign a value to a key called, let's say 'key 1'?

Also, if it makes any difference, the value I need to write should be the result of a function, named GetUserInput(yes, it's a String).

  • 2
    You could read this file as string and then either add new line or replace existing (e.g. [this way](http://stackoverflow.com/questions/19313517/inno-setup-compiler-how-to-edit-ini-file-and-replace-a-value-with-app-constan/19313681#19313681)). – RobeN Jan 08 '16 at 22:53
  • Well, that solution already makes me feel stupid, but to make it better, it won't cooperate with me, and I assume that's because I'm doing something very stupid again: StringChange(U, 'User1', GetUserInput); This Results in "Invalid number of parameters" – George Hovhannisian Jan 08 '16 at 23:20
  • OK, I got over that by replacing `GetUserInput` with `Page.Values[0]`, although that already is the result of `GetUserInput`. Anyway, now I want Inno to make a change only if the value is different, but, you guessed it, it doesn't work printf("%d\n", 42); /*procedure CurStepChanged(CurStep: TSetupStep); Begin if (CurStep=ssPostInstall) and GetUserInput <> 'User1' then <-- Invalid number of parameters begin WriteUserInput; end End; */ – George Hovhannisian Jan 09 '16 at 00:04
  • Well, I guess changing `user1` into `user1` won't be the end of the world, so that doesn't matter. But what matters is, @RobeN , I don't know if I can mark a comment as a solution. – George Hovhannisian Jan 09 '16 at 00:15
  • [Your `GetUserInput`](http://stackoverflow.com/q/34684128/850848) has one parameter (although it does not use it), so you have to provide a dummy argument to it: `GetUserInput('')`. – Martin Prikryl Jan 09 '16 at 07:24
  • @GeorgeHovhannisian as this is kind of duplicate question it may not receive full answer, but just one in comment. – RobeN Jan 09 '16 at 11:46

0 Answers0