- Overview
-
Benefits of using the Script Recorder
- Downloading and installing the Script Recorder
Overview
The Login Enterprise Script Recorder is a tool that captures and records the sequence of user interactions with a computer system or software application. It records user inputs, such as mouse clicks, keyboard actions, and other commands, creating a script that can be replayed to automate repetitive tasks or test software functionality. Script recorders are commonly used in testing, automation, and workflow optimization.
In the context of the Login Enterprise virtual appliance, a Script Recorder makes it easier to create Application scripts and get maximum value from the Tests. Our vision with the Script Recorder is to make it accessible and easy to use, allowing you to generate application scripts even if you are not familiar with scripting languages or may not have a background in scripting.
Starting from Login Enterprise 5.10, the Script Recorder v1 is integrated into the Script Editor. To learn more about the Script Recorder, its use cases, benefits, and more, see the Script Editor.
Benefits of using the Script Recorder
The Script Recorder offers significant advantages, including:
- Accelerated workload creation: You can develop workloads faster, enabling you to quickly perform valuable testing on target applications. For instance, if you previously spent one hour per workload, you can now complete the task in just 10 minutes. This efficiency boost allows you to script six workloads per hour instead of one. This improvement is particularly beneficial if you have extensive backlogs. You may have hundreds of applications that need scripting with Login Enterprise but lack the necessary time and resources. The Script Recorder enables you to address their backlog more rapidly, enhancing productivity and streamlining their workflow.
- Enhanced multi-application support: The Script Recorder enables you to quickly create multiple workloads for a single target application. This focused capability helps you manage and test different scenarios within the same application efficiently.
- Backlog reduction: If you have a backlog of applications that need scripting against the target application, the Script Recorder can help you address this backlog more efficiently by speeding up the scripting process.
- Natural interaction workflow: You can perform actions continuously while the Script Recorder captures your interactions, making the process more intuitive. Unlike the previous method of recording line by line, this continuous recording aligns better with your natural workflow and reduces interruptions in thought processes.
- User-friendly experience: The Script Recorder simplifies the process by reducing the amount of code you need to manage. You can create workloads in a single recording session, moving closer to the low-code model. This accessibility allows you to perform application scripting effectively, even without a scripting or programming background.
- Lower barrier to entry: The Script Recorder lowers the entry barrier, enabling you to quickly gain value from Login Enterprise. This increased ease of use ensures that you can script and test applications without extensive training or experience.
Recommendations
- Use one monitor during recording. Using multiple monitors with different scaling for recording doesn’t always work. Specifically, if you are working across two screens with varying scaling settings, the Script Recorder won’t handle that very well.
- Proceed slowly. The appearance of a blue box blinking over a button or object indicates that you can move to the next step.
Restrictions
- The script that the Script Recorder outputs can only be run in Login Enterprise version 5.10 (or higher).
- V1 only supports WinApps. Browser apps and browser-based apps, such as Teams and Spotify are out of scope for now.
- Actions that were not supported in the Engine before, are still not supported. For example, mouse drag and mouse scroll.
- Applications utilizing Java, Web components, or those launching separate windows with new executables aren’t functioning properly yet.
- The Script Recorder now only generates the script and doesn't automatically import it into the editor. You can only copy the script to the clipboard and paste it into the editor now. IMPORTANT: The Recorder script includes the initial 'start' command, so, when copying the script, please make sure you remove the command.
- For now, you can only record one application per recording.
- If a modal popup in an application opens as a new window, the Script Recorder will continue to function. However, during playback, the script engine might fail unless the new window is explicitly declared as a variable. This issue occurs because the engine does not automatically recognize the new window, which can cause playback errors that are not immediately apparent during recording. For example, in Excel, this behavior is observed when modal popups open in new windows.
Downloading and installing the Script Recorder
1. In the Login Enterprise sidebar menu, navigate to Configuration > Applications.
2. In Applications > Download Script Editor, click Download on the top right (the file with the integrated Script Recorder will start downloading immediately).
3. Extract the contents of the zip file onto your machine.
4. Open the folder and run the ScriptEditor.exe file.
When you click on the .exe file, a blue window may appear advising you not to run the file. This warning may be due to the file being unrecognized or from an unknown source. To proceed and run the file, click More info, and then Run anyway.
Creating a new Login Enterprise Application
1. In the Login Enterprise Script Editor, click Create a new Login Enterprise Application.
2. In Create New Application, take the following steps:
3. In Script Location, click the three-dot menu, and select a folder where you want to save the script. After you’ve selected the folder, provide a file name. For example, notepadScript.
4. Leave the Application type field unchanged
5. In Target, enter your target application. For example, notepad.exe.
6. Leave the Start in field empty.
7. Click Create.
Starting the recording: Recording the script
In the Script Editor top menu, click Record to start the recording.
When the recording starts, a player where you can perform actions opens.
The appearance of a blue box blinking over a button or object indicates that the Script Recorder is finding an element, and you can start performing an action. Wait for the blue frame to blink before performing an action.
With the Script Recorder, you can perform the following actions:
- Stop the recording of actions
- Start the recording of actions
- Pause or continue the recording
- Remove the last recorded action
- Remove all recorded actions
- Show or hide the list of recorded actions (downward/upward arrow icon)
Handling multi-process and multi-window scenarios
Script Recorder now manages scenarios involving multiple processes or windows.
Before Login Enterprise 5.14, the Script Recorder would struggle with scenarios in which an Application triggered the launch of a separate process or process window. For example, this includes Applications that start with a separate login window before launching the main Application, as well as scenarios where Applications launch an updater before starting the main window.
To mitigate this, the Script Recorder now keeps track of processes started from the target window, including their child processes, creating a clear chain of process hierarchy. To achieve this, it periodically polls the process list to identify any processes that have the target Application's process ID as a parent.
Note 1: To establish this chain of process hierarchy, the Script Recorder relies on performance counters.
Note 2: Since we use a polling mechanism, it may take some time for the Script Recorder to detect the desired window. During recording, you might notice a slight delay before the new window begins to blink as you transition between windows.
Run and continue recording
As of Login Enterprise 5.12, you can run and continue recording your script. The Run and Record button in the Script Editor allows you to execute an already created script and then automatically opens the recorder at the end of the script.
This feature is particularly useful if you need to add new steps to an existing script or make adjustments without re-recording everything from the beginning.
How it works
1. Execute the existing script: Click Run and Record. This will first execute the script that is currently open in the Script Editor.
2. Automatic recording: Once the script has finished running, the recorder will open automatically, enabling you to continue capturing additional actions or steps without starting from scratch.
Stop the recorder, click Generate script, and copy the script to the clipboard. Then, paste the script into the Script Editor, and click Run.
Launching apps with a START_IN magic comment
As of Login Enterprise 5.13, the Script Recorder uses the START_IN magic comment to launch applications, such as OBS Studio, if this comment is present in the script.
The screenshot below shows how the START_IN path appears in the recorded script:
For information on how to use the magic comment, including its formatting, practical examples, and best practices, see Using // TARGET: comments for CLI automation.
Identifying and recording Win11 apps
With Windows 11, it has become evident that various default applications exhibit a distinct process and window structure, posing challenges for the engine or Script Recorder to identify them. Examples include Calculator and Notepad, particularly when launched via environment variables such as Calc.exe or Notepad.exe. Many of these default applications employ a process-triggering mechanism, where they initiate a separate process to launch their windows. For instance, Calc.exe initiates a CalculatorApp.exe process, which subsequently spawns its windows under The ApplicationFrameHost process. This process is independent of the Calculator app, and multiple instances of Calculator can coexist under it.
This architecture poses implications for the Script Recorder, as attaching to this temporary launcher process would result in the recorder reporting the target window as non-existent. To address this limitation, you need to assist the recorder by clicking on the target window before initiating recording operations. Subsequently, the recording proceeds as usual. As a general practice, you can confirm the identification of the application by ensuring that the Task list can record the intended actions. Once a script is generated, a StartApplication command is included to enable the Engine to identify the target window. For example:
StartApplication(mainWindowClass: "Window:ApplicationFrameWindow", mainWindowTitle: "Calculator");
It's important to note that this StartApplication command is intended to replace any existing START commands already present in the script.
CLI parameters and arguments
As of Login Enterprise 5.14, the Script Recorder (and the Engine) allows you to write arguments and parameters to scripts. As of this implementation, you will write your parameters in the // Target:
aka the Target application.
There are a few things to note:
- Script Recorder will allow the use of environment variables, and these will be expanded to the respective values
- It is possible to write in the target application without quotations as per legacy behavior in the Engine.
- While the Script Recorder allows the end user to write in the target application without quotations this goes against standard Windows functionality when starting a process. Windows expects the user to wrap any file paths containing spaces in quotations. This functionality exists due to legacy behavior. See the following example. The second attempt is the standard behavior.
- This functionality will only allow the end user to write down a target application without quotations IF the target application has the following File extensions: ".exe", ".bat", ".cmd", ".vbs", ".wsh". This is also part of the legacy behavior in the Engine.
1. If you do not provide any of these extensions, the behavior will revert to the original Windows behavior. Thus the end user should wrap the target application in quotations, or at least, make sure that the provided file path does not contain spaces.
2. Arguments provided to the Script Recorder expect that any arguments with a file path be wrapped around quotations. Otherwise, you just have to make sure that your file path does not contain any spaces. This is consistent with standard Windows behavior.
The previous example attempts to run the following command:
%ProgramFiles%\Microsoft Office\root\Office16\EXCEL.EXE /t %ProgramFiles%\TestExcel.xlsx
This example expands environment variables to:
C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE /t C:\Program Files\TestExcel.xlsx
- This means that Excel then identifies C:\Program as one parameter and Files\TestExcel.xlsx as another parameter. Therefore, it fails to find the file
- The solution is to wrap around the argument in quotations as “%ProgramFiles%\TestExcel.xlsx”
Stopping the recording: ScriptResultWindow
When you stop the recording, the ScriptResultWindow with an overview of all recorded steps (before generating the script right after the recording was stopped).
In this Overview screen, you can perform the following actions:
Settings
-
Record interaction → Determines mouse positioning when interacting with elements.
-
Click to center (default) → The script will always click in the center of the element.
-
Use X and Y coordinates → The script will click within the element as it was recorded.
-
-
Mouse move → Determines the inclusion or exclusion of mouse movements in the script.
-
Include/exclude mouse moves in the recording → Once you select the checkbox, the actual mouse movements will be included in the script. This might lead to increased runtime of the script.
-
-
Waits → Adds a pause after each recorded step in the script.
- CPM (Characters Per Minute) → Adjusts typing speed. The default is 300 characters per minute. If you leave this box unchecked, the default value will be used. If you select this checkbox, the CPM value will appear in the script.
- Timeout → Overrides the default timeout of the findWindows functions. The default is 15 seconds. If you leave this box unchecked, the default value will be used. If you select this checkbox, the timeout value will appear in the script.
Export JSON
- This option provides additional information on script failures, facilitating feedback submission and analysis.
Generate script
- This option generates the script. After generating the script, you can go back, change the settings, and generate the script (with new settings) again.
New START methodology
Starting with Windows 11, certain default applications like Calculator and Notepad have a different process and window structure that can make it difficult for the Script Recorder to identify them. These applications, when launched through environment variables (e.g., Calc.exe or Notepad.exe), trigger a separate process that manages the window under a different application (for example, CalculatorApp.exe creates its windows under the ApplicationFrameHost process). This architecture can cause issues because the temporary launcher process terminates after the window is created, which means the Script Recorder might fail to latch onto the target window.
To handle this, the Script Recorder will prompt you to click inside the target application window before starting the recording. Once this is done, the Script Recorder will generate a script, and the following StartApplication command will be included:
StartApplication(mainWindowClass: "Window:ApplicationFrameWindow", mainWindowTitle: "Calculator");
This StartApplication command is specifically designed to identify the target window, allowing the Engine to properly interact with the application. If you see this StartApplication command in your generated script, it indicates that you need to replace any default START (); command that was initially included in the template. This step is crucial to ensure that the Recorder functions correctly for applications with unique launch processes.
For most other applications, the default START (); function will work as expected, and additional steps will be inserted after this function during the recording. However, for applications like Calculator, where the StartApplication command is generated, you must override the default START function to ensure accurate script execution.
Delete actions
- For example, if you’ve accidentally clicked twice, you can remove one of the clicks.
Collapse and uncollapse actions
- To see: description of action, tag of action, name of action.
- To change action settings (overwrites global setting for this particular action).
Wildcards for Class Names, Names, Titles, and Automation IDs
Wildcards are particularly useful when dealing with elements that have dynamic properties in an application.
Why use wildcards?
Wildcards allow for flexible matching of elements when their properties are not fixed. For instance, if elements in an application have names or IDs that change dynamically, using wildcards can help you identify and interact with these elements more effectively.
How wildcards work
- A * (asterisk) serves as a wildcard character.
- Placing the * at the end of a string, e.g. classn* will match all elements that start with the given prefix.
- The * can also be placed at the beginning or in the middle of the string to match elements with varying prefixes or suffixes.
Syntax example
{TagGoesHere} : {ClassNameGoesHere} [{NameGoesHere}][AutomationId : {AutomationIdGoesHere}][Position: {PositionGoesHere}]
In this syntax, wildcards can be used in the following elements:
- {ClassNameGoesHere}
- {NameGoesHere}
- {AutomationIdGoesHere}
Practical example
Imagine you’re writing a script to interact with Microsoft Word. When you open a new document, the Script Recorder might capture the window title as:
var nWindow0 = FindWindowByClassAndName(className: "Window:OpusApp", name: "Document1 - Word");
Here, the title "Document1 - Word" is specific and might not always be the same. If you want your script to work regardless of the specific window title, you can use a wildcard to match any title that ends with " - Word":
var nWindow0 = FindWindowByClassAndName(className: "Window:OpusApp", name: "* - Word");
In this example, the asterisk (*) acts as a wildcard character, allowing the script to successfully find any Microsoft Word window where the title ends with " - Word", even if the part before " - Word" changes.
Running the script
1. In the ScriptResultWindow, click Generate script.
2. Copy the generated script to the clipboard and paste it into the Script Editor.
Currently, the Script Recorder isn’t supporting notifications, such as Copied to the clipboard. So, once you copy the script to the clipboard, it has been saved—the Script Recorder is just not letting you know about it. You can now proceed and paste the script into the Script Editor.
3. In the Script Editor top menu, click Run to run the script.
Importing existing script
Alternatively, if you already have an existing script recording (JSON file), click Import recording in the Script Recorder top menu and proceed with the steps described above.
If you have questions or need additional information on specific Script Recorder functions, feel free to get in touch with our support at support@loginvsi.com.
Additional resources
- For information on scripting functions, see the Scripting functions.
- To learn about the Script Recorder implementation details, see the Understanding the Script Recorder implementation.