Archive: whats wrong :(


whats wrong :(
Var declaration before:

!define INISECTION "sdatupd"
!define SDATINI "sdatupd.ini"
VAR PATHINI ; $PATHINI
VAR AUTODOWN ; $AUTODOWN

some code before function:

StrCpy $PATHINI "$EXEDIR\${SDATINI}"
call readsettings


function readsettings

ClearErrors
ReadINIStr $VERSIONINFO $PATHINI ${INISECTION} version
IfErrors 0 readsettings01
StrCmp $VERSIONINFO "1.2" readsettings01
StrCmp $VERSIONINFO "1.3" readsettings01
DeleteINISec $PATHINI ${INISECTION}
readsettings01:
WriteINIStr $PATHINI ${INISECTION} version "${VERSION}"

; read out autodown
ClearErrors
ReadINIStr $AUTODOWN $PATHINI ${INISECTION} autodown
IfErrors 0 readsettings02
StrCmp $AUTODOWN "0" readsettings02
StrCmp $AUTODOWN "1" readsettings02
WriteINIStr $PATHINI ${INISECTION} autodown "1"
readsettings02:
!insertmacro MUI_INSTALLOPTIONS_WRITE "menu01.ini" "Field 2" "State" $AUTODOWN

; read out path
ClearErrors
ReadINIStr $INSTDIR $PATHINI ${INISECTION} path
IfErrors readsettings09
!insertmacro MUI_INSTALLOPTIONS_WRITE "menu01.ini" "Field 11" "State" $INSTDIR
readsettings09:

functionend

1st works, 2nd not, 3rd works again - the INI looks like this

[sdatupd]
version=1.2
autodown=
path=C:\Download

autodown has to be 0 or 1

Code skips WriteINIStr but why ?

BTW: i cant rename/delete an INI file which is opened by setup?


thx


I have no idea what you mean. Please describe the problem, test it without the whole function and attach a script that compiles.


thats all...

i declare the vars

and function opens INI and read out values - if not valid or empty it sets default value.
each value is put in the IO

1st & 3rd case with VERSION and INSTDIR are ok, 2nd not (autodown) - and i dont get it why.

ok - i sorted the script above logical now...

Joost - i am trying now for half an hour the code with and w/o brackets {} but i didn't got it yet :cry:

PS some parts of code are valid cause the ini-file is created if not present and as you can see the entries too - but w/o values.


Ok, second attempt

the first IO normally shows the values of the INI (in check boxes)

i found out that the values from ini are not stored in the IO.

so especially this part dont works:

!insertmacro MUI_INSTALLOPTIONS_WRITE "menu01.ini" "Field 2" "State" $AUTODOWN

where is my fault?

thx


3rd attempt:

; read out autodown
ClearErrors
ReadINIStr $AUTODOWN $PATHINI "${INISECTION}" autodown
IfErrors 0 readsettings02
StrCmp $AUTODOWN "0" readsettings02
StrCmp $AUTODOWN "1" readsettings02
StrCpy $AUTODOWN "1"
WriteINIStr $PATHINI "${INISECTION}" autodown "1"
readsettings02:
!insertmacro MUI_INSTALLOPTIONS_WRITE "menu01.ini" "Field 2" "State" $AUTODOWN


>> IfErrors 0 readsettings02

is not working proper - i remind some trouble with jumps that can not be relativ - is this a case of it?

hmm

could it be
>> IfErrors +1 readsettings02
?

From help
"+1 jumps to the next instruction"

IfErrors is not indicated not to work with relativ jumps...

PS
i forgot
StrCpy $AUTODOWN "1"
if not a valid value is found - so the IO is now working proper too


gotcha :)

is it possible that this part is totally nonsens?

ClearErrors
ReadINIStr $AUTODOWN $PATHINI ${INISECTION} autodown
IfErrors 0 readsettings02

So i think that ReadINIStr is not only reading - it creates entries because IfErrors NEVER grips - there is no error cause the entry exists (but it never has to)

pls check your script - ReadINIStr may not create any entry - it only reads out