I am trying to write a script that will read a line from one opened document (SetsNeeded) and look for it in another opened document (OrderSets). Then it looks up for the beginning of the record, selects and copies the entire record, then pastes to a newly created file. The code below works up to the matchBrace() and I cannot figure out why. Any thoughts?
- Code: Select all
var set = " ";
UltraEdit.newFile();
UltraEdit.clearClipboard();
WorkingFile = UltraEdit.activeDocument;
OrderSets = UltraEdit.document[0];
SetsNeeded = UltraEdit.document[1];
SetsNeeded.top();
OrderSets.top();
SetsNeeded.key("HOME");
SetsNeeded.startSelect();
SetsNeeded.key("END");
SetsNeeded.copy();
set = UltraEdit.clipboardContent;
OrderSets.findReplace.find(set);
OrderSets.findReplace.searchDown = false;
OrderSets.findReplace.find("[CChartDataRepository,BulkLoad");
OrderSets.key("HOME");
OrderSets.matchBrace();
OrderSets.copy();
WorkingFile.write(set+"\r\n");
WorkingFile.paste();
This would be a file of many order sets.
- Code: Select all
[CChartDataRepository,BulkLoad
(OrderSetName1)
]
[CChartDataRepository,BulkLoad
(OrderSetName2)
]
[CChartDataRepository,BulkLoad
(OrderSetName3)
]
[CChartDataRepository,BulkLoad
(OrderSetName4)
]
This is what I would be a list of sets I wanted to extract or copy out of the main file.
- Code: Select all
OrderSetName1
OrderSetName2

