1 | ; gv-qcg-submit.nsi
|
---|
2 | ;
|
---|
3 | ; Installer for submitting GaussView 09 examples through QCG-Icon application
|
---|
4 |
|
---|
5 |
|
---|
6 | ;----------------------
|
---|
7 |
|
---|
8 | ; The name of the installer
|
---|
9 | Name "GaussView QCG-Icon scripts"
|
---|
10 |
|
---|
11 | ; The installer file
|
---|
12 | OutFile "gv-qcg.exe"
|
---|
13 |
|
---|
14 | ; The default installation directory
|
---|
15 | InstallDir "$PROGRAMFILES\GVQcg"
|
---|
16 |
|
---|
17 | ; Request application privileges for Windows Vista
|
---|
18 | RequestExecutionLevel user
|
---|
19 |
|
---|
20 | ; Registry key to check for directory (so if you install again, it will
|
---|
21 | ; overwrite the old one automatically)
|
---|
22 | InstallDirRegKey HKLM "Software\GVQcg" "Install_Dir"
|
---|
23 |
|
---|
24 | !include nsis\advreplaceinfile.nsh
|
---|
25 | !include nsis\strrep.nsh
|
---|
26 |
|
---|
27 | ;----------------------
|
---|
28 |
|
---|
29 | Page components
|
---|
30 | Page directory
|
---|
31 | Page instfiles
|
---|
32 |
|
---|
33 | UninstPage uninstConfirm
|
---|
34 | UninstPage instfiles
|
---|
35 |
|
---|
36 | ;----------------------
|
---|
37 |
|
---|
38 |
|
---|
39 | Section "GQVcg submit script"
|
---|
40 |
|
---|
41 | SectionIn RO
|
---|
42 |
|
---|
43 | Var /GLOBAL QCG_ICON_PATH
|
---|
44 |
|
---|
45 | ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\qcg-icon" ""
|
---|
46 | IfErrors 0 +3
|
---|
47 | MessageBox MB_OK "QCG-Icon not installed"
|
---|
48 | Abort
|
---|
49 | StrCpy $1 $0
|
---|
50 | ${StrRep} $QCG_ICON_PATH $0 "\qcg-icon.exe" "\qcg-icon.exe"
|
---|
51 |
|
---|
52 | SetOutPath $INSTDIR
|
---|
53 |
|
---|
54 | File "awk.exe"
|
---|
55 | File "get_chk.awk"
|
---|
56 | File "remove_chk.awk"
|
---|
57 |
|
---|
58 | File "qcg-submit.bat"
|
---|
59 | Push "#QCG_ICON_PATH#" #text to be replaced
|
---|
60 | Push $QCG_ICON_PATH #replace with
|
---|
61 | Push all #start replacing after 3rd occurrence
|
---|
62 | Push all #replace next 4 occurrences
|
---|
63 | Push "qcg-submit.bat" #file to replace in
|
---|
64 | Call AdvReplaceInFile
|
---|
65 |
|
---|
66 | WriteRegStr HKLM "SOFTWARE\GVQcg" "Install_Dir" "$INSTDIR"
|
---|
67 |
|
---|
68 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\GVQcg" "DisplayName" "GaussView QCG-Icon scripts"
|
---|
69 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\GVQcg" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
---|
70 | WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\GVQcg" "NoModify" 1
|
---|
71 | WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\GVQcg" "NoRepair" 1
|
---|
72 | WriteUninstaller "uninstall.exe"
|
---|
73 |
|
---|
74 | SectionEnd
|
---|
75 |
|
---|
76 |
|
---|
77 | Section "Set GaussView default job setup"
|
---|
78 |
|
---|
79 | ClearErrors
|
---|
80 | ReadRegStr $0 HKCU "Software\Gaussian, Inc.\GaussView" "Last"
|
---|
81 | IfErrors 0 +3
|
---|
82 | MessageBox MB_OK "GaussView not installed"
|
---|
83 | Goto Finish
|
---|
84 | MessageBox MB_OK "Found GaussView $0 installed"
|
---|
85 | StrCpy $1 $0 1
|
---|
86 |
|
---|
87 | Check:
|
---|
88 | FindProcDLL::FindProc "gview.exe"
|
---|
89 | IntCmp $R0 1 0 notRunning
|
---|
90 | MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "GaussView is running. Please close it first" IDCANCEL Finish IDRETRY Check
|
---|
91 |
|
---|
92 | notRunning:
|
---|
93 | WriteRegDWORD HKCU "Software\Gaussian, Inc.\GaussView\$1\Job Preferences" "Gaussian Execution Mode" 2
|
---|
94 | IfErrors 0 +3
|
---|
95 | MessageBox MB_OK "GaussView $0 not supported"
|
---|
96 | Goto Finish
|
---|
97 | WriteRegStr HKCU "Software\Gaussian, Inc.\GaussView\$1\Job Preferences" "Gaussian Custom Command Line" '"$INSTDIR\qcg-submit.bat" @INFILE @OUTFILE'
|
---|
98 | MessageBox MB_OK "GaussView default job setup set"
|
---|
99 | Finish:
|
---|
100 |
|
---|
101 | SectionEnd
|
---|
102 |
|
---|
103 | ;----------------------
|
---|
104 |
|
---|
105 |
|
---|
106 | Section "Uninstall"
|
---|
107 |
|
---|
108 | DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\GVQcg"
|
---|
109 | DeleteRegKey HKLM "SOFTWARE\GVQcg"
|
---|
110 | Delete "$INSTDIR\awk.exe"
|
---|
111 | Delete "$INSTDIR\remove_chk.awk"
|
---|
112 | Delete "$INSTDIR\get_chk.awk"
|
---|
113 | Delete "$INSTDIR\qcg-submit.bat"
|
---|
114 | Delete "$INSTDIR\uninstall.exe"
|
---|
115 | RMDir "$INSTDIR"
|
---|
116 |
|
---|
117 | SectionEnd
|
---|