To clarify, I have 1 file open only, searching for certain text, copying to the clipboard, searching in a directory of files that are not open for certain text and the text in the clipboard, want to open that file, find some different text, copy that to the clipboard, close that file, go back to the originally open file, find some text, take the current clipboard text (from the now closed file), and insert it into the appropriate place in the open file.
Ok. While testing this I've come across a little problem. Sometimes, the text the macro is looking for is in the currently open file so I edited the macro to this but there must be something I'm overlooking. The macro is stopping if it doesn't find the text in the current open file when it should be continue to the FindInFiles portion of the macro.
Ok. Now I'm at the point of losing my mind.
I've decided to do 2 separate macros since I can't seem to make the above one work correctly in all instances.
One macro will check for text within the
open file (and "seems" to be working in my test file):
InsertMode
ColumnModeOff
HexOff
UnixReOff
Find "xref callout="task"
Find "wpid="
StartSelect
Find RegExp ""*""
Copy
EndSelect
ToggleBookmark
Find RegExp "wpno=^c"
IfFound
Find RegExp "<title>*</title>"
StartSelect
Copy
EndSelect
PreviousBookmark
Find RegExp "xref callout="task *""
"xref callout=""
Paste
Find Up "</title>"
Key DEL
Find Up "<title>"
Key DEL
ToggleBookmark
EndIf
the next macro will check for text in all files in the
directory:
InsertMode
ColumnModeOff
HexOff
UnixReOff
Find "xref callout="task"
Find "wpid="
StartSelect
Find RegExp ""*""
Copy
EndSelect
FindInFiles PreserveCase Recursive Log "C:\XML\Maintenance Manuals\Files\" "*.xml" "wpno=^c"
Loop
Find RegExp Up "%Search complete, found *^p"
IfFound
Delete
ExitLoop
Else
NextWindow
EndIf
EndLoop
Top
Find "----------------------------------------^p"
Replace All ""
Find RegExp "%Find *^p"
Replace All ""
Find RegExp "%Found *^p"
Replace All ""
Find RegExp "/[0-9]+:*$"
Replace All ""
SortAsc IgnoreCase RemoveDup 1 -1 0 0 0 0 0 0
Top
Loop
IfEof
ExitLoop
EndIf
StartSelect
Key END
Open "^s"
NextWindow
Delete
EndSelect
Key DEL
EndLoop
CloseFile NoSave
NextWindow
Find RegExp "wpno=^c"
Find RegExp "<title>*</title>"
StartSelect
Copy
EndSelect
PreviousWindow
Find RegExp Up "xref callout="task *""
"xref callout=""
Paste
"""
Find Up "</title>"
Key DEL
Find Up "<title>"
Key DEL
The problem is it also checks the
open file as well. What can I add to the macro to make it exclude the currently open file from the FindInFiles find?
Please help if anyone can. I'm on a deadline and this is making me crazy.