-
Notifications
You must be signed in to change notification settings - Fork 512
Window Object
The Window Object is returned by various Slate API functions. This page describes it in detail.
The Window Object represents a currently open window.
Return the Title of the Window.
// assuming win is the Window Object
var title = win.title();
Alias: tl
Return the top left point that represents this Window's location.
// assuming win is the Window Object
var topLeft = win.topLeft();
var topLeftX = topLeft.x;
var topLeftY = topLeft.y;
Return the size of this Window.
// assuming win is the Window Object
var size = win.size();
var width = size.width;
var height = size.height;
Return the rectangle that represents this Window's location and size.
// assuming win is the Window Object
var rect = win.rect();
var topLeftX = rect.x;
var topLeftY = rect.y;
var width = rect.width;
var height = rect.height;
Return the Process Identifier of the Window.
// assuming win is the Window Object
var pid = win.pid();
Focus the Window. Returns true
if the focus succeeded, false
if it did not.
// assuming win is the Window Object
var success = win.focus();
Alias: hidden
Returns true
if the Window is minimized or hidden, false
if not.
// assuming win is the Window Object
var isMinimizedOrHidden = win.isMinimizedOrHidden();
Alias: main
Returns true
if the Window is the main window of its Application, false
if not.
// assuming win is the Window Object
var isMain = win.isMain();
Move the window to a new location. You may use Expressions which will be evaluated based on the screen the window is on or the "screen"
parameter in the parameter hash. Returns true
if the move succeeded, false
if it did not.
// assuming win is the Window Object
var success = win.move({
"x" : "screenOriginX",
"y" : "screenOriginY",
"screen" : "0"
});
Alias: movable
Returns true
if this window can be moved, false
otherwise.
// assuming win is the Window Object
var isMovable = win.isMovable();
Resize the window. You may use Expressions which will be evaluated based on the screen the window is on or the "screen"
parameter in the parameter hash. Returns true
if the resize succeeded, false
if it did not.
// assuming win is the Window Object
var success = win.resize({
"width" : "screenSizeX",
"height" : 500
});
Alias: resizable
Returns true
if this window can be resized, false
otherwise.
// assuming win is the Window Object
var isResizable = win.isResizable();
Alias: doop
Perform any operation on the window. Returns true
if the operation succeeded, false
if it did not.
var push = slate.operation("push", { "direction" : "up" });
var success = win.doOperation(push);
OR
var success = win.doOperation("push", { "direction" : "up" });
Return the screen object representing the screen this window is on.
var screen = win.screen();
Return the application object representing the application of this window.
var app = win.app();