No problem to do this with a macro.
First the macro checks if the last line of the file ends with line ending (cursor is at column 1) and if not it inserts a line ending at bottom of the file.
Back at top of the file and after trimming all trailing spaces it deletes every line starting with #EXT.
Depending on your version of UltraEdit which you have not posted this Find and Replace All could leave lines starting with #EXT. If this happens with your version of UE, the first Find+Replace All must be enclosed in a loop which is exited if nothing was replaced anymore. Next time please post also your version of UE so we are able to write the solution which surely works for you.
The cursor is still a top of the file. The macro switches now to column mode and inserts a space at start of every line. The cursor position has still not changed and so the macro can run the insert number command to insert the line numbers with leading zeros. The number of necessary leading zeros (0, 1, 2, 3, ...) is automatically determined by UltraEdit.
Back in normal text mode the cursor is moved to bottom of the file and deletes there the line number with the space from the last line.
After moving the cursor again to top of the file a regular expression finds the last backslash before the file name and replaces it in all lines with !!! for the next replace.
The final UltraEdit syntax regular expression find and replace all reformats the lines by tagging the line number and the space at start of every line with ^([0-9]+ ^), the file path without the last backslash with %^(*^) and the file name after !!! with ^(*^) and using these 3 selections in the replace string again where needed.
The macro property Continue if a Find with Replace not found or Continue if search string not found must be checked for this macro.
Find MatchCase RegExp "%#EXT*^p"
Replace All ""
ColumnInsert " "
ColumnInsertNum 1 1 LeadingZero
Find RegExp "\^([~\^p]+^)$"
Replace All "!!!^1"
Find RegExp "%^([0-9]+ ^)^(*^)!!!^(*^)$"
Replace All "Copy "S:^2\^3" "S:\TempCopy\^1^3""
Best regards from Austria