Description
A Rect
object represents a rectangular area on the screen or on an image. Rect
objects are returned by various test object methods. You can also create an empty Rect
object using the Utils.Rect
method.
Members
Example
The following example demonstrates how to obtain the Rect
object in script by using the Picture.Find
method.
JavaScript, JScript
function RectObjectSample()
{
var WndPicture, Pict, Rect;
// Captures an image of the specified on-screen object
WndPicture = Sys.Process("notepad").Window("Notepad", "*").Picture();
// Loads the sought-for image
Pict = Utils.Picture;
Pict.LoadFromFile("C:\\sample_image.gif");
// Searches for the rectangular area in the given image and returns the Rect object
Rect = WndPicture.Find(Pict);
…
}
Python
def RectObjectSample():
# Captures an image of the specified on-screen object
WndPicture = Sys.Process("notepad").Window("Notepad", "*").Picture()
# Loads the sought-for image
Pict = Utils.Picture
Pict.LoadFromFile("C:\\MyFiles\\sample_image.gif")
# Searches for the rectangular area in the given image and returns the Rect object
Rect = WndPicture.Find(Pict)
# ...
VBScript
Sub RectObjectSample
Dim WndPicture, Pict, Rect
' Captures an image of the specified on-screen object
Set WndPicture = Sys.Process("notepad").Window("Notepad", "*").Picture
' Loads the sought-for image
Set Pict = Utils.Picture
Pict.LoadFromFile("C:\sample_image.gif")
' Searches for the rectangular area in the given image and returns the Rect object
Set Rect = WndPicture.Find(Pict)
…
End Sub
DelphiScript
procedure RectObjectSample();
var WndPicture, Pict, Rect;
begin
// Captures an image of the specified on-screen object
WndPicture := Sys.Process('notepad').Window('Notepad', '*').Picture;
// Loads the sought-for image
Pict := Utils.Picture;
Pict.LoadFromFile('C:\sample_image.gif');
// Searches for the rectangular area in the given image and returns the Rect object
Rect := WndPicture.Find(Pict);
…
end;
C++Script, C#Script
function RectObjectSample()
{
var WndPicture, Pict, Rect;
// Captures an image of the specified on-screen object
WndPicture = Sys["Process"]("notepad")["Window"]("Notepad", "*")["Picture"]();
// Loads the sought-for image
Pict = Utils["Picture"];
Pict["LoadFromFile"]("C:\\sample_image.gif");
// Searches for the rectangular area in the given image and returns the Rect object
Rect = WndPicture["Find"](Pict);
…
}