ContributionsMost RecentMost LikesSolutionsRe: Search and Replace to include multiple lines (using DelphiScript) Thanks, Joseph. Works fine now. Re: Search and Replace to include multiple lines (using DelphiScript) Thanks for looking into this. I have tried creating a ".run" file myself and this works as well. However, the problem happens when I use the ".run" file which is generated by one of products. Please find the ".run" file attached. Re: Search and Replace to include multiple lines (using DelphiScript) Ok, I created a dummy text file for testing and it works fine. However, the file that I am working with is ".run" so this might be the difference. Tried all the three encodings but didn't work with any of them. I am using TestComplete version 10.60 - this shouldn't make a difference? Re: Search and Replace to include multiple lines (using DelphiScript) Tried with #13#10 but this didn't work either. This is the full procedure: procedure FindAndReplaceInFile(srcFile); var runlogRegEx, resFileMod, resFileText; begin //Create regular expression runlogRegEx := HISUtils.RegExpr; //Set regular expression pattern runlogRegEx.Expression := 'string1'+#13#10+'string2'; //Read from file resFileText := aqFile.ReadWholeTextFile(srcFile, aqFile.ctANSI); //Replace the matching text resFileMod := runlogRegEx.Replace(resFileText, 'string3'); //Write back to file aqFile.WriteToTextFile(srcFile, resFileMod, aqFile.ctANSI, true); end; Search and Replace to include multiple lines (using DelphiScript) I have these two lines in a text file: string1 string2 I want to find these two lines and replace with a single line: string3 The scripts that I have is as follows: //Create a regular expression regEx := HISUtils.RegExp; //Set regular expression pattern regEx.Expression := 'string1(\r\n)string2'; //Read from file fileText := aqFile.ReadWholeTextFile(srcFile, aqFile.ctANSI); //Perform replace operation fileMod := regEx.Replace(fileText, 'string3'); //Write back to file aqFile.WriteToTextFile(srcFile, fileMod, aqFile.ctANSI, true); Search and replace does not happen with the above codes. If the string that I want to replace is within a single line, it all works fine but does not work when it involves multiple lines. The issue is definitely to do with multiple lines of text but I am not sure how can I detect this? Any help would be much appreciated. SolvedReading batch file ERRORLEVEL into TestComplete We are using TestComplete to run a batch file and would like to do different actions depending on the outcome of the script in the batch file. I can get %ERRORLEVEL% from the batch file (0, 1, 2, etc.) but how can I read in this into TestComplete? Ideally, I would prefer to do something like this: If %ERRORLEVEL% = 0 Do Condition A Else If %ERRORLEVEL% = 1 Do Condition B Re: Checking if an item is not available from TreeView Text file option is probably the best option for me. I think wItems method should work too but I find this being less suitable for our treeview which has many levels of children. Thanks to everyone for helping me out. Really appreciate all your help. Re: Checking if an item is not available from TreeView Probably I should have mentioned that 'Exists' is not available as one of the property/method for TreeView control. Re: Close DotNetBar TabStrip/TabItem Yes, I thought about the offset method as the "X" would be always at the top right corner. That is probably the best option for now as I couldn't find any "Close", "Exit" or "Quit" method for the tabstrip object. Close DotNetBar TabStrip/TabItem I'm testing on DevComponents.DotNetBar.TabStrip (Product Version 7.4.0.4). Moving between tabs is fine but I can't close the tab - the 'X' at the far right of the TabStrip (which does the close) is not recognised by TestComplete Object Spy. Only the tabs are child items of TabStrip - tabs are DotNetBar.TabItem. I could use Click method with co-ordinates but this is not very reliable. Is there another way to do this? Solved