![]() Second replace with word x,second replace with word yĪ modified macro would be required to handle such lists correct. Would result in a wrong result because after processing the first line the second line of the list would have been changed also to Second search for word x,second replace with word y Please note: If one of the search strings is contained also in any other search or replace string below in the list, the macro as is would produce a wrong result. The macro property Continue if search string not found must be checked for this macro. After every replace all the current line is deleted resulting in setting the cursor to start of the next line where the loop continues.Īfter the loop finished the line with the marker character » is deleted, user clipboard 9 is cleared and Windows clipboard is selected again. If a replace string is selected, the macro replaces case sensitive now all occurrences of the search string in clipboard 9 by the currently selected replace string. If nothing is selected, the macro runs the search with an empty replace string to delete all found strings. Next it sets the cursor right the comma character and selects everything to end of the current line. If this is not the case, a regular expression search is used marked from current cursor position (= start of current line) to next comma all characters and copy them to user clipboard 9. In a loop with an indefinite number of runs first a check is made if the current line starts with the marker character » which results in exiting the loop. No search string should start with that character or the macro would stop before the complete list of search/replace strings was processed. Then it inserts a line with marker character » which just marks where the list ends and where the content of file starts. The macro as is copies first the entire list of search and replace strings into the other file at top of it. Commas in the replace string are no problem. ![]() Commas in search strings are not allowed and will result in a wrong selection of the search string. The macro searches case sensitive for the search strings in the list and replaces all occurrences of the searched string by the replace string. In this case the searched string is just deleted. It is possible that no replace string exists right the comma. The search strings must be separated from the replace strings with a comma. The CSV file with the search and replace strings must have the focus when you execute the macro. You must have 2 files open when you run this macro, the file to be modified and the CSV file with the search and replace strings. Okay, the macro below was quickly written and is also very simple. ![]() Know now that I'm open to pretty much anything, what method do you suggest to meet the requirements I mention in the first paragraph in this reply? I briefly looked at the 3 posts you provided links for. To be honest I was hoping you'd reply with a reference to some feature built into UE/Studio that lets the user reference a source file (some kind of delimited txt based file) that contains a list of words to find and what to replace them with kind of like adding custom dictionary files. It doesn t matter if it's a tab delimited file or a CSV file or something else because I can export the list from Excel to a delimited txt file very easily each time I need to provide an update to the list of find & replace words. I'm open to any methods on doing this with the preference that it be something that add to the list or taking away from the list is as easy as adding and deleteing a line of text and that the items can be kept in a single file. Also important is to know if only a single replace or a replace all should be executed on the source file and also if the search strings are case sensitive or not.Ĭurrently the list of Find & Replace values are in an Excel spreadsheet. Possible would be also a tab character, a comma, a semicolon, a paragraph sign or something similar. The separator character should be a character which surely does never exist in any search and replace string. So the list file is a CSV file without specials like double quoted or multi-line fields. If you post how the list file looks, it can write in a few minutes the macro. I found this topics by searching with the advanced forum search in the Macro forum only for find replace loop copy. Iterate thru a list of files, each with its own find/replace criteria Replace text in file A with info from file B ![]() ![]() I have several macros written for such q task. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |