Version 6.6.7 - record macro - copy and paste?

knowlton
2014-07-21
2014-07-22
  • knowlton
    knowlton
    2014-07-21

    I am trying to record a macro that will convert this:

    public string Fax { get; set; }

    to this:

    Fax = contact.Fax;

    My steps are as follows:

    //begin cursor at beginning of the original string
    //start recording macro
    public string Fax { get; set; }

    //erase "public string"
    Fax { get; set; }

    //select the first word (which I perform by double-clicking on the word, since I won't know how long
    //the word is beforehand. I copy the selected word to the clipboard.
    Fax { get; set; }

    //Press the "right arrow key" to unselect the word. Cursor is now at the end of the word "Fax"
    //Then press SHIFT + "END" key to go to the end of the line, highlighting everything after the first
    //word. Press DELETE
    Fax

    //type "= contact." then PASTE the word from clipboard memory ( "Fax" ). Then type ";" at the end:
    Fax = contact.Fax;

    //move cursor down to the beginning of the NEXT line...
    //stop recording the macro

    //DONE!!

    The problem happens when I play the macro again. It pastes the word "Fax" each time!

    So instead of this:

    Fax = contact.Fax;
    Phone = contact.Phone;
    Email = contact.Email;

    I get this:

    Fax = contact.Fax;
    Phone = contact.Fax;
    Email = contact.Fax;

     
    • knowlton
      knowlton
      2014-07-21

      Sorry...please move this post to English language forum... under Macros

       
  • I think it would be easier if you used a regular expression instead.

    Open search and replace. Check "Regular expression".

    Replace:

    public string (.*?) \{ get; set; \}
    

    with:

    \1 = contact.\1;