Код:
Var ac15
Var ac16
Var ac17
Var vart0
Var vart1
Var vart2
Var vart3
Var vart4
Var vart5
Var vart6
Var vart8
Var vart9
Var xtet
Var xtet2
!define Name "Addons for AutoCAD - ADD_ACAD2"
Name "Addons for AutoCAD - ADD_ACAD2"
;The file to write
OutFile "${Name}.exe"
Caption "${Name}"
InstallDir "$PROGRAMFILES\ADD_ACAD2"
!include "MUI.nsh"
!include "LogicLib.nsh"
!define MUI_LICENSEPAGE
!define MUI_COMPONENTSPAGE
!define MUI_COMPONENTSPAGE_SMALLDESC
!define MUI_DIRECTORYPAGE
!define MUI_ABORTWARNING
;--------------------------------
;Pages
!insertmacro MUI_PAGE_LICENSE "License.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "Russian"
!ifdef uglyinstaller
BGGradient 000000 308030 FFFFFF
InstallColors FF8080 000000
InstProgressFlags smooth colored
!else
WindowIcon off
!endif
ShowInstDetails show
AutoCloseWindow false
;icon WinAmp.ico
SetDateSave off
Function .onInit
StrCpy $0 "0"
loop:
EnumRegKey $1 HKLM "Software\Autodesk\AutoCAD\R15.0" $0
StrCmp $1 "" done
StrCmp $0 1 x1
StrCmp $0 2 x2
StrCpy $R0 $1
goto next
x1:
StrCpy $R1 $1
goto next
x2:
StrCpy $R2 $1
next:
IntOp $0 $0 + 1
goto loop
done:
StrCpy $0 "0"
loop2:
EnumRegKey $1 HKLM "Software\Autodesk\AutoCAD\R16.0" $0
StrCmp $1 "" done2
StrCmp $0 1 x4
StrCmp $0 2 x5
StrCpy $R3 $1
goto next2
x4:
StrCpy $R4 $1
goto next2
x5:
StrCpy $R5 $1
next2:
IntOp $0 $0 + 1
goto loop2
done2:
StrCpy $0 "0"
loop3:
EnumRegKey $1 HKLM "Software\Autodesk\AutoCAD\R16.1" $0
StrCmp $1 "" done3
StrCmp $0 1 x7
StrCpy $R6 $1
goto next3
x7:
StrCpy $R7 $1
next3:
IntOp $0 $0 + 1
goto loop3
done3:
StrCpy $0 "0"
loop4:
EnumRegKey $1 HKLM "Software\Autodesk\AutoCAD\R16.2" $0
StrCmp $1 "" done4
StrCmp $0 1 x9
StrCpy $R8 $1
goto next4
x9:
StrCpy $R9 $1
next4:
IntOp $0 $0 + 1
goto loop4
done4:
ReadRegStr $0 HKLM "Software\Autodesk\AutoCAD\R15.0\$R0" "ProductName"
StrCmp $0 "" +3 0
ReadRegStr $1 HKLM "Software\Autodesk\AutoCAD\R15.0\$R0" "Language"
StrCpy $vart0 "$0 ($1)"
ReadRegStr $0 HKLM "Software\Autodesk\AutoCAD\R15.0\$R1" "ProductName"
StrCmp $0 "" +3 0
ReadRegStr $1 HKLM "Software\Autodesk\AutoCAD\R15.0\$R1" "Language"
StrCpy $vart1 "$0 ($1)"
ReadRegStr $0 HKLM "Software\Autodesk\AutoCAD\R16.0\$R3" "ProductName"
StrCmp $0 "" +3 0
ReadRegStr $1 HKLM "Software\Autodesk\AutoCAD\R16.0\$R3" "Language"
StrCpy $vart3 "$0 ($1)"
ReadRegStr $0 HKLM "Software\Autodesk\AutoCAD\R16.0\$R4" "ProductName"
StrCmp $0 "" +3 0
ReadRegStr $1 HKLM "Software\Autodesk\AutoCAD\R16.0\$R4" "Language"
StrCpy $vart4 "$0 ($1)"
ReadRegStr $0 HKLM "Software\Autodesk\AutoCAD\R16.1\$R6" "ProductName"
StrCmp $0 "" +3 0
ReadRegStr $1 HKLM "Software\Autodesk\AutoCAD\R16.1\$R6" "Language"
StrCpy $vart6 "$0 ($1)"
ReadRegStr $0 HKLM "Software\Autodesk\AutoCAD\R16.2\$R8" "ProductName"
StrCmp $0 "" +3 0
ReadRegStr $1 HKLM "Software\Autodesk\AutoCAD\R16.2\$R8" "Language"
StrCpy $vart8 "$0 ($1)"
FunctionEnd
Section "ADD ACAD 2 (база)" 1
SectionIn 1 2 RO
SetOutPath $INSTDIR
file /x *.mn* ".\ADD_ACAD2\*"
SectionEnd
Section "$vart0"
StrCmp $vart0 "" +14 0
StrCpy $ac15 "yes"
ReadRegStr $xtet HKCU "Software\Autodesk\AutoCAD\R15.0\$R0\Profiles" ""
ReadRegStr $R2 HKCU "Software\Autodesk\AutoCAD\R15.0\$R0\Profiles\$xtet\General" "ACAD"
StrCpy $R2 "$R2$INSTDIR;"
WriteRegStr HKCU "Software\Autodesk\AutoCAD\R15.0\$R0\Profiles\$xtet\General" "ACAD" "$R2"
StrCpy $R1 0
${Do}
IntOp $R1 $R1 + 1
ReadRegStr $xtet2 HKCU "Software\Autodesk\AutoCAD\R15.0\$R0\Profiles\$xtet\Menus" "Group$R1"
StrCmp $xtet2 "" 0 +3
WriteRegStr HKCU "Software\Autodesk\AutoCAD\R15.0\$R0\Profiles\$xtet\Menus" "Group$R1" "ADD_ACAD2 $INSTDIR\ADD_ACAD2"
${ExitDo}
${Loop}
SectionEnd
Section "$vart1"
StrCmp $vart1 "" +14 0
StrCpy $ac15 "yes"
ReadRegStr $xtet HKCU "Software\Autodesk\AutoCAD\R15.0\$R1\Profiles" ""
ReadRegStr $R2 HKCU "Software\Autodesk\AutoCAD\R15.0\$R1\Profiles\$xtet\General" "ACAD"
StrCpy $R2 "$R2$INSTDIR;"
WriteRegStr HKCU "Software\Autodesk\AutoCAD\R15.0\$R1\Profiles\$xtet\General" "ACAD" "$R2"
StrCpy $R1 0
${Do}
IntOp $R1 $R1 + 1
ReadRegStr $xtet2 HKCU "Software\Autodesk\AutoCAD\R15.0\$R1\Profiles\$xtet\Menus" "Group$R1"
StrCmp $xtet2 "" 0 +3
WriteRegStr HKCU "Software\Autodesk\AutoCAD\R15.0\$R1\Profiles\$xtet\Menus" "Group$R1" "ADD_ACAD2 $INSTDIR\ADD_ACAD2"
${ExitDo}
${Loop}
SectionEnd
Section "$vart3"
StrCmp $vart3 "" +14 0
StrCpy $ac16 "yes"
ReadRegStr $xtet HKCU "Software\Autodesk\AutoCAD\R16.0\$R3\Profiles" ""
ReadRegStr $R2 HKCU "Software\Autodesk\AutoCAD\R16.0\$R3\Profiles\$xtet\General" "ACAD"
StrCpy $R2 "$R2$INSTDIR;"
WriteRegStr HKCU "Software\Autodesk\AutoCAD\R16.0\$R5\Profiles\$xtet\General" "ACAD" "$R2"
StrCpy $R1 0
${Do}
IntOp $R1 $R1 + 1
ReadRegStr $xtet2 HKCU "Software\Autodesk\AutoCAD\R16.0\$R3\Profiles\$xtet\Menus" "Group$R1"
StrCmp $xtet2 "" 0 +3
WriteRegStr HKCU "Software\Autodesk\AutoCAD\R16.0\$R3\Profiles\$xtet\Menus" "Group$R1" "ADD_ACAD2 $INSTDIR\ADD_ACAD2_4"
${ExitDo}
${Loop}
SectionEnd
Section "$vart4"
StrCmp $vart4 "" +14 0
StrCpy $ac16 "yes"
ReadRegStr $xtet HKCU "Software\Autodesk\AutoCAD\R16.0\$R4\Profiles" ""
ReadRegStr $R2 HKCU "Software\Autodesk\AutoCAD\R16.0\$R4\Profiles\$xtet\General" "ACAD"
StrCpy $R2 "$R2$INSTDIR;"
WriteRegStr HKCU "Software\Autodesk\AutoCAD\R16.0\$R4\Profiles\$xtet\General" "ACAD" "$R2"
StrCpy $R1 0
${Do}
IntOp $R1 $R1 + 1
ReadRegStr $xtet2 HKCU "Software\Autodesk\AutoCAD\R16.0\$R4\Profiles\$xtet\Menus" "Group$R1"
StrCmp $xtet2 "" 0 +3
WriteRegStr HKCU "Software\Autodesk\AutoCAD\R16.0\$R4\Profiles\$xtet\Menus" "Group$R1" "ADD_ACAD2 $INSTDIR\ADD_ACAD2_4"
${ExitDo}
${Loop}
SectionEnd
Section "$vart6"
StrCmp $vart6 "" +14 0
StrCpy $ac16 "yes"
ReadRegStr $xtet HKCU "Software\Autodesk\AutoCAD\R16.1\$R6\Profiles" ""
ReadRegStr $R2 HKCU "Software\Autodesk\AutoCAD\R16.1\$R6\Profiles\$xtet\General" "ACAD"
StrCpy $R2 "$R2$INSTDIR;"
WriteRegStr HKCU "Software\Autodesk\AutoCAD\R16.1\$R6\Profiles\$xtet\General" "ACAD" "$R2"
StrCpy $R1 0
${Do}
IntOp $R1 $R1 + 1
ReadRegStr $xtet2 HKCU "Software\Autodesk\AutoCAD\R16.1\$R6\Profiles\$xtet\Menus" "Group$R1"
StrCmp $xtet2 "" 0 +3
WriteRegStr HKCU "Software\Autodesk\AutoCAD\R16.1\$R6\Profiles\$xtet\Menus" "Group$R1" "ADD_ACAD2 $INSTDIR\ADD_ACAD2_4"
${ExitDo}
${Loop}
SectionEnd
Section "$vart8"
StrCmp $vart8 "" +7 0
StrCpy $ac17 "yes"
ReadRegStr $xtet HKCU "Software\Autodesk\AutoCAD\R16.2\$R8\Profiles" ""
ReadRegStr $R2 HKCU "Software\Autodesk\AutoCAD\R16.2\$R8\Profiles\$xtet\General" "ACAD"
StrCpy $R2 "$R2$INSTDIR;"
WriteRegStr HKCU "Software\Autodesk\AutoCAD\R16.2\$R8\Profiles\$xtet\General" "ACAD" "$R2"
StrCpy $R1 0
SectionEnd
Section -post
StrCmp $ac15 "yes" 0 +3
delete "$INSTDIR\ADD_ACAD2.mn*"
file ".\ADD_ACAD2\ADD_ACAD2.mn*"
StrCmp $ac16 "yes" 0 +3
delete "$INSTDIR\ADD_ACAD2_4.mn*"
file ".\ADD_ACAD2\ADD_ACAD2_4.mn*"
StrCmp $ac17 "yes" 0 +4
delete "$INSTDIR\ADD_ACAD2_4.cui"
file ".\ADD_ACAD2\ADD_ACAD2_4.mn*"
Exec 'AutoIt3_K.exe AutoCAD2006.au3'
SectionEnd