B4J Programming Press on the image to return to the main documentation page.

jAWTRobot

List of types:

AWTRobot

AWTRobot


Events:

JVMShutdown

Members:


  ClipboardFileListGet As List

  ClipboardFileListHas As Boolean

  ClipboardFileListSet (fileList As List)

  ClipboardImageGetAsByteArray As Byte()

  ClipboardImageHas As Boolean

  ClipboardStringGet As String

  ClipboardStringHas As Boolean

  ClipboardStringSet (inString As String)

  javaVersion As String

  JVMAddShutdownHook (module As Object, eventName As String)

  JVMGarbageCollectionRequest

  JVMMemoryFree As Long

  JVMMemoryHeapAllocated As Long

  JVMMemoryHeapUsed As Long

  JVMMemoryMax As Long

  JVMMemoryNonHeapAllocated As Long

  JVMMemoryNonHeapUsed As Long

  JVMMemoryTotalAvailable As Long

  JVMProcessCPULoad As Double

  JVMProcessID As String

  relaunchSelf (selfJarName As String, args As String)

  relaunchSelfBatch (BatchFileName As String)

  RobotDelay (millis As Int)

  RobotKeyCode (t As Char) As Int

  RobotKeyPress (inString As String)

  RobotKeyRelease (inString As String)

  RobotKeyText (keyCode As Int) As String

  RobotMouseButtonPress (butt As Int)

  RobotMouseButtonRelease (butt As Int)

  RobotMouseCurrentLocation As Int()

  RobotMouseMoveBy (xdiff As Int, ydiff As Int)

  RobotMouseMoveTo (x As Int, y As Int)

  RobotMouseWheel (dir As Int)

  RobotPaste (inString As String)

  RobotSingleStrike (inString As String)

  RobotSingleStrikeKeyCode (keyCode As Int)

  RobotSpecialKeyCombo (inString As String)

  RobotSpecialKeyPress (inString As String)

  RobotSpecialKeyRelease (inString As String)

  RobotSupportsMetaKey As Boolean

  RobotType (inString As String)

  ScreenCaptureAsByteArray As Byte()

  ScreenCaptureToFile (filename As String)

  ScreenCurrentRectangleGetDimensions As Int()

  ScreenCurrentRectangleSetAsAllScreens

  ScreenCurrentRectangleSetAsArbitrary (x As Int, y As Int, width As Int, height As Int)

  ScreenCurrentRectangleSetAsLeftScreen

  ScreenCurrentRectangleSetAsRightScreen

  ScreenGetDimensions As Int()

  ScreenPixelColorGetAt (x As Int, y As Int) As Int

  StandardErrorIsRedirected As Boolean

  StandardErrorRedirect (errorFile As String) As Boolean

  StandardErrorReturnToConsole As Boolean

  StandardOutIsRedirected As Boolean

  StandardOutRedirect (outFile As String) As Boolean

  StandardOutReturnToConsole As Boolean

  SystemCPULoad As Double

  SystemHostNameAndIPAddress As String

  SystemMemoryPhysicalFree As Long

  SystemMemoryPhysicalTotal As Long

  SystemNanoTime As Long

  SystemNewlineCharacter As String

  SystemOpenAddressInBrowser (address As String)

  SystemOpenExternalFile (filename As String)

  SystemOperatingSystemEtc As String

  SystemProcessKillByPID (pid As String) As Boolean

  SystemProcessorsNumberOf As Int

  SystemRunCommand (cmd As String) As Boolean

Members description:

ClipboardFileListGet As List
Returns a List of Strings representing the full file paths of the
files in the system clipboard.
ClipboardFileListHas As Boolean
ClipboardFileListSet (fileList As List)
ClipboardImageGetAsByteArray As Byte()
ClipboardImageHas As Boolean
ClipboardStringGet As String
Returns the text contents of the system clipboard.
If unable to for whatever reason, returns an empty string.
ClipboardStringHas As Boolean
ClipboardStringSet (inString As String)
Sets the system clipboard String contents
javaVersion As String
Returns the Java version.
JVMAddShutdownHook (module As Object, eventName As String)
Adds a ShutdownHook for the JVM. The sub eventName_JVMShutdown() within the specified
module will run when the JVM shuts down. This method will not run in the main thread.
JVMGarbageCollectionRequest
Calls System.gc() which requests that the JVM run garbage collection.
Note that you can only request that the JVM run garbage collection and that the
JVM is free to ignore the request if it feels like it.
Also, note that this function blocks until the JVM finishes executing garbage
collection or decides to ignore your request.
JVMMemoryFree As Long
Returns the free memory in the JVM in units of bytes.
JVMMemoryHeapAllocated As Long
Returns the number of bytes allocated to this JVM's heap.
JVMMemoryHeapUsed As Long
Returns the number of bytes used by this JVM's heap.
JVMMemoryMax As Long
Returns the max memory the JVM will attempt to use in units of bytes.
JVMMemoryNonHeapAllocated As Long
Returns the number of bytes allocated to this JVM for non-heap usage.
JVMMemoryNonHeapUsed As Long
Returns the number of bytes used by non-heap memory pools.
JVMMemoryTotalAvailable As Long
Returns the total amount of memory available to the JVM in units of bytes.
JVMProcessCPULoad As Double
Returns the calling process' CPU usage as a double between 0 (0%) and 1 (100%).
JVMProcessID As String
Returns the PID of the calling process
CAUTION: Might not work on all JVMs.
relaunchSelf (selfJarName As String, args As String)
This function creates a temporary batch file, runs the batch file and then shuts down
the app. The running batch file pauses for 5 seconds, starts a new instance of this app
(selfJarName), and then deletes itself. In short, this function causes the app to restart itself.
WARNING: Because it uses a batch file, this function is Windows-only.
selfJarName should include the .jar suffix. The args String should be a space-separated list of
arguments to pass to the new instance of the app. If you have no arguments, just pass an
empty String.
relaunchSelfBatch (BatchFileName As String)
Like relaunchSelf(), but instead of launching a jar, it launches
a batch file. This is useful in case you need to run a batch file on shutdown
or you want to relaunch your app but your app is launched via batch script.
RobotDelay (millis As Int)
Sleep for millis.
CAUTION: this blocks the calling thread.
RobotKeyCode (t As Char) As Int
Returns the integer KeyCode for the char t.
This is mostly for diagnostic purposes.
RobotKeyPress (inString As String)
Presses a key corresponding to a single alphanumeric character, or punctuation.
If inString.length>1, it will only press the key for the first character.
Be sure to call ReleaseKey() soon thereafter.
RobotKeyRelease (inString As String)
Releases a key corresponding to a single alphanumeric character
if inString.length>1, it will only release the key for the first character.
RobotKeyText (keyCode As Int) As String
Returns a String representation for the given KeyCode
This is mostly for diagnostic purposes.
RobotMouseButtonPress (butt As Int)
Trigger a MousePressed event with butt=1 for left, butt=2 for right, butt=3 for center.
Make sure to call ReleaseMouseButton() soon thereafter.
RobotMouseButtonRelease (butt As Int)
Trigger a MouseReleaed event with butt=1 for left, butt=2 for right, butt=3 for center.
RobotMouseCurrentLocation As Int()
Returns the integer coordinates of the current mouse location as an integer array.
The first element is the x position, the second is the y position.
RobotMouseMoveBy (xdiff As Int, ydiff As Int)
Moves the mouse cursor by xdiff, ydiff amounts in screen coordinates.
RobotMouseMoveTo (x As Int, y As Int)
Moves the mouse cursor to x,y in screen coordinates.
RobotMouseWheel (dir As Int)
Scrolls the Mouse Wheel by dir.
Negative numbers scroll up, positive numbers scroll down.
RobotPaste (inString As String)
Puts inString into System clipboard and then pastes it
by pressing and releasing ctrl_v. If that doesn't work, uses
meta_v. This method should work on all platforms.
This is the preferred method of inputting text.
RobotSingleStrike (inString As String)
Presses and then releases key with 10 ms delay.
Only for inString.charAt(0).
Use only for alphanumerics and punctuation.
This is NOT the preferred method of inputting text.
Use RobotPaste if you can.
RobotSingleStrikeKeyCode (keyCode As Int)
Presses and then releases key with 10 ms delay.
Uses the indicated keyCode
This is primarily for diagnostic purposes.
RobotSpecialKeyCombo (inString As String)
Special key combos: ctrl_shift_esc, alt_tab, ctrl_c, ctrl_v,
ctrl_shift_v, ctrl_z, ctrl_x, ctrl_f, ctrl_a, ctrl_shift_m, alt_f,
meta_v, meta_c, meta_x.
This sub takes care of the key presses and releases.
Make sure the OS supports the meta key before using keycombos
that use the meta key.
Use RobotSupportsMetaKey() for checking.
RobotSpecialKeyPress (inString As String)
For pressing special keys: back, enter, control, meta, shift, alt, delete, tab,
escape, windows, capslock, left_arrow, right_arrow, up_arrow, down_arrow
Be sure to call ReleaseSpecialKey() soon thereafter.
If you use the meta key, make sure the OS supports it with call to
RobotSupportsMetaKey().
RobotSpecialKeyRelease (inString As String)
for releasing special keys: back, enter, control, meta, shift, alt, delete, tab,
escape, windows, capslock, left_arrow, right_arrow, up_arrow, down_arrow
RobotSupportsMetaKey As Boolean
Returns true if the operating system supports the meta key.
On Macs, the meta key maps to the command key.
This will attempt to press the meta key.
RobotType (inString As String)
Types the whole inString using a series of SingleStrikes.
This is NOT the preferred method of inputting text.
Use RobotPaste if you can.
ScreenCaptureAsByteArray As Byte()
Takes a screenshot of the given rectangle (default is 1920x1200),
returns the image in .png format as a byte array so the byte array
can be used in Non-UI apps.
If the default rectangle is unsatisfactory, make sure to set the desired rectangle
using ScreenCurrentRectangleSetAs...().
ScreenCaptureToFile (filename As String)
Creates a screen capture of the given rectangle (default is 1920x1200)
and saves the image to "filename" relative to .jar's location.
The file will be a .png file so make sure "filename" ends in ".png".
If the default rectangle is unsatisfactory, make sure to set the desired rectangle
using rectangleAs...().
ScreenCurrentRectangleGetDimensions As Int()
Returns the dimensions of the rectangle used for CreateScreenCapture...()
as an Int array = (xleft, ytop, width, height).
ScreenCurrentRectangleSetAsAllScreens
Sets the rectangle used for CreateScreenCapture...() as all the system screens
as reported by ScreenGetDimensions().
ScreenCurrentRectangleSetAsArbitrary (x As Int, y As Int, width As Int, height As Int)
Sets the rectangle as any arbitrary rectangle with top left corner at x,y
and of designated width and height.
This rectangle will be the region of the screen captured during
CreateScreenCapture...() calls.
ScreenCurrentRectangleSetAsLeftScreen
Sets the rectangle used for CreateScreenCapture...() as the left-most screen
as reported by systemScreenDimensions().
ScreenCurrentRectangleSetAsRightScreen
Sets the rectangle used for CreateScreenCapture...() as the right-most screen
as reported by systemScreenDimensions(). If the system only has one screen, the
left-most and right-most screens will be the same.
ScreenGetDimensions As Int()
Returns the system's screen dimensions as an array of ints.
Widths are the even elements, heights the odd elements.
The array size will be twice the number of monitors.
ScreenPixelColorGetAt (x As Int, y As Int) As Int
Returns an Int representing the color at the point (x,y).
Uses the sRGB color model, compatible with fx.Colors.From32Bit().
StandardErrorIsRedirected As Boolean
Returns whether or not Standard Error is being redirected to a file.
To redirect Standard Error to a file, call redirectStandardError().
StandardErrorRedirect (errorFile As String) As Boolean
Redirects Standard Error to the designated file.
Returns true if it works, false otherwise.
To return Standard Error to the console, call returnStandardErrorToConsole().
StandardErrorReturnToConsole As Boolean
Returns Standard Error to the console, undoing redirectStandardError().
StandardOutIsRedirected As Boolean
Returns whether or not Standard Out is being redirected to a file.
To redirect Standard Out to a file, call redirectStandardOut().
StandardOutRedirect (outFile As String) As Boolean
Redirects Standard Out to the designated file.
Returns true if it works, false otherwise.
To return Standard Out to the console, call returnStandardOutToConsole().
StandardOutReturnToConsole As Boolean
Returns Standard Out to the console, undoing redirectStandardOut().
SystemCPULoad As Double
Returns the system CPU load as a double between 0 (0%) and 1 (100%).
SystemHostNameAndIPAddress As String
Returns the hostname and local IP Address as a String. Returns an empty String if
an Exception occurs. Return String is of the form HostName/192.168.10.20.
SystemMemoryPhysicalFree As Long
Returns free system physical memory in bytes.
SystemMemoryPhysicalTotal As Long
Returns total system physical memory in bytes.
SystemNanoTime As Long
Returns the number of nanoseconds since an arbitrary origin.
All calls within the java instance will use the same origin but different origins
may be used across multiple instances.
SystemNewlineCharacter As String
Returns the System newline character using Java's System.lineSeparator() call.
SystemOpenAddressInBrowser (address As String)
Opens a web address in the system default browser.
Same as fx.ShowExternalDocument() except you can use this in non-UI apps.
SystemOpenExternalFile (filename As String)
Opens an external file with the system defaults.
Same as fx.ShowExternalDocument() except you can use this in non-UI apps.
SystemOperatingSystemEtc As String
Returns the operating system description.
Returned String will look like: "Windows 7 Version: 6.1 Arch: amd64"
SystemProcessKillByPID (pid As String) As Boolean
Uses the Windows-only taskkill command to kill the process at the pid.
PID should be purely numeric.
Returns true if it works, false if an exception was caught.
SystemProcessorsNumberOf As Int
Returns the number of processors available to the JVM.
If the JVM hasn't been invoked with any special restrictions, this will
be the number of processors in the system.
Intel Hyper-Threaded systems will report two logical cores per physical core
when Hyper-Threading is enabled.
SystemRunCommand (cmd As String) As Boolean
Runs an arbitrary String as a command-line command.
Returns true if it works, false if it throws an Exception.
The Exception message will be printed to Standard Error.
Top