|
|
#1 |
|
Junior Member
Join Date: Sep 2005
Location: Daytona Beach, FL
Posts: 7
|
FindNext Does Not Work - Why?
Hello,
The "findNext" function does not seem to work. It's as if every time it gets executed the Uninstaller just stops executing. Below is the code: FindFirst $0 $1 $INSTDIR\server\webapps\*.xml FindContextsLoop: StrCmp $1 "" FindContextsLoopDone ${UnStrRep} $R0 "$1" ".xml" "" MessageBox MB_OK "About to Delete Virtual Directory: $R0" !insertmacro DELETE_VIRTUAL_DIRECTORY $R0 MessageBox MB_OK "Just deleted Virtual Directory: $R0" MessageBox MB_OK "Dollar Zero = $0" MessageBox MB_OK "Dollar One = $1" FindNext $0 $1 IfErrors 0 FindContextsLoop FindContextsLoopDone: FindClose $0 Please help me. Thanks! |
|
|
|
|
|
#2 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,337
|
You must clear the error flag before you use the instruction you wish to test for using IfErrors. The error flag might be set by anything executed before FindNext. You'll therefore test everything above it, not only FindNext itself.
code: NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Sep 2005
Location: Daytona Beach, FL
Posts: 7
|
Still Not Working
I tried the above in inside my UnInstaller code. Adding the "ClearErrors" instruction before executing "FindNext" still did not cause the program to work. When the UnIninstaller tries to execute "FindNext" it simply stops executing.
Below is the code: StrCpy $0 "" StrCpy $1 "" StrCpy $R0 "" FindFirst $0 $1 $INSTDIR\server\webapps\*.xml FindContextsLoop: StrCmp $1 "" FindContextsLoopDone ${UnStrRep} $R0 "$1" ".xml" "" MessageBox MB_OK "About to Delete Virtual Directory: $R0" !insertmacro DELETE_VIRTUAL_DIRECTORY $R0 MessageBox MB_OK "Just deleted Virtual Directory: $R0" MessageBox MB_OK "Dollar Zero = $0" MessageBox MB_OK "Dollar One = $1" ClearErrors MessageBox MB_OK "Just completed ClearErrors instruction." MessageBox MB_OK "About to execute FindNext instruction." FindNext $0 $1 MessageBox MB_OK "Just completed FindNext instruction." IfErrors 0 FindContextsLoop FindContextsLoopDone: FindClose $0 Please help me. Thanks. |
|
|
|
|
|
#4 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,337
|
What exactly do you mean by "stops executing"? Does no message box show up after "About to execute FindNext instruction"? What does happen, if it doesn't show?
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#5 |
|
Major Dude
Join Date: Jul 2004
Posts: 665
|
Maybe some problem with handle, try to comment out:
code: |
|
|
|
|
|
#6 |
|
Junior Member
Join Date: Sep 2005
Location: Daytona Beach, FL
Posts: 7
|
>What exactly do you mean by "stops executing"? Does no >message box show up after "About to execute FindNext >instruction"? What does happen, if it doesn't show?
That's exactly what I mean. The next message box that should appear is the one stating "Just completed FindNext instruction." Then, the UnInstaller simply stops executing. Any answers why? |
|
|
|
|
|
#7 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,337
|
I believe Instructor is right. DELETE_VIRTUAL_DIRECTORY must have changed $0 and/or $1.
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#8 |
|
Junior Member
Join Date: Sep 2005
Location: Daytona Beach, FL
Posts: 7
|
Hi. I fixed the problem by not using $0 and $1. Instead I used global variables I defined myself.
Below is the code that works: StrCpy $R0 "" var /GLOBAL FileHandle var /GLOBAL FileName StrCpy $FileHandle "" StrCpy $FileName "" FindFirst $FileHandle $FileName $INSTDIR\server\webapps\*.xml FindContextsLoop: StrCmp $FileName "" FindContextsLoopDone ${UnStrRep} $R0 "$FileName" ".xml" "" MessageBox MB_OK "About to Delete Virtual Directory: $R0" !insertmacro DELETE_VIRTUAL_DIRECTORY $R0 MessageBox MB_OK "Just deleted Virtual Directory: $R0" MessageBox MB_OK "FileHandle = $FileHandle" MessageBox MB_OK "FileName = $FileName" ClearErrors MessageBox MB_OK "Just completed ClearErrors instruction." MessageBox MB_OK "About to execute FindNext instruction." FindNext $FileHandle $FileName MessageBox MB_OK "Just completed FindNext instruction." IfErrors 0 FindContextsLoop FindContextsLoopDone: FindClose $FileHandle Thanks for your help. |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|