Extracts a portion of the actual host screen (Presentation Space) and stores it within a variable. If multiple lines are specified, then the data is stored as a string array. Corresponds to the GetPS action.
App.GetPS([Row][, Column][, Width][, Height])
Newlook Smartclient
Newlook Server
Row - ( Optional)
Integer value specifying the start row of the portion of the PS to extract. If not specified, row 1 is assumed.
Column - ( Optional)
Integer value specifying the start column of the portion of the PS to extract. If not specified, column 1 is assumed.
Width - ( Optional)
Integer value specifying the number of characters to retrieve. If not specified, the width is assumed to be from the starting Column to the right edge of the window. If the starting Column plus the Width extends past the right edge of the window, the wrapped portion of the text is returned. In this case, Height must be equal to 1. If Height is not 1; the width is truncated to the right edge of the window.
Height - (Integer, Optional)
Integer value specifying the number of rows of PS data to retrieve. If not specified, the height is assumed to be from the starting Row to the bottom of the window.
To determine the Row, Column, Width and Height arguments for the GetPS method, open the relevant screen in Identify. Using your mouse, select the area of the screen that you wish to extract. The Row and Column co-ordinates and height and width of your selection respectively are displayed in the Message Bar at the bottom of the screen. In the example screenshot below, the System output field would be extracted with the following arguments:
MyVariable = App.GetPS (2,70,1,8)
Fig. 1 Sample Screenshot
This method is useful if you wish to check the contents of an area of the current screen and the co-ordinates of that area do not change, perhaps to ensure that the current screen is a particular screen before executing some logic. To determine the row and column position of a specific character on the host screen, open the screen in Identify and position your cursor on the character. The row and column position are specified in Position section of the Properties window or the message bar at the bottom of the screen.
The GetPS method returns a Variant containing the extracted portion of the current active form's presentation space. If Height is equal to 1, the Variant contains a String value. If Height is greater than 1, it returns a VB Array with each element representing a row of the PS.
If you are using this method in a JScript script and you are extracting more than one row of the presentation space then you will need to convert the returned value from a VB to JScript array using the toArray() method. See the JScript example below.
If the sum of Col plus Width extends past the right edge of the window and Height is equal to 1, the wrapped portion of the text is included in the return string. If Height is not equal to 1; the extract is truncated at the right edge of the window.
The following example extracts a portion of the presentation space of the current screen, assigns it to a local variable array and then executes some code based on the contents of that array. VB SCRIPTDim systemName systemName = App.GetPS (2, 70, 10, 3)
If systemName(0) = "LOOK " Then MsgBox "Please change systems" end if JSCRIPTvar systemName = App.GetPS (2, 70, 10, 3);
//Convert VB array to JScript array var ConvertedName = systemName.toArray();
if (ConvertedName[0] == "LOOK "){ App.MsgBox ("Please change systems","Alert"); } |
© 2004-2021 looksoftware. All rights reserved.