Forum Discussion

saran's avatar
saran
New Contributor
6 years ago

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

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

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

    • saran's avatar
      saran
      New Contributor

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

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        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.