by Mofi » Fri Jul 28, 2006 6:21 am
I have posted some macro solutions to run a macro on all open files. The first posted macro is the submacro named for example "CollectMods". You have to remove the commands Clipboard 9 and ClearClipboard from CollectMods macro and also cut the lines after EndLoop into the new macro. So the submacro CollectMods looks like this:
Bottom
IfColNum 1
Else
"
"
EndIf
Top
Loop
Find "//START-MOD:"
IfNotFound
ExitLoop
EndIf
EndSelect
Key HOME
StartSelect
Find Select "//END-MOD:"
Key HOME
Key DOWN ARROW
CopyAppend
EndSelect
EndLoop
The main macro runs on all open NAMED files and closes all these files without saving. So first make sure all files are saved and you don't have new files opened before running the macro. The macro also needs the property Continue if a Find with Replace not found checked.
InsertMode
ColumnModeOff
HexOff
Clipboard 9
ClearClipboard
Loop
IfNameIs ""
ExitLoop
EndIf
Top
Find "//START-MOD:"
IfFound
Clipboard 8
CopyFilePath
Top
"
File: "
Paste
"
"
SelectToTop
Clipboard 9
CopyAppend
EndSelect
PlayMacro 1 "CollectMods"
EndIf
CloseFile NoSave
EndLoop
NewFile
Paste
ClearClipboard
Clipboard 8
ClearClipboard
Clipboard 0
Top
Find "//START-MOD:"
IfNotFound
SelectAll
"No modified code block found in all open files !!!"
Else
Top
Key DEL
Key DEL
EndIf
Additionally you have to open all files which contain the string "//START-MOD:" and no other files before running the macro above. This can be easily done by searching in your directory structure for files *.* which contain the string with your file manager (Windows Explorer, Total Commander, ...), select the files found and drag & drop it to the UltraEdit window where no other file is open.
It's also possible to simply open all files including subdirectories with UltraEdit with the Quick Open command and run the macros on all opened files independent if it contains the string or not. This would be slower because more files must be searched for a modified block, but would work too because the main macro first searches for the string and runs the submacro only if the current file contains the string.
I have inserted the EndSelect at line 18 of the first macro because the Find above automatically creates a selection. Most of the time it is not needed but I have had some bad effects after a find with following cursor moves if the selection is not ended. So I do it now always for security.
Hope all this works, because I have not tested it.