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.
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.
Returns the free memory in the JVM in units of bytes.
Returns the number of bytes allocated to this JVM's heap.
Returns the number of bytes used by this JVM's heap.
Returns the max memory the JVM will attempt to use in units of bytes.
Returns the number of bytes allocated to this JVM for non-heap usage.
Returns the number of bytes used by non-heap memory pools.
Returns the total amount of memory available to the JVM in units of bytes.
Returns the calling process' CPU usage as a double between 0 (0%) and 1 (100%).
Returns the PID of the calling process CAUTION: Might not work on all JVMs.
relaunchSelf (selfJarNameAsString, argsAsString)
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.
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.
Sleep for millis. CAUTION: this blocks the calling thread.
RobotKeyCode (tAsChar) AsInt
Returns the integer KeyCode for the char t. This is mostly for diagnostic purposes.
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.
Releases a key corresponding to a single alphanumeric character if inString.length>1, it will only release the key for the first character.
RobotKeyText (keyCodeAsInt) AsString
Returns a String representation for the given KeyCode This is mostly for diagnostic purposes.
Trigger a MousePressed event with butt=1 for left, butt=2 for right, butt=3 for center. Make sure to call ReleaseMouseButton() soon thereafter.
Trigger a MouseReleaed event with butt=1 for left, butt=2 for right, butt=3 for center.
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 (xdiffAsInt, ydiffAsInt)
Moves the mouse cursor by xdiff, ydiff amounts in screen coordinates.
RobotMouseMoveTo (xAsInt, yAsInt)
Moves the mouse cursor to x,y in screen coordinates.
Scrolls the Mouse Wheel by dir. Negative numbers scroll up, positive numbers scroll down.
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.
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.
Presses and then releases key with 10 ms delay. Uses the indicated keyCode This is primarily for diagnostic purposes.
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.
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().
for releasing special keys: back, enter, control, meta, shift, alt, delete, tab, escape, windows, capslock, left_arrow, right_arrow, up_arrow, down_arrow
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.
Types the whole inString using a series of SingleStrikes. This is NOT the preferred method of inputting text. Use RobotPaste if you can.
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...().
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...().
Returns the dimensions of the rectangle used for CreateScreenCapture...() as an Int array = (xleft, ytop, width, height).
Sets the rectangle used for CreateScreenCapture...() as all the system screens as reported by ScreenGetDimensions().
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.
Sets the rectangle used for CreateScreenCapture...() as the left-most screen as reported by systemScreenDimensions().
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.
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 (xAsInt, yAsInt) AsInt
Returns an Int representing the color at the point (x,y). Uses the sRGB color model, compatible with fx.Colors.From32Bit().
Returns whether or not Standard Error is being redirected to a file. To redirect Standard Error to a file, call redirectStandardError().
Redirects Standard Error to the designated file. Returns true if it works, false otherwise. To return Standard Error to the console, call returnStandardErrorToConsole().
Returns Standard Error to the console, undoing redirectStandardError().
Returns whether or not Standard Out is being redirected to a file. To redirect Standard Out to a file, call redirectStandardOut().
StandardOutRedirect (outFileAsString) AsBoolean
Redirects Standard Out to the designated file. Returns true if it works, false otherwise. To return Standard Out to the console, call returnStandardOutToConsole().
Returns Standard Out to the console, undoing redirectStandardOut().
Returns the system CPU load as a double between 0 (0%) and 1 (100%).
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.
Returns free system physical memory in bytes.
Returns total system physical memory in bytes.
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.
Returns the System newline character using Java's System.lineSeparator() call.
Opens a web address in the system default browser. Same as fx.ShowExternalDocument() except you can use this in non-UI apps.
Opens an external file with the system defaults. Same as fx.ShowExternalDocument() except you can use this in non-UI apps.
Returns the operating system description. Returned String will look like: "Windows 7 Version: 6.1 Arch: amd64"
SystemProcessKillByPID (pidAsString) AsBoolean
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.
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 (cmdAsString) AsBoolean
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.