Forum Discussion

Vec84's avatar
Vec84
Contributor
8 years ago

Word compare issue

I have recently installed the word compare extension on TC11 and i copied the example function from the website and input my paths so i could compare two of my letters. I've played about a lot with this however cannot seem to get it to work at all. I've changed locations of the document, tried different syntax however nothing works. 

 

Could anyone point me in the right direction as to what i'm doing wrong.

 

//function from website

function Main ()
{
  WordDocs.Compare("Y:\Compare\GGE002-1.docx", "Y:\Compare\GGE002-2.docx",2);
}

 

  • Yup... that's fairly simple to solve.

    You're using the JScript/JavaScript function format.  In that format, when doing file paths, the backslash character (\) in a string is used for other functionality.  In order for it to resolve as an actual backslash, you need to double it up.  Change your code to the following:

    function Main ()
    {
      WordDocs.Compare("Y:\\Compare\\GGE002-1.docx", "Y:\\Compare\\GGE002-2.docx",2);
    }
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Yup... that's fairly simple to solve.

    You're using the JScript/JavaScript function format.  In that format, when doing file paths, the backslash character (\) in a string is used for other functionality.  In order for it to resolve as an actual backslash, you need to double it up.  Change your code to the following:

    function Main ()
    {
      WordDocs.Compare("Y:\\Compare\\GGE002-1.docx", "Y:\\Compare\\GGE002-2.docx",2);
    }
    • Vec84's avatar
      Vec84
      Contributor

      How silly of me  :smileyembarrassed:

       

      Thanks again for your support and quick response.

       

      Off topic but could you suggest any training to help with scripting in Testcomplete - preferably video content ?

    • Vec84's avatar
      Vec84
      Contributor

      Hello again,

       

      Do you have any idea what is causing this, it now runs with the double backslash however i get a runtime error now