Package org.odinware.odinrunes
Class GraphicalInteractionsHelper
java.lang.Object
org.odinware.odinrunes.GraphicalInteractionsHelper
The GraphicalInteractionsHelper class provides methods for capturing and interacting with graphical elements on the screen.
It utilizes libraries such as SikuliX and Tesseract for performing tasks like capturing screenshots and extracting text from images.
Usage:
- Create an instance of GraphicalInteractionsHelper to access its methods.
- Use the provided methods to capture context from various sources, such as the clipboard, regionshots, or scrollshots.
- Use the captured context for further processing or interaction with other components.
Note:
- Make sure to have the necessary dependencies installed and added to the project.
- The class assumes the availability of tools like SikuliX and Tesseract for capturing and processing graphical elements.
-
Constructor Summary
ConstructorDescriptionCreates a new instance of the GraphicalInteractionsHelper class. -
Method Summary
Modifier and TypeMethodDescriptionstatic String
Retrieves the text content from the clipboard.Captures the text content from a specific region on the screen.Captures the text content from a scrollable region on the screen.Captures the text content from a series of screenshots taken at regular intervals on the screen.Extracts a middle portion of a given text.double
getSimilarity
(List<String> stringsToFind, String largerText) Calculates the similarity between a list of strings and a larger text.
-
Constructor Details
-
GraphicalInteractionsHelper
public GraphicalInteractionsHelper()Creates a new instance of the GraphicalInteractionsHelper class. Initializes the region, screen, and other variables used for graphical interactions.
-
-
Method Details
-
captureContextFromClipboard
Retrieves the text content from the clipboard.- Returns:
- The text content from the clipboard, or an empty string if it is not available or cannot be retrieved.
-
captureContextFromScrollshot
Captures the text content from a scrollable region on the screen.- Returns:
- The captured text content, or an empty string if it is not available or cannot be captured.
-
captureContextFromTimeshot
Captures the text content from a series of screenshots taken at regular intervals on the screen.- Returns:
- The captured text content, or an empty string if it is not available or cannot be captured.
-
captureContextFromRegionshot
Captures the text content from a specific region on the screen.- Returns:
- The captured text content, or an empty string if it is not available or cannot be captured.
-
getMiddle
Extracts a middle portion of a given text.- Parameters:
input
- The text to extract the middle portion from.startRatio
- The starting ratio of the middle portion, expressed as a value between 0.0 and 1.0.endRatio
- The ending ratio of the middle portion, expressed as a value between 0.0 and 1.0.- Returns:
- The middle portion of the text as a substring.
-
getSimilarity
Calculates the similarity between a list of strings and a larger text.- Parameters:
stringsToFind
- The list of strings to search for in the larger text.largerText
- The larger text to search in for the given strings.- Returns:
- The similarity score between 0.0 and 1.0 (inclusive).
-