cancel
Showing results for 
Search instead for 
Did you mean: 

Copy and paste specific text from notepad

Highlighted
New Contributor

Copy and paste specific text from notepad

Hi,

 

I have a requirement where I need to copy a specific set of lines from a notepad and copy and paste it to another new notepad. I'm able to identify based on the line numbers but that is not sufficient. I need to use this on regular expressions but i'm unable to do it. Could anyone please help me to do it in C#?

3 REPLIES 3
Highlighted
Community Hero

Re: Copy and paste specific text from notepad

Just curious - are you actually testing Notepad?  What does your app do that you have this requirement to test?

Highlighted
New Contributor

Re: Copy and paste specific text from notepad

Yes, I am using Notepad but not testing it. My test environment requires that. 

Highlighted
Community Hero

Re: Copy and paste specific text from notepad

I guess the question is why is Notepad necessary?

Generally speaking, the NotePad main edit window has a property available in TestComplete.  You can obtain that value, parse througn it using aqString or other similar methods to find what you're looking for, grab that text, and then set the property in another Notepad to contain that value.

But as @Marsha_R, using Notepad only makes sense if your application under test requires it.  Is the file you're opening in Notepad containing data that is used in the test?  If so, you don't really need to open the notepad window at all... you can use aqFile.OpenTextFile method to open the text file and operate directly against it's contents without having to involve the notepad application at all.

so... if you can tell us a bit more (perhaps with samples of the notepad files you're wanting to manipulate) of what you are hoping to achieve, we can give better help for you.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
New Here?
Join us and watch the welcome video:
Top Kudoed Authors