PDA

View Full Version : Conditional copy files



NewsArchive
02-21-2005, 08:49 AM
[Monday, February 21, 2005 4:10 PM]

Hello all,

I needed to be able to let in a setup the user decide whether he wanted a
plain soft installation or a lan "connection" to an already installed soft!

In case anyone has the same needs here is the script code I finally came to
:

I just added the two types of installs in setup types ......
[ Setup Types ]
! If setup types are enabled, %SB_SETUPTYPEID% holds the selected type
! Warning: It is not recommended to manually modify the %SB_SETUPTYPEID%
variable!

:: Define Setup Type: MonoPoste ou Serveur
:: Define Setup Type: Poste de Travail
! Wizard dialog definition(s)

Here I added a select file dialog box which is hidden afterwards......
[ Interview User Interface ]
Define Wizard Dialog: #1 (Welcome)
Define Wizard Dialog: #2 (Readme)
Define Wizard Dialog: #3 (Select Setup Types [Standard])
Define Wizard Dialog: #4 (Select Program Folder)
Define Wizard Dialog: #5 (Select Install Folder)
Define Wizard Dialog: #6 (Select File)
Define Wizard Dialog: #7 (Ready to Install)

! The Wizard Loop displays the dialog screens that the user sees in the
installation

I just added a couple of variables and "checkpoints" .....
Set Variable %POSTE_TRAVAIL% to 0 "lan"
installation variable
Loop Wizard
Handle Wizard Events()
If %_SB_SETUPTYPEID% Equals "1" Then "normal"
installation
Show Wizard Dialog #4
Show Wizard Dialog #5
Hide Wizard Dialog #6
ElseIf %_SB_SETUPTYPEID% Equals "2" Then "lan" installation
Set Variable %POSTE_TRAVAIL% to 1
Hide Wizard Dialog #4
Hide Wizard Dialog #5
Set Variable %_SB_INSTALLDIR% to ExtractFolder(%_SB_INSTALLDIR%)
"select file" dialog so extract folder
Show Wizard Dialog #6
End
End

If %POSTE_TRAVAIL% Equals "1" Then
"lan" install chosen
Set Variable %RECOMMENCER_SERVEUR% to 0 "start again"
variable for checking correct lan folder etc ...
If %_SB_INSTALLDIR% Equals "" Or %_SB_INSTALLDIR% Contains Not Letters In
"cgf.exe" Then
Message Box "ATTENTION :\n\nVous devez sélectionner le fichier ..." --
"CGF Suite Comptable"
Set Variable %RECOMMENCER_SERVEUR% to 1
End
If %RECOMMENCER_SERVEUR% Equals "1" Then
Exit Installation
HERE I would like to get again the selct file dialog wizard.........
End
ElseIf %POSTE_TRAVAIL% Equals "0" Then
"normal" install chosen -> install files
! Display progress dialog
Display Setup Progress Dialog

! Create installation .log
Create Installation Log %_SB_INSTALLDIR%\uninst.log

[ Create Folders ]

::Create Folder %_SB_INSTALLDIR%\Export (Always Install)
::Create Folder %_SB_INSTALLDIR%\Graphiques (Always Install)
::Create Folder %_SB_INSTALLDIR%\Graphiques\Evolution (Always Install)
::Create Folder %_SB_INSTALLDIR%\Graphiques\Resultats (Always Install)
::Create Folder %_SB_INSTALLDIR%\img (Always Install)
::Create Folder %_SB_INSTALLDIR%\img\pays (Always Install)
::Create Folder %_SB_INSTALLDIR%\img\prd (Always Install)
::Create Folder %_SB_INSTALLDIR%\Import (Always Install)
::Create Folder %_SB_INSTALLDIR%\Zip (Always Install)
::Create Folder %_SB_INSTALLDIR%\Zip\Origine (Always Install)

[ Install Files ]

Install File "J:\003.ico" to %_SB_INSTALLDIR%\003.ico (Always Install)
................................................

end

here are shortcuts etc which are common to both installs .....

If all this can help someone.....

--
Cordialement - Best Regards
Jean-Pierre GUTSATZ

NewsArchive
02-22-2005, 01:59 AM
[Monday, February 21, 2005 8:19 PM]

Here is a revision taking in consideration the reselction of the path if
variable does not contain the proper value (thanks to a previous post of
F.L.) :

[ Interview User Interface ]
Define Wizard Dialog: #1 (Welcome)
Define Wizard Dialog: #2 (Readme)
Define Wizard Dialog: #3 (Select Setup Types [Standard])
Define Wizard Dialog: #4 (Select Program Folder)
Define Wizard Dialog: #5 (Select Install Folder)
Define Wizard Dialog: #6 (Select File)
Define Wizard Dialog: #7 (Ready to Install)

! The Wizard Loop displays the dialog screens that the user sees in the
installation
Set Variable %POSTE_TRAVAIL% to 0
Loop Wizard
Handle Wizard Events()
If %_SB_SETUPTYPEID% Equals "1" Then
Show Wizard Dialog #4
Show Wizard Dialog #5
Hide Wizard Dialog #6
ElseIf %_SB_SETUPTYPEID% Equals "2" Then
Set Variable %POSTE_TRAVAIL% to 1
Hide Wizard Dialog #4
Hide Wizard Dialog #5
Show Wizard Dialog #6
If %_SB_DIALOGID% Equals "6" Then -> 6
because of the dialog box is number 6....
Set Variable %CHECKVAR% to Upper(%_SB_INSTALLDIR%)
Set Variable %RESULT% to InStr(, %CHECKVAR%, "CGF.EXE")
If %RESULT% Equals "0" Then
Message Box "ATTENTION :\n\nVous devez sélectionner le fichier
...." -- "CGF Suite Comptable"
Set Focus to Control ID $DESTINATION_EDIT1$
Cycle Loop
End
End
Set Variable %_SB_INSTALLDIR% to ExtractFolder(%_SB_INSTALLDIR%)
End
End

If %POSTE_TRAVAIL% Equals "1" Then
ElseIf %POSTE_TRAVAIL% Equals "0" Then
Terminate Application "cgf.exe"
Terminate Application "cgfshop.exe"
! Display progress dialog
same from here on ....

Solves all my pbs!

--
Cordialement
Jean-Pierre GUTSATZ