Skip to content
Sahi Pro Flowcharts is retired. These pages document the last release (v12) and are no longer updated. Go to the current documentation.Flowcharts is retired. Current docs
Get Free Trial
Sahi Pro Flowcharts is retired. These pages document the last release (v12) and are no longer updated. Go to the current documentation.

Windows APIs

Windows automation is supported since Sahi Pro Desktop Engine

Modes Windows

Select the specified sheet in Excel

Parameters

NameTypeDescription
$elementstringExcel Sheet.
Raw script
_selectWindow("Book1 - Excel");
_setSelectedExcelTab("Sheet2"); // selects "Sheet2" tab in Book1 - Excel.

Sahi Pro Classic API _setSelectedExcelTab

Modes Windows

Value entered into the specified cell of the currently selected sheet Supports only cells within MS Excel framework

Parameters

NameTypeDescription
$elementWindows elementcell whose value is to be set
$valuestringValue to be set
Raw script
_setCell("A22","test");

Sahi Pro Classic API _setCell

Modes Windows

Value appended to the specific cell of the currently selected sheet Supports only cells within MS Excel framework

Parameters

NameTypeDescription
$elementWindows elementcell element in which the text is to be typed
$valuestringValue to be set
Raw script
_typeCell("A22","test");

Sahi Pro Classic API _typeCell

Modes Windows

Simulates a drag action

Parameters

NameTypeDescription
$dragElementWindows elementelement to be dragged
Raw script
// Drag the item
_drag(_image("item.jpg"));

Sahi Pro Classic API _drag

Modes Windows

Simulates a drag and drop action

Parameters

NameTypeDescription
$dropElementWindowselement where the dragged element will be dropped
Raw script
// Drop it at images folder
_drop(_listItem("images"));

Sahi Pro Classic API _drop

Modes Windows

Launches application with NX extension DLL for the specified architecture of a control in a window.

Parameters

NameTypeDescription
$exeArgsstringpath of the application including command line arguments.
$archintegerarchitecture of the executable program. Can be either 32 or 64.
Raw script
_attachExe("app.exe",32);
_attachExe("app.exe -someOption=1",32);

Sahi Pro Classic API _attachExe

Modes Windows

Attaches the NX extension DLL for the specified coordinates and architecture of a control in a window.

Parameters

NameTypeDescription
$xintegerx-coordinate of the control
$yintegery-coordinate of the control
$archintegerarchitecture of the executable program. Can be either 32 or 64
Raw script
_selectWindow("Application window name");
$pos = _position(_pane("Custom1"));
_attach($pos[0],$pos[1],32);

Sahi Pro Classic API _attach

Modes Windows

Starts capturing native text API calls for the specified coordinates of a control in a window.

Parameters

NameTypeDescription
$xintegerx-coordinate of the control
$yintegery-coordinate of the control
Raw script
_attachExe("app.exe",32);
_selectWindow("windowName");
$pos = _position(_pane("Custom1"));
_capture($pos[0],$pos[1]);
_wait(2000); // specify wait for the NX extension to capture adequate UI render calls
_stopCapture();

Sahi Pro Classic API _capture

Modes Windows

Starts capturing native text API calls for the specified control in a window.

Parameters

NameTypeDescription
$windowNamestringname of the application window
$controlstringname of the control inside the window
$durationintegeroptionalduration for capturing UI render calls in milliseconds
Raw script
_attachExe("app.exe",32);
_captureUI("windowName", "custom1");
_captureUI("windowName", "custom1", 5000);

Sahi Pro Classic API _captureUI

Modes Windows

Stops capturing UI render calls. Contructs the NX psuedo-element tables after this call.

Parameters

NameTypeDescription
None
Raw script
_selectWindow("windowName");
var $pos = _position(_pane("Custom1"));
_attach($pos[0],$pos[1],32);
_capture($pos[0],$pos[1]);
_wait(2000); // specify wait for the NX extension to capture adequate UI render calls
_stopCapture();

Sahi Pro Classic API _stopCapture

Modes Windows

Gets the number of tables.

Parameters

NameTypeDescription
None

Returns

integerNumber of tables rendered from NX
Raw script
//example using _capture API
_selectWindow("windowName");
var $pos = _position(_pane("Custom1"));
_attach($pos[0],$pos[1],32);
_capture($pos[0],$pos[1]);
_wait(2000); // specify wait for the NX extension to capture adequate UI render calls
_stopCapture();
var $noOfTables = _nxTableCount();

Sahi Pro Classic API _nxTableCount

Modes Windows

Gets the table data for a given table index.

Parameters

NameTypeDescription
$tableintegerIndex of the table for getting the table data

Returns

objectTable data containing rows and cells
Raw script
_selectWindow("windowName");
var $pos = _position(_pane("Custom1"));
_attach($pos[0],$pos[1],32);
_capture($pos[0],$pos[1]);
_stopCapture();
var $table = _nxTable(0);
/* returns [[{"text":"&File","x":687,"y":387,"tab":0,"row":0,"col":0}
,{"text":"&Edit","x":719,"y":387,"tab":0,"row":0,"col":1}
,{"text":"&Options","x":753,"y":387,"tab":0,"row":0,"col":2}
,{"text":"&Help","x":809,"y":387,"tab":0,"row":0,"col":3}]] */

Sahi Pro Classic API _nxTable

Modes Windows

Gets the cell data for given row, column and table index.

Parameters

NameTypeDescription
$rowintegerIndex of the row
$columnintegerIndex of the column
$tableintegerIndex of the table

Returns

objectcell data
Raw script
_selectWindow("MFC Grid Control Demo");
var $pos = _position(_pane("Custom1"));
_attach($pos[0],$pos[1],32);
_caputureUI("windowName", "control");
var $cell = _nxCell(0,0,0); // returns {"text":"&File","x":687,"y":387,"tab":0,"row":0,"col":0}

Sahi Pro Classic API _nxCell