Archive: Wierd


Wierd
  Something has just started to my sections. The first section is never selected, even though I have told it to...

.onInit


StrCpy $R1 ${secBSPnew} ; Gotta remember which section we are at now...
SectionGetFlags ${SecBSPreq} $R0
IntOp $R0 $R0 | ${SF_SELECTED}
SectionSetFlags ${SecBSPreq} $R0

SectionGetFlags ${SecBSPnew} $R0
IntOp $R0 $R0 | ${SF_SELECTED}
SectionSetFlags ${SecBSPnew} $R0

SectionGetFlags ${SecBSPold} $R0
IntOp $R0 $R0 & ${SECTION_OFF}
SectionSetFlags ${SecBSPold} $R0

StrCpy $3 ${secVISfull} ; Gotta remember which section we are at now...
SectionGetFlags ${SecVISreq} $2
IntOp $2 $2 | ${SF_SELECTED}
SectionSetFlags ${SecVISreq} $2

SectionGetFlags ${SecVISfull} $2
IntOp $2 $2 | ${SF_SELECTED}
SectionSetFlags ${SecVISfull} $2

SectionGetFlags ${SecVISfast} $2
IntOp $2 $2 & ${SECTION_OFF}
SectionSetFlags ${SecVISfast} $2

StrCpy $5 ${secRADextra} ; Gotta remember which section we are at now...
SectionGetFlags ${SecRADreq} $4
IntOp $4 $4 | ${SF_SELECTED}
SectionSetFlags ${SecRADreq} $4

SectionGetFlags ${SecRADextra} $4
IntOp $4 $4 | ${SF_SELECTED}
SectionSetFlags ${SecRADextra} $4

SectionGetFlags ${SecRADnormal} $4
IntOp $4 $4 | ${SF_SELECTED}
SectionSetFlags ${SecRADnormal} $4

SectionGetFlags ${SecRADfast} $4
IntOp $4 $4 & ${SECTION_OFF}
SectionSetFlags ${SecRADfast} $4


.onSecChange

StrCpy $1 ${SF_SELECTED}
SectionGetFlags ${secVISreq} $0
IntOp $1 $1 & $0
SectionGetFlags ${secVISfull} $0
IntOp $1 $1 & $0
SectionGetFlags ${secVISfast} $0
IntOp $1 $1 & $0
StrCmp $1 0 skip2
SectionSetFlags ${secVISreq} 0
SectionSetFlags ${secVISfull} 0
SectionSetFlags ${secVISfast} 0
skip2:

StrCpy $1 ${SF_SELECTED}
SectionGetFlags ${secRADreq} $0
IntOp $1 $1 & $0
SectionGetFlags ${secRADextra} $0
IntOp $1 $1 & $0
SectionGetFlags ${secRADnormal} $0
IntOp $1 $1 & $0
SectionGetFlags ${secRADfast} $0
IntOp $1 $1 & $0
StrCmp $1 0 skip3
SectionSetFlags ${secRADreq} 0
SectionSetFlags ${secRADextra} 0
SectionSetFlags ${secRADnormal} 0
SectionSetFlags ${secRADfast} 0
skip3:

; Turn off old selected section
SectionGetFlags $R1 $R0
IntOp $R0 $R0 & ${SECTION_OFF}
SectionSetFlags $R1 $R0

SectionGetFlags ${SecBSPnew} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
IntCmp $R0 ${SF_SELECTED} 0 +2 +2
StrCpy $R1 ${SecBSPnew}

SectionGetFlags ${SecBSPold} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
IntCmp $R0 ${SF_SELECTED} 0 +2 +2
StrCpy $R1 ${SecBSPold}

StrCmp $R1 $R1 0 +2 ; selection hasn't changed
SectionGetFlags $R1 $R0
IntOp $R0 $R0 | ${SF_SELECTED}
SectionSetFlags $R1 $R0


; Turn off old selected section
SectionGetFlags $2 $3
IntOp $3 $3 & ${SECTION_OFF}
SectionSetFlags $2 $3

SectionGetFlags ${SecVISreq} $3
IntOp $3 $3 & ${SF_SELECTED}
IntCmp $3 ${SF_SELECTED} 0 +2 +2
StrCpy $2 ${SecVISreq}

SectionGetFlags ${SecVISfull} $3
IntOp $3 $3 & ${SF_SELECTED}
IntCmp $3 ${SF_SELECTED} 0 +2 +2
StrCpy $2 ${SecVISfull}

SectionGetFlags ${SecVISfast} $3
IntOp $3 $3 & ${SF_SELECTED}
IntCmp $3 ${SF_SELECTED} 0 +2 +2
StrCpy $2 ${SecVISfast}

StrCmp $2 $2 0 +2 ; selection hasn't changed
SectionGetFlags $2 $3
IntOp $3 $3 | ${SF_SELECTED}
SectionSetFlags $2 $3


; Turn off old selected section
SectionGetFlags $4 $5
IntOp $5 $5 & ${SECTION_OFF}
SectionSetFlags $4 $5

SectionGetFlags ${SecRADreq} $5
IntOp $5 $5 & ${SF_SELECTED}
IntCmp $5 ${SF_SELECTED} 0 +2 +2
StrCpy $4 ${SecRADreq}

SectionGetFlags ${SecRADextra} $5
IntOp $5 $5 & ${SF_SELECTED}
IntCmp $5 ${SF_SELECTED} 0 +2 +2
StrCpy $4 ${SecRADextra}

SectionGetFlags ${SecRADnormal} $5
IntOp $5 $5 & ${SF_SELECTED}
IntCmp $5 ${SF_SELECTED} 0 +2 +2
StrCpy $4 ${SecRADnormal}

SectionGetFlags ${SecRADfast} $5
IntOp $5 $5 & ${SF_SELECTED}
IntCmp $5 ${SF_SELECTED} 0 +2 +2
StrCpy $4 ${SecRADfast}

StrCmp $4 $4 0 +2 ; selection hasn't changed
SectionGetFlags $4 $5
IntOp $5 $5 | ${SF_SELECTED}
SectionSetFlags $4 $5


The SecBSPnew should start selected but never does. I then have to click on it twice to select it.
It just started happening, and I have no idea why.

I just had 2 sections above it that I removed, but they were nothing to do with it.

-Stuart:cry:

did you include:


!Include "Sections.nsh"


At the top of your script?

Also, is it possible to rename directories

I'd like to rename $7\textures to $7\texturesx


-Stuart


Originally posted by dark_boy
did you include:


!Include "Sections.nsh"


At the top of your script?
I don't have NSIS 2.0b3 yet.
That just has the different section defines
I've got them in my script instead...

!define SF_SELECTED 1
!define SF_RO 16
!define TEMP_SET 16+1
!define SECTION_OFF 0xFFFFFFFE

It wouldn't make any difference anyway.

-Stuart

Originally posted by Afrow UK
Also, is it possible to rename directories

I'd like to rename $7\textures to $7\texturesx
Here is the answer:

[/quote]Quote from documentation

3.8.1.6 Rename

Rename source_file to dest_file. Functions just like the Win32 API MoveFile, which means you can move a file from anywhere on the system to anywhere else, and you can move a directory to somewhere else on the same drive. If /REBOOTOK is specified, and the file cannot be overwritten, then the file is moved when the system reboots -- if the file will be moved on a reboot, the reboot flag will be set. The error flag is set if the file cannot be renamed (and /REBOOTOK is not used) or if the source file does not exist.

Example:
;Here, $7 is "C:\\Path\\"


>Rename "$7\\textures" "$7\\texturesx"

Ok thanks, I used that but it never seemed to work.

Anyhow...
Here is a small script to change the font of the Log Window Text, but it doesn't seem to work...


!include "${NSISDIR}\Include\WinMessages.nsh"

Function .onGUIInit
FindWindow $1 "#32770" "" $HWNDPARENT
GetDlgItem $1 $HWNDPARENT 1016
CreateFont $2 "Fixedsys" "8" "700"
SendMessage $1 ${WM_SETFONT} $2 0
FunctionEnd

What have a done wrong?

-Stuart

Hey! I fixed it:


!include "MUI.nsh"
!include "WinMessages.nsh"
!define MUI_WELCOMEPAGE
!define MUI_LICENSEPAGE
!define MUI_COMPONENTSPAGE
!define MUI_DIRECTORYPAGE
!define MUI_CUSTOMFUNCTION_INSTFILES_SHOW "LogFont"
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_FINISHPAGE

Function "LogFont"
FindWindow $1 "#32770" "" $HWNDPARENT
GetDlgItem $1 $1 1016
CreateFont $2 "Comic Sans Ms" "8" "700"
SendMessage $1 ${WM_SETFONT} $2 0
FunctionEnd



I'm using the modern UI...
If not, use


Page instfiles "" "LogFont" ""


helps? :)

Thanx dude :)

I'll put it up on the Archive (written by you of course :))

-Stuart


I'm going to write the code for the uninstaller log window, too.
Shouldn't be a problem (I hope :igor: )


I still can't get the Components problem fixed...

Just doesn't make sense why it isn't working.


-Stuart


Since I removed 2 old sections before it started playing up, I added 2 fake ones back:


Section -2
SectionEnd

Section -1
SectionEnd


It has fixed it completely.

Very strange!


-Stuart

About the LogFont in the uninstaller, done :D


Function "un.LogFont"
FindWindow $3 "#32770" "" $HWNDPARENT
GetDlgItem $3 $3 1016
CreateFont $4 "Comic Sans Ms" "8" "700"
SendMessage $3 ${WM_SETFONT} $4 0
FunctionEnd

Section "Uninstall"
Call un.LogFont
...
SectionEnd


yupi :p

I discovered a bug in System.nsh (in folder Modern UI):

These !defines aren't working:

!define MUI_UNCUSTOMFUNCTION_INSTFILES_PRE
!define MUI_UNCUSTOMFUNCTION_INSTFILES_SHOW
!define MUI_UNCUSTOMFUNCTION_INSTFILES_LEAVE

The "{MUI_UNCUSTOMFUNCTION_INSTFILES_PRE}", "{MUI_UNCUSTOMFUNCTION_INSTFILES_SHOW}" and "{MUI_UNCUSTOMFUNCTION_INSTFILES_LEAVE}" are laking a $ before these, here is the code that have this bug (quote from System.nsh):


macro MUI_UNFUNCTION_INSTFILESPAGE PRE SHOW LEAVE


!ifndef MUI_NOVERBOSE
!ifndef MUI_MANUALVERBOSE
!verbose 3
!endif
!endif

Function ${
PRE}
!insertmacro MUI_HEADER_TEXT $(un.MUI_UNTEXT_UNINSTALLING_TITLE) $(un.MUI_UNTEXT_UNINSTALLING_SUBTITLE)
!ifdef MUI_UNCUSTOMFUNCTION_INSTFILES_PRE
Call "***91;b***93;{MUI_UNCUSTOMFUNCTION_INSTFILES_PRE}***91;/b***93;"
!endif
FunctionEnd

Function "${SHOW}"
!ifdef MUI_UNCUSTOMFUNCTION_INSTFILES_SHOW
Call "***91;b***93;{MUI_UNCUSTOMFUNCTION_INSTFILES_SHOW}***91;/b***93;"
!endif
FunctionEnd

Function "${LEAVE}"
!ifdef MUI_UNCUSTOMFUNCTION_INSTFILES_LEAVE
Call "***91;b***93;{MUI_UNCUSTOMFUNCTION_INSTFILES_LEAVE}***91;/b***93;"
!endif
FunctionEnd

!ifndef MUI_NOVERBOSE
!ifndef MUI_MANUALVERBOSE
!verbose 4
!endif
!endif

!macroend
>
This is the code to fix that:


macro MUI_UNFUNCTION_INSTFILESPAGE PRE SHOW LEAVE


!ifndef MUI_NOVERBOSE
!ifndef MUI_MANUALVERBOSE
!verbose 3
!endif
!endif

Function ${
PRE}
!insertmacro MUI_HEADER_TEXT $(un.MUI_UNTEXT_UNINSTALLING_TITLE) $(un.MUI_UNTEXT_UNINSTALLING_SUBTITLE)
!ifdef MUI_UNCUSTOMFUNCTION_INSTFILES_PRE
Call "${MUI_UNCUSTOMFUNCTION_INSTFILES_PRE}"
!endif
FunctionEnd

Function "${SHOW}"
!ifdef MUI_UNCUSTOMFUNCTION_INSTFILES_SHOW
Call "${MUI_UNCUSTOMFUNCTION_INSTFILES_SHOW}"
!endif
FunctionEnd

Function "${LEAVE}"
!ifdef MUI_UNCUSTOMFUNCTION_INSTFILES_LEAVE
Call "${MUI_UNCUSTOMFUNCTION_INSTFILES_LEAVE}"
!endif
FunctionEnd

!ifndef MUI_NOVERBOSE
!ifndef MUI_MANUALVERBOSE
!verbose 4
!endif
!endif

!macroend
>

Thanks. Fixed :D


no wonder... :D


Afrow and deguix, please attach huge scripts or edit them to show only the relative contents. It's impossible to read forum threads when they are filled with dozens of lines of code.