42
42
!define IGOR9DEFPATH " $PROGRAMFILES64\WaveMetrics\Igor Pro 9 Folder"
43
43
!define IGOR10DEFPATH " $PROGRAMFILES64\WaveMetrics\Igor Pro 10 Folder"
44
44
45
+ # Temp file for command execution output for ExecDos::Exec
46
+ !define EXECDOSOUTPUT " ExecOutput.log"
47
+
45
48
# Unicode true
46
49
SetCompressor /SOLID lzma
47
50
!include " ${NSISREQUEST}"
@@ -128,11 +131,42 @@ Var NSD_IF_CB4
128
131
Quit
129
132
!macroend
130
133
131
- !macro FindProc result processName
132
- ExecCmd::exec " %SystemRoot%\System32\tasklist /NH /FI $\" IMAGENAME eq ${processName}$\" | %SystemRoot%\System32\find /I $\" ${processName}$\" "
133
- Pop $0 ; The handle for the process
134
- ExecCmd::wait $0
134
+ !macro FindProc result processName uid
135
+ ReadEnvStr $0 SYSTEMROOT
136
+ Push " ExecDos::End"
137
+ ; In contradiction to the docs the two empty strings at the end are mandatory. Otherwise the stack gets cleared.
138
+ ; The logfile name (third string) is put on the stack before the command output.
139
+ ; I could not get the plugin to generate any logfile output by itself.
140
+ ; Stack:
141
+ ; <command output>
142
+ ; ...
143
+ ; <logfile name>
144
+ ; <Marker> if pushed before
145
+ ; I found no way that allows piping to a second application
146
+ ExecDos::exec /NOUNLOAD /TOSTACK " $0\System32\tasklist.exe /NH /FI $\" IMAGENAME eq ${processName}$\" " " " " "
147
+ Pop $0
148
+ ${if} $0 <> 0
149
+ IfSilent +2
150
+ MessageBox MB_OK |MB_ICONEXCLAMATION " Can not get current task list through tasklist.exe."
151
+ Quit
152
+ ${EndIf}
153
+
154
+ ReadEnvStr $0 TEMP
155
+ FileOpen $4 " $0\${EXECDOSOUTPUT}" w
156
+ Loop_${uid} :
157
+ Pop $1
158
+ StrCmp $1 " ExecDos::End" LoopEnd_${uid}
159
+ FileWrite $4 $1
160
+ Goto Loop_${uid}
161
+ LoopEnd_${uid} :
162
+ FileClose $4
163
+
164
+ ReadEnvStr $0 SYSTEMROOT
165
+ ReadEnvStr $1 TEMP
166
+ ExecDos::exec /NOUNLOAD " $0\System32\find.exe /I $\" ${processName}$\" $1\${EXECDOSOUTPUT}" " " " "
167
+
135
168
Pop ${result} ; The exit code
169
+ Delete $1 \${EXECDOSOUTPUT}
136
170
!macroend
137
171
138
172
!macro CheckAllUninstalled
@@ -195,7 +229,7 @@ Var NSD_IF_CB4
195
229
!macro WaitForProc ProcName
196
230
!define WFPID ${__LINE__}
197
231
WFUWaitUninstA_${WFPID} :
198
- !insertmacro FindProc $processFound " ${ProcName}"
232
+ !insertmacro FindProc $processFound " ${ProcName}" ${__LINE__}
199
233
IntCmp $processFound ${FindProc_NOT_FOUND} WFUEndWaitUninstA_${WFPID}
200
234
Sleep 100
201
235
Goto WFUWaitUninstA_${WFPID}
@@ -219,15 +253,15 @@ WFUEndWaitUninstA_${WFPID}:
219
253
!macroend
220
254
221
255
!macro StopOnIgor32
222
- !insertmacro FindProc $processFound " Igor.exe"
256
+ !insertmacro FindProc $processFound " Igor.exe" ${__LINE__}
223
257
IntCmp $processFound ${FindProc_NOT_FOUND} +4
224
258
IfSilent +2
225
259
MessageBox MB_OK |MB_ICONEXCLAMATION " Igor Pro is running. Please close it first" /SD IDOK
226
260
Quit
227
261
!macroend
228
262
229
263
!macro StopOnIgor64
230
- !insertmacro FindProc $processFound " Igor64.exe"
264
+ !insertmacro FindProc $processFound " Igor64.exe" ${__LINE__}
231
265
IntCmp $processFound ${FindProc_NOT_FOUND} +4
232
266
IfSilent +2
233
267
MessageBox MB_OK |MB_ICONEXCLAMATION " Igor Pro (64-bit) is running. Please close it first" /SD IDOK
@@ -833,9 +867,9 @@ ReadLoop:
833
867
FileRead $FILEHANDLE $LINESTR
834
868
IfErrors +1 +2
835
869
Goto EndReadLoop
836
- ExecCmd ::exec " cmd.exe /Cdel $\" $LINESTR$\" "
870
+ ExecDos ::exec /NOUNLOAD " cmd.exe /Cdel $\" $LINESTR$\" " " " " "
837
871
Pop $0
838
- ExecCmd ::wait $0
872
+ ExecDos ::wait $0
839
873
Pop $0
840
874
Goto ReadLoop
841
875
EndReadLoop:
0 commit comments