Archive: Codec pack installer?


Codec pack installer?
Ok, here the idea. You can see the picture bellow. First 3 items are irrelevant. The Graphs item is the issue. It should extract graph files for the applications MyTheatre, ProgDVB and Skyview. So, when I select ProgDVB and BlazeVideo codec for example, when I click on the Install button bellow, I should be asked for the ProgDVB plugins folder so the installation can extract graph files there. If I choose both ProgDVB and MyTheatre for example, I should be asked for plugins folder for both the ProgDVB AND MyTheatre.

Just to mention, the first 3 items go to my $INSTDIR, i.e. C:\Program Files\My codec pack\. So this goes here, a for the graphs items I need to choose the location.

How to do this?

http://img63.imageshack.us/img63/2748/pack7il.jpg


add a userpage with all needed directory requests, and enable/disable them depending on the selection.
you can do this in the SHOW function of the custom page.

see modernui readme and installoptions readme for details about creating custom pages with modern ui.


OK, i'll try to make this right. Thanks m8!


OK, here's the thing. I don't know where to start with questions.
1. On the picture bellow you can see that when I select some random way installation folder (C:\1) it adds the Nabukodonosor's DVB pack on it. And i don't want that. Here is my part of the script for that thing:

Section "BlazeVideo/Moonlight/Overlay" SEC55
SetOutPath "$INSTDIR"
File "Graphs\ProgDVB\tv.blazevideo.xgr"
SectionEnd


How to avoid this addon?

2.On the first picture, I want to install first 3 items in the exactly specified folder (C:\Program Files\Nabukodonosor's DVB Pack). But when I select the installation folder for my graph files (2nd picture), my first 3 item ALSO ectract in the selected folder. And I don't want that either. So, my scipt for that right now is like this:
Section "Blaze Video Decoder 4.5.0.2" SEC02
SetOutPath "$INSTDIR\Video\Blaze Video Decoder 4.5.0.2"
File "Video\Blaze Video Decoder 4.5.0.2\Blaze VideoDecoder.ax"
SectionEnd


So, I assume I need to change that $INSTDIR into absolute address like C:\Program Files\Nabukodonosor's DVB Pack? Is that right? Is there any other way?

3. Can you explain me the enable/disable thing you've mentioned? I can't figure that out.




http://img370.imageshack.us/img370/9981/pack26na.jpg

Anyone?


Add a backslash to InstallDir. Read about InstallDir in the documentation for more information.


I've solved that. Thanks for the solution. I've also solved 2nd problem. What about the 3rd question?


One more thing. For example I know that $PROGRAMFILES is C:\Program files. But how to specify only C:\? I want to extract something in f.a. C:\folder1, but what if someone doesn't have C:\ but D:\ or even E:\??? I've solved a similar problem with C:\Program files\some folder with changing it to $PROGRAMFILES\some folder. How to do this with C:\some folder? WHats the equivalent for root folder?


nothing.

use this one:

Var /GLOBAL ROOT
StrCpy $ROOT $PROGRAMFILES 0 3

$ROOT is now C:\ or D:\ or whatever ...

btw: thanx that you take care of this case!
most software companies don't. some even hardcode "C:\Program Files" and destroy e.g. german file structures ("C:\Programme" by default) with such behaviours.


Can you PLEASE explain to me how to do that thing in your first message? The thing with 3 directory selection. I'm stuck with that!


!define MUI_PAGE_CUSTOMFUNCTION_PRE "function1"
!insertmacro MUI_PAGE_DIRECTORY
!define MUI_PAGE_CUSTOMFUNCTION_PRE "function2"
!insertmacro MUI_PAGE_DIRECTORY
!define MUI_PAGE_CUSTOMFUNCTION_PRE "function3"
!insertmacro MUI_PAGE_DIRECTORY

:)


OK, i'll try this. Thanks.


That didn't help me. I'm 5 days in all this, so a need more help. :-( I tried with this article:
http://nsis.sourceforge.net/Two_inst..._one_installer
but it's for two installations and I need for 3. Also it has one section that's bad for my project:
## Also if no sections are selected, warn the user!

I've tried to delete that section, but then I got error after error.
Can someone please adapt this code for 3 installation and without this last thing? Or at least explain to me how to do it step by step. There's no other way for me. All the other work is over, only this thing to finish and it's all over. Please guys!


OK, i've pulled it off, with the script above, just modified it. BUT, there is a problem. It extracts the Skyview graphs (see the 1st picture) in all 3 folders. I've must mistaken somewhere in the loop. Here's the script (only relevant part):

## Create $PLUGINSDIR
Function .onInit2
InitPluginsDir
FunctionEnd

Function IsPROG1Selected
Push $R0
Push $R1

StrCpy $R0 ${PROG1_StartIndex} # Group 1 start

Loop:
IntOp $R0 $R0 + 1
SectionGetFlags $R0 $R1 # Get section flags
IntOp $R1 $R1 & ${SF_SELECTED}
StrCmp $R1 ${SF_SELECTED} 0 +3 # If section is selected, done
StrCpy $R0 1
Goto Done
StrCmp $R0 ${PROG1_EndIndex} 0 Loop

Done:
Pop $R1
Exch $R0
FunctionEnd

Function IsPROG2Selected
Push $R0
Push $R1

StrCpy $R0 ${PROG2_StartIndex} # Group 2 start

Loop:
IntOp $R0 $R0 + 1
SectionGetFlags $R0 $R1 # Get section flags
IntOp $R1 $R1 & ${SF_SELECTED}
StrCmp $R1 ${SF_SELECTED} 0 +3 # If section is selected, done
StrCpy $R0 1
Goto Done
StrCmp $R0 ${PROG2_EndIndex} 0 Loop

Done:
Pop $R1
Exch $R0
FunctionEnd

Function IsPROG3Selected
Push $R0
Push $R1

StrCpy $R0 ${PROG3_StartIndex} # Group 3 start

Loop:
IntOp $R0 $R0 + 1
SectionGetFlags $R0 $R1 # Get section flags
IntOp $R1 $R1 & ${SF_SELECTED}
StrCmp $R1 ${SF_SELECTED} 0 +3 # If section is selected, done
StrCpy $R0 1
Goto Done
StrCmp $R0 ${PROG3_EndIndex} 0 Loop

Done:
Pop $R1
Exch $R0
FunctionEnd

## Here we are selecting first sections to install
## by unselecting all the others!
Function SelectFilesA

# We need to save the state of the Group 2 Sections
# for the next InstFiles page
Push $R0
Push $R1

StrCpy $R0 ${PROG2_StartIndex} # Group 2 start

Loop:
IntOp $R0 $R0 + 1
SectionGetFlags $R0 $R1 # Get section flags
WriteINIStr "$PLUGINSDIR\sections.ini" Sections $R0 $R1 # Save state
!insertmacro UnselectSection $R0 # Then unselect it
StrCmp $R0 ${PROG2_EndIndex} 0 Loop

# Don't install prog 1?
Call IsPROG1Selected
Pop $R0
StrCmp $R0 1 +4
Pop $R1
Pop $R0
Abort

# Set current $INSTDIR to PROG1_InstDir define
StrCpy $INSTDIR "${PROG1_InstDir}"

Pop $R1
Pop $R0
FunctionEnd

## Here we need to unselect all Group 1 sections
## and then re-select those in Group 2 (that the user had selected on
## Components page)
Function SelectFilesB
Push $R0
Push $R1

StrCpy $R0 ${PROG1_StartIndex} # Group 1 start

Loop:
IntOp $R0 $R0 + 1
!insertmacro UnselectSection $R0 # Unselect it
StrCmp $R0 ${PROG1_EndIndex} 0 Loop

Call ResetFiles

# Don't install prog 2?
Call IsPROG2Selected
Pop $R0
StrCmp $R0 1 +4
Pop $R1
Pop $R0
Abort

# Set current $INSTDIR to PROG2_InstDir define
StrCpy $INSTDIR "${PROG2_InstDir}"

Pop $R1
Pop $R0
FunctionEnd

## This will set all sections to how they were on the components page
## originally
Function ResetFiles
Push $R0
Push $R1

StrCpy $R0 ${PROG2_StartIndex} # Group 2 start

Loop:
IntOp $R0 $R0 + 1
ReadINIStr "$R1" "$PLUGINSDIR\sections.ini" Sections $R0 # Get sec flags
SectionSetFlags $R0 $R1 # Re-set flags for this sec
StrCmp $R0 ${PROG2_EndIndex} 0 Loop

Pop $R1
Pop $R0
FunctionEnd

Function SelectFilesC

# We need to save the state of the Group 3 Sections
# for the next InstFiles page
Push $R0
Push $R1

StrCpy $R0 ${PROG2_StartIndex} # Group 3 start

Loop:
IntOp $R0 $R0 + 1
SectionGetFlags $R0 $R1 # Get section flags
WriteINIStr "$PLUGINSDIR\sections.ini" Sections $R0 $R1 # Save state
!insertmacro UnselectSection $R0 # Then unselect it
StrCmp $R0 ${PROG2_EndIndex} 0 Loop

# Don't install prog 3?
Call IsPROG3Selected
Pop $R0
StrCmp $R0 1 +4
Pop $R1
Pop $R0
Abort

# Set current $INSTDIR to PROG1_InstDir define
StrCpy $INSTDIR "${PROG3_InstDir}"

Pop $R1
Pop $R0
FunctionEnd



I can't see the problem. It's all greek to me. :D

You should use the LogicLib for loops, it's simpler.

I don't see where it extract Skyview in that script. Attach the entire script or at least include the extraction code.

Please attach large scripts next time.


OK, here's the entire script.


Done it! yeah!!

I didn't include the deselect script for the third item:

StrCpy $R0 ${PROG1_StartIndex}    # Group 1 start

Loop:
IntOp $R0 $R0 + 1
!insertmacro UnselectSection $R0 # Unselect it
StrCmp $R0 ${PROG1_EndIndex} 0 Loop