Forum Discussion

DenisMedvedev's avatar
DenisMedvedev
Contributor
8 years ago
Solved

How to create your own plugin?

I have created ExcelOLEcode.js file for working with Excel, see below code:

function Create(fileName)
{
  oWorkBook = Sys.OleObject("Excel.Application").Workbooks.Add();
  oWorkBook.SaveAs(fileName);
  oWorkBook.Close();
  Sys.OleObject("Excel.Application").Quit();
}

function Open(fileName)
{
  oWorkBook = Sys.OleObject("Excel.Application").Workbooks.Open(fileName);
}

function Close()
{
  oWorkBook.Save();
  oWorkBook.Close();
  Sys.OleObject("Excel.Application").Quit();
}

function GetSheet()
{
  return Sheet;
}

function SetSheet(sheetName)
{
  Sheet = sheetName;
}

function CellRead(row, col)
{
  return oWorkBook.Sheets(Sheet).Cells(row, col).value;
}

function CellWrite(row, col, text)
{
  oWorkBook.Sheets(Sheet).Cells(row, col).value = text;
}

Also I have description file description.xml with bellow code:

<?xml version="1.0" encoding="UTF-8"?>
<ScriptExtensionGroup>
  <Category Name="Runtime Objects">
    <ScriptExtension Name="Excel OLE" Author="Denis Medvedev" Version="1.0" HomePage="https://ua.linkedin.com/in/medvedevdenis">
      <Script Name="ExcelOLEcode.js">
        <RuntimeObject Name="ExcelOLE">
          <Method Name="Open" Routine="Open">
            Opens an Excel file as OLE object
          </Method>
          <Method Name="Create" Routine="Create">
            Creates a new Excel file
          </Method>
          <Method Name="Close" Routine="Close">
            Closes an Excel file
          </Method>
          <Property Name="Cell" GetRoutine="CellRead" SetRoutine="CellWrite">Excel cell</Property>
          <Property Name="Sheet" GetRoutine="GetSheet" SetRoutine="SetSheet">Excel sheet</Property>
          <Description>Provides access to Excel files via OLE</Description>
        </RuntimeObject>
      </Script>
    </ScriptExtension>
  </Category>
</ScriptExtensionGroup>

 

I put them to ExcelExtension folder and created zip archive, after that renamed it to Excel.tcx

Then I installed new extension

 

Right now I expect my extension in “Script Extension” screen, but it is not added. 

 

The quiestion is: What I’m doing wrong?

 

P.S. I have installed https://support.smartbear.com/downloads/testcomplete/sdk/, but I’m not sure how to use it.  

  • Script extensions are a little finicky.  They want everything just so.

     

    Perhaps you've created a tcx file where everything is in a subdirectory (ExcelExtension)?  If so, then repackage so that the files are at the top level (no subdirectory).

     

1 Reply

  • Script extensions are a little finicky.  They want everything just so.

     

    Perhaps you've created a tcx file where everything is in a subdirectory (ExcelExtension)?  If so, then repackage so that the files are at the top level (no subdirectory).