Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 2nd March 2004, 15:26   #1
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 676
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

Greets, Brummelchen

Last edited by Brummelchen; 2nd March 2004 at 15:58.
Brummelchen is offline   Reply With Quote
Old 2nd March 2004, 15:45   #2
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
I have no idea what you mean. Please describe the problem, test it without the whole function and attach a script that compiles.
Joost Verburg is offline   Reply With Quote
Old 2nd March 2004, 15:57   #3
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 676
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

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.

Greets, Brummelchen
Brummelchen is offline   Reply With Quote
Old 2nd March 2004, 16:07   #4
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 676
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

Greets, Brummelchen
Brummelchen is offline   Reply With Quote
Old 2nd March 2004, 16:28   #5
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 676
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

Greets, Brummelchen
Brummelchen is offline   Reply With Quote
Old 2nd March 2004, 16:46   #6
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 676
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

Greets, Brummelchen
Brummelchen is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump