login vsi company logo login vsi company logo 250x40
  • Home
  • Blog
  • Login Enterprise: New Feature - Get Text

Login Enterprise: New Feature - Get Text

We have recently released an important feature in the last Login Enterprise release called Get Text.

This blog will describe the benefits and functionality of it.

Get Text

Get Text is a scripting function in the Login Enterprise workload-scripting language. Essentially it allows for the retrieval of text from an object in an application’s user interface. This text can be used later in the script if desired.

The benefit is being able to test an application based on text visible in it.

Example #1: you have a workflow that will dynamically generate an order number in a product-ordering application. Now you can have the Login Enterprise workload perform an order number lookup to validate the order creation flow.

Example #2: before conditionally proceeding with a workload step, you want to verify an application's status based on text in the application's user interface that says, "Ready." You can do that too!

View the video on how it works.

In the video, we can see an open Notepad.exe with “Hello, World!” and the Login Enterprise test running (green rectangle at the bottom). It will find the text in Notepad.exe, save it as a variable, type this to a Run dialog box, and save the text in the Login Enterprise events, which is viewable in the Login Enterprise web interface.

Further, this text would be retrievable via the Login Enterprise RESTful public API. You could even add external logic around that: conditional automation based on the saved text in the Login Enterprise Event! An example scenario: is the application generating an error string? Then create a help desk ticket or send a sysadmin an email.

The source code for this script is the following, with explanatory comments at the end of some lines:

using LoginPI.Engine.ScriptBase;
public class getTextSample : ScriptBase
{​​​​​​​
private void Execute()
{​​​​​​​
var MainWindow = FindWindow(title:"*Notepad*",processName:"notepad"); // This will find open Notepad app
var MainWindowTextEditorPane = MainWindow.FindControl(className : "Document:Edit", title : "Text Editor"); // This will find the text editor control in the Notepad app
var MainWindowTextEditorPaneGetTextValue = MainWindowTextEditorPane.GetText(); // This will get the text in the Notepad text editor control
Type("{​​​​​​​lwin+r}​​​​​​​"); // This opens a run dialog box
Wait(1);
Type(MainWindowTextEditorPaneGetTextValue,cpm:600); // This types the value to the run dialog box
Wait(2);
Type("{​​​​​​​esc}​​​​​​​");
CreateEvent(title:"Notepad text editor value",description:@"The text in Notepad is: " + MainWindowTextEditorPaneGetTextValue); // This will create a Login Enterprise event, viewable in the Login Enterprise web GUI or retrievable via API
}​​​​​​​
}​​​​​​​

Preemptively, you can even use the Login Enterprise Application Xray tool to determine if the application’s user interface supports Get Text before incorporating it into a workload:

Login VSI Blog - Login Enterprise: New Feature - Get Text - Image 1

As shown, to get started with Get Text is easy! For more information or a demo, please contact us!

About the author

Joshua Kennedy joined the Login VSI Services Engineering team in 2016 and is fueled by passion for peer-mentoring and delivering exceptional solutions that surpass expectations. He’s been in the tech and engineering world since ’05. In his off times you’ll find him hiking, traveling, cooking, and motorcycling.