Old 23rd January 2006, 12:48   #1
Nabukodonosor
Junior Member
 
Join Date: Jan 2006
Posts: 16
Unhappy 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?

Nabukodonosor is offline   Reply With Quote
Old 23rd January 2006, 12:57   #2
Comm@nder21
Major Dude
 
Join Date: Jul 2003
Location: germany, b-w
Posts: 734
Send a message via ICQ to Comm@nder21
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.
Comm@nder21 is offline   Reply With Quote
Old 23rd January 2006, 13:34   #3
Nabukodonosor
Junior Member
 
Join Date: Jan 2006
Posts: 16
OK, i'll try to make this right. Thanks m8!
Nabukodonosor is offline   Reply With Quote
Old 23rd January 2006, 15:17   #4
Nabukodonosor
Junior Member
 
Join Date: Jan 2006
Posts: 16
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:

code:
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:
code:
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.




Nabukodonosor is offline   Reply With Quote
Old 24th January 2006, 12:05   #5
Nabukodonosor
Junior Member
 
Join Date: Jan 2006
Posts: 16
Anyone?
Nabukodonosor is offline   Reply With Quote
Old 24th January 2006, 17:31   #6
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Add a backslash to InstallDir. Read about InstallDir in the documentation for more information.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 24th January 2006, 19:39   #7
Nabukodonosor
Junior Member
 
Join Date: Jan 2006
Posts: 16
I've solved that. Thanks for the solution. I've also solved 2nd problem. What about the 3rd question?
Nabukodonosor is offline   Reply With Quote
Old 24th January 2006, 19:46   #8
Nabukodonosor
Junior Member
 
Join Date: Jan 2006
Posts: 16
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?
Nabukodonosor is offline   Reply With Quote
Old 24th January 2006, 21:42   #9
Comm@nder21
Major Dude
 
Join Date: Jul 2003
Location: germany, b-w
Posts: 734
Send a message via ICQ to Comm@nder21
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.
Comm@nder21 is offline   Reply With Quote
Old 24th January 2006, 22:24   #10
Nabukodonosor
Junior Member
 
Join Date: Jan 2006
Posts: 16
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!
Nabukodonosor is offline   Reply With Quote
Old 25th January 2006, 12:27   #11
Comm@nder21
Major Dude
 
Join Date: Jul 2003
Location: germany, b-w
Posts: 734
Send a message via ICQ to Comm@nder21
!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

Comm@nder21 is offline   Reply With Quote
Old 25th January 2006, 15:03   #12
Nabukodonosor
Junior Member
 
Join Date: Jan 2006
Posts: 16
OK, i'll try this. Thanks.
Nabukodonosor is offline   Reply With Quote
Old 25th January 2006, 16:18   #13
Nabukodonosor
Junior Member
 
Join Date: Jan 2006
Posts: 16
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!
Nabukodonosor is offline   Reply With Quote
Old 25th January 2006, 18:23   #14
Nabukodonosor
Junior Member
 
Join Date: Jan 2006
Posts: 16
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):

code:
## 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.
Nabukodonosor is offline   Reply With Quote
Old 26th January 2006, 17:33   #15
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 26th January 2006, 21:54   #16
Nabukodonosor
Junior Member
 
Join Date: Jan 2006
Posts: 16
OK, here's the entire script.
Attached Files
File Type: nsi script.nsi (41.0 KB, 602 views)
Nabukodonosor is offline   Reply With Quote
Old 27th January 2006, 00:03   #17
Nabukodonosor
Junior Member
 
Join Date: Jan 2006
Posts: 16
Done it! yeah!!

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

code:
StrCpy $R0 ${PROG1_StartIndex} # Group 1 start

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

Nabukodonosor is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast 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