;installation de 3DxSoftware_v3-6-8 à partir du fichier 3DxSoftware_v3-6-8.exe
;JEAN-RENE DANIS 07-10-08
;Liste des variable(s)
;variable qui définit l'emplacement du fichier log
$DossierDeLog = "%systemdrive%\install\log\"
;variable qui définit la destination temporaire :
$dossierprov = '%systemdrive%\install\'
;variable qui définit le dossier de 7Zip ou se trouve 7z.exe :
$SEI_7Z = '%SYSTEMDrive%\Program Files\7-Zip'
;Création du dossier pour mettre le fichier log si ce dossier n'existe pas
IF NOT EXIST ($DossierDeLog)
MD $DossierDeLog
ENDIF
;Ouverture du fichier log et redirection des messages
IF RedirectOutput($DossierDeLog + @SCRIPTNAME + ".txt") = 0
?? "Ouverture de " + @SCRIPTNAME + " à " + @TIME
ELSE
? "Impossible de créer le fichier log"
GOTO "finerreur"
ENDIF
cd @SCRIPTDIR\
;Chargement d'une fonction : ShellCMD
;Ce script charge une fonction sauf si elle a déjà été chargée.
;Verifier que le nom de la fonction à chargée est bien présent dans
;le nom de la variable $exist...des 2ieme et 7ieme lignes ci-dessou
$emplacementfonction = "ShellCmd.udf"
IF $existShellCMD = "exist"
? "La fonction " + $emplacementfonction + " a déjà été chargée"
ELSE
IF EXIST ($emplacementfonction)
CALL $emplacementfonction
$existShellCMD = "exist"
? "La fonction " + $emplacementfonction + " a été chargée"
ELSE
? "La fonction " + $emplacementfonction + " n'a pas été trouvée"
ENDIF
ENDIF
;Chargement d'une fonction : GetExtFileProperties
;Ce script charge une fonction sauf si elle a déjà été chargée.
;Verifier que le nom de la fonction à chargée est bien présent dans
;le nom de la variable $exist...des 2ieme et 7ieme lignes ci-dessou
$emplacementfonction = "GetExtFileProperties.udf"
IF $existGetExtFileProperties = "exist"
? "La fonction " + $emplacementfonction + " a déjà été chargée"
ELSE
IF EXIST ($emplacementfonction)
CALL $emplacementfonction
$existGetExtFileProperties = "exist"
? "La fonction " + $emplacementfonction + " a été chargée"
ELSE
? "La fonction " + $emplacementfonction + " n'a pas été trouvée"
ENDIF
ENDIF
;Verifie si le programme est déjà installé et affiche sa version
IF @ONWOW64 = 1
$prgatester = "%SYSTEMDrive%\Program Files\3Dconnexion\3Dconnexion 3DxSoftware\3DxWare64\3dxsrv.exe"
ELSE
$prgatester = "%SYSTEMDrive%\Program Files\3Dconnexion\3Dconnexion 3DxSoftware\3DxWare\3dxsrv.exe"
ENDIF
IF EXIST ($prgatester)
IF @PRODUCTTYPE = "Windows Vista Business Edition"
? "Le programme est déjà installé à la version : " + GetExtFileProperties($prgatester,145)
ELSE
? "Le programme est déjà installé à la version : " + GetExtFileProperties($prgatester,37)
ENDIF
GOTO "finerreur"
ELSE
? "Le programme n'est pas déjà installé : lancement de l'installation."
ENDIF
;Verifie si le programme est déjà installé et affiche sa version (2ième possibilitées de destination)
IF @ONWOW64 = 1
;--------------A TESTER-----------------
$prgatester = "%SYSTEMDrive%\Program Files\3Dconnexion\3Dconnexion 3DxWare\3dxsrv.exe"
ELSE
$prgatester = "%SYSTEMDrive%\Program Files\3Dconnexion\3Dconnexion 3DxWare\3dxsrv.exe"
ENDIF
IF EXIST ($prgatester)
IF @PRODUCTTYPE = "Windows Vista Business Edition"
? "Le programme est déjà installé à la version : " + GetExtFileProperties($prgatester,145)
ELSE
? "Le programme est déjà installé à la version : " + GetExtFileProperties($prgatester,37)
ENDIF
GOTO "finerreur"
ELSE
? "Le programme n'est pas déjà installé : lancement de l'installation."
ENDIF
;creation du dossier de destination
IF NOT EXIST ($dossierprov)
MD $dossierprov
? "Le dossier : " + $dossierprov + " a été créé."
ELSE
? "Le dossier : " + $dossierprov + " existe déjà."
ENDIF
;décompression d'un fichier
$fichieradecomp = '3DxSoftware_v3-6-8.exe'
$destinationdeladecomp = $dossierprov + '\3DxSoftware_v3-6-8'
IF EXIST ($fichieradecomp)
$cmd_sei = '"'+$SEI_7Z+'\7z.exe" x -o' + $destinationdeladecomp + ' ' + $fichieradecomp
? $cmd_sei
$codrec = shellcmd('"$cmd_sei"',0)
IF $codrec <> 0
? "Erreur n° " + $codrec
GOTO "finerreur"
ENDIF
ELSE
? "Décompression impossible"
GOTO "finerreur"
ENDIF
;décompression d'un fichier
$fichieradecomp = $dossierprov + '\3DxSoftware_v3-6-8\3DxSoftware.exe'
$destinationdeladecomp = $dossierprov + '\3DxSoftware_v3-6-8'
IF EXIST ($fichieradecomp)
$cmd_sei = '"'+$SEI_7Z+'\7z.exe" x -o' + $destinationdeladecomp + ' ' + $fichieradecomp
? $cmd_sei
$codrec = shellcmd('"$cmd_sei"',0)
IF $codrec <> 0
? "Erreur n° " + $codrec
GOTO "finerreur"
ENDIF
ELSE
? "Décompression impossible"
GOTO "finerreur"
ENDIF
;effacement d'un fichier
del $dossierprov + '\3DxSoftware_v3-6-8\3DxSoftware.exe' /c /f /s
;Lancement de l'installation en fonction de l'architecture de la machine
cd $dossierprov + '\3DxSoftware_v3-6-8'
IF @ONWOW64 = 1
? "Installation pour une architecture 64bit"
$cmd_sei = 'msiexec /i components64\3DxWare\3DxWare64.msi /passive /norestart'
? $cmd_sei
$codrec = shellcmd('"$cmd_sei"',0)
IF $codrec <> 0
? "Erreur n° " + $codrec
GOTO "finerreur"
ENDIF
$cmd_sei = 'msiexec /i components64\3DxAutoCAD2008\3DxAutoCAD2008.msi /passive /norestart'
? $cmd_sei
$codrec = shellcmd('"$cmd_sei"',0)
IF $codrec <> 0
? "Erreur n° " + $codrec
GOTO "finerreur"
ENDIF
$cmd_sei = 'msiexec /i components64\3DxAutoCAD2009\3DxAutoCAD2009.msi /passive /norestart'
? $cmd_sei
$codrec = shellcmd('"$cmd_sei"',0)
IF $codrec <> 0
? "Erreur n° " + $codrec
GOTO "finerreur"
ENDIF
$cmd_sei = 'msiexec /i components64\3DxInventor\3DxInventor64.msi /passive /norestart'
? $cmd_sei
$codrec = shellcmd('"$cmd_sei"',0)
IF $codrec <> 0
? "Erreur n° " + $codrec
GOTO "finerreur"
ENDIF
$cmd_sei = 'msiexec /i components64\3DxNX4\3DxNX4.msi /qn /passive /norestart'
? $cmd_sei
$codrec = shellcmd('"$cmd_sei"',0)
IF $codrec <> 0
? "Erreur n° " + $codrec
GOTO "finerreur"
ENDIF
$cmd_sei = 'msiexec /i components64\3DxNX5\3DxNX5.msi /passive /norestart'
? $cmd_sei
$codrec = shellcmd('"$cmd_sei"',0)
IF $codrec <> 0
? "Erreur n° " + $codrec
GOTO "finerreur"
ENDIF
$cmd_sei = 'msiexec /i components64\3DxNX6\3DxNX6.msi /passive /norestart'
? $cmd_sei
$codrec = shellcmd('"$cmd_sei"',0)
IF $codrec <> 0
? "Erreur n° " + $codrec
GOTO "finerreur"
ENDIF
$cmd_sei = 'msiexec /i components64\3DxProENGINEER\3DxProENGINEER.msi /passive /norestart'
? $cmd_sei
$codrec = shellcmd('"$cmd_sei"',0)
IF $codrec <> 0
? "Erreur n° " + $codrec
GOTO "finerreur"
ENDIF
$cmd_sei = 'msiexec /i components64\3DxProENGINEERWF4\3DxProENGINEERWF4.msi /passive /norestart'
? $cmd_sei
$codrec = shellcmd('"$cmd_sei"',0)
IF $codrec <> 0
? "Erreur n° " + $codrec
GOTO "finerreur"
ENDIF
$cmd_sei = 'msiexec /i components64\3DxSolidEdge\3DxSolidEdge64.msi /passive /norestart'
? $cmd_sei
$codrec = shellcmd('"$cmd_sei"',0)
IF $codrec <> 0
? "Erreur n° " + $codrec
GOTO "finerreur"
ENDIF
$cmd_sei = 'msiexec /i components64\3DxSolidWorks\3DxSolidWorks64.msi /passive /norestart'
? $cmd_sei
$codrec = shellcmd('"$cmd_sei"',0)
IF $codrec <> 0
? "Erreur n° " + $codrec
GOTO "finerreur"
ENDIF
$cmd_sei = 'msiexec /i components\3DxAdobe3D\3DxAdobe3D.msi /passive /norestart'
? $cmd_sei
$codrec = shellcmd('"$cmd_sei"',0)
IF $codrec <> 0
? "Erreur n° " + $codrec
GOTO "finerreur"
ENDIF
$cmd_sei = 'msiexec /i components\3DxAutoCAD2007\3DxAutoCAD2007.msi /passive /norestart'
? $cmd_sei
$codrec = shellcmd('"$cmd_sei"',0)
IF $codrec <> 0
? "Erreur n° " + $codrec
GOTO "finerreur"
ENDIF
ELSE
? "Installation pour une architecture 32bit"
$cmd_sei = 'msiexec /i components\3DxWare\3DxWare.msi /passive /norestart'
? $cmd_sei
$codrec = shellcmd('"$cmd_sei"',0)
IF $codrec <> 0
? "Erreur n° " + $codrec
GOTO "finerreur"
ENDIF
$cmd_sei = 'msiexec /i components\3DxAdobe3D\3DxAdobe3D.msi /passive /norestart'
? $cmd_sei
$codrec = shellcmd('"$cmd_sei"',0)
IF $codrec <> 0
? "Erreur n° " + $codrec
GOTO "finerreur"
ENDIF
$cmd_sei = 'msiexec /i components\3DxAutoCAD2007\3DxAutoCAD2007.msi /passive /norestart'
? $cmd_sei
$codrec = shellcmd('"$cmd_sei"',0)
IF $codrec <> 0
? "Erreur n° " + $codrec
GOTO "finerreur"
ENDIF
$cmd_sei = 'msiexec /i components\3DxAutoCAD2008\3DxAutoCAD2008.msi /passive /norestart'
? $cmd_sei
$codrec = shellcmd('"$cmd_sei"',0)
IF $codrec <> 0
? "Erreur n° " + $codrec
GOTO "finerreur"
ENDIF
$cmd_sei = 'msiexec /i components\3DxAutoCAD2009\3DxAutoCAD2009.msi /passive /norestart'
? $cmd_sei
$codrec = shellcmd('"$cmd_sei"',0)
IF $codrec <> 0
? "Erreur n° " + $codrec
GOTO "finerreur"
ENDIF
$cmd_sei = 'msiexec /i components\3DxInventor\3DxInventor.msi /passive /norestart'
? $cmd_sei
$codrec = shellcmd('"$cmd_sei"',0)
IF $codrec <> 0
? "Erreur n° " + $codrec
GOTO "finerreur"
ENDIF
$cmd_sei = 'msiexec /i components\3DxNX4\3DxNX4.msi /qn /passive /norestart'
? $cmd_sei
$codrec = shellcmd('"$cmd_sei"',0)
IF $codrec <> 0
? "Erreur n° " + $codrec
GOTO "finerreur"
ENDIF
$cmd_sei = 'msiexec /i components\3DxNX5\3DxNX5.msi /passive /norestart'
? $cmd_sei
$codrec = shellcmd('"$cmd_sei"',0)
IF $codrec <> 0
? "Erreur n° " + $codrec
GOTO "finerreur"
ENDIF
$cmd_sei = 'msiexec /i components\3DxNX6\3DxNX6.msi /passive /norestart'
? $cmd_sei
$codrec = shellcmd('"$cmd_sei"',0)
IF $codrec <> 0
? "Erreur n° " + $codrec
GOTO "finerreur"
ENDIF
$cmd_sei = 'msiexec /i components\3DxProENGINEER\3DxProENGINEER.msi /passive /norestart'
? $cmd_sei
$codrec = shellcmd('"$cmd_sei"',0)
IF $codrec <> 0
? "Erreur n° " + $codrec
GOTO "finerreur"
ENDIF
$cmd_sei = 'msiexec /i components\3DxProENGINEERWF4\3DxProENGINEERWF4.msi /passive /norestart'
? $cmd_sei
$codrec = shellcmd('"$cmd_sei"',0)
IF $codrec <> 0
? "Erreur n° " + $codrec
GOTO "finerreur"
ENDIF
$cmd_sei = 'msiexec /i components\3DxSolidEdge\3DxSolidEdge.msi /passive /norestart'
? $cmd_sei
$codrec = shellcmd('"$cmd_sei"',0)
IF $codrec <> 0
? "Erreur n° " + $codrec
GOTO "finerreur"
ENDIF
$cmd_sei = 'msiexec /i components\3DxSolidWorks\3DxSolidWorks.msi /passive /norestart'
? $cmd_sei
$codrec = shellcmd('"$cmd_sei"',0)
IF $codrec <> 0
? "Erreur n° " + $codrec
GOTO "finerreur"
ENDIF
ENDIF
cd @SCRIPTDIR\
;effacement d'un dossier
$dossierasupprimer = $dossierprov + '\3DxSoftware_v3-6-8'
del $dossierasupprimer + "\*.*" /c /f /s
rd $dossierasupprimer /s
IF NOT EXIST ($dossierasupprimer)
? "Le dossier : " + $dossierasupprimer + " a été supprimé"
ELSE
? "Le dossier : " + $dossierasupprimer + " n'a pas été supprimé complétement"
ENDIF
GOTO "fin"
;label de fin avec erreurs
:finerreur
? "fin du script d'installation : erreur"
;Ouverture du fichier log pour signaler la présence d'erreurs
IF RedirectOutput($DossierDeLog + "ERREUR_" + @SCRIPTNAME +".txt") = 0
?? "Ouverture de erreur_" + @SCRIPTNAME + " à " + @TIME
? "le script d'installation à rencontrer des erreurs : consulter le fichier log :"
? $DossierDeLog + @SCRIPTNAME +".txt"
ENDIF
sleep 5
;label de fin sans erreurs
:fin
? "fin du script d'installation"
;annule la redirection vers un fichier
RedirectOutput("")
|