Skip to main content

AutoItX extensions VB Script

AutoITX is a code library that uses a combination of simulated keystrokes, mouse movement and window/control manipulation in order to automate tasks in a way not possible or reliable with other languages (e.g. VBScript and Javascript). You can gain access to the AutoItX functions via util.GetAutoIt().

Category

Feature/Keyword

Clipboard

fd.getAutoIt.ClipGet - Retrieves text from the clipboard

fd.GetAutoIt.ClipPut - Writes text to the clipboard

Wait

fd.GetAutoIt.ProcessWait - Pauses script execution until a given process exists https://www.autoitscript.com/autoit3/docs/functions/ProcessWaitClose.htm

fd.GetAutoIt.ProcessWaitClose - Pauses script execution until a given process does not exist

fd.GetAutoIt.RunAsWait - Runs an external program

fd.GetAutoIt.RunWait - Runs an external program and pauses script execution until the program finishes

fd.GetAutoIt.WinWait - Pauses execution of the script until the requested window exists

fd.GetAutoIt.WinWaitActive - Pauses execution of the script until the requested window is active

fd.GetAutoIt.WinWaitClose - Pauses execution of the script until the requested window does not exist

fd.GetAutoIt.WinWaitNotActive - Pauses execution of the script until the requested window is not active

Mouse Manipulation

fd.GetAutoIt.MouseClick - Perform a mouse click operation

fd.GetAutoIt.MouseClickDrag - Perform a mouse click and drag operation

fd.GetAutoIt.MouseDown - Perform a mouse down event at the current mouse position

fd.GetAutoIt.MouseGetCursor - Returns a cursor ID Number of the current Mouse Cursor

fd.GetAutoIt.MouseGetPosX - Retrieves the current X position of the mouse cursor

fd.GetAutoIt.MouseGetPosY - Retrieves the current Y position of the mouse cursor

fd.GetAutoIt.MouseMove - Moves the mouse pointer

fd.GetAutoIt.MouseUp - Perform a mouse up event at the current mouse position

fd.GetAutoIt.MouseWheel - Moves the mouse wheel up or down. XP ONLY

fd.GetAutoIt.ControlClick - Sends a mouse click command to a given control

Window Manipulation

fd.GetAutoIt.WinActivate - Activates (gives focus to) a window

fd.GetAutoIt.WinActive - Checks to see if a specified window exists and is currently active

fd.GetAutoIt.WinClose - Closes a window

fd.GetAutoIt.WinExists - Checks to see if a specified window exists

fd.GetAutoIt.WinGetCaretPosX - Returns the coordinates of the caret in the foreground window

fd.GetAutoIt.WinGetCaretPosY - Returns the coordinates of the caret in the foreground window

fd.GetAutoIt.WinGetClassList - Retrieves the classes from a window

fd.GetAutoIt.WinGetClientSizeHeight - Retrieves the size of a given window's client area

fd.GetAutoIt.WinGetClientSizeWidth - Retrieves the size of a given window's client area

fd.GetAutoIt.WinGetHandle - Retrieves the internal handle of a window

fd.GetAutoIt.WinGetPosHeight - Retrieves the position and size of a given window

fd.GetAutoIt.WinGetPosWidth - Retrieves the position and size of a given window

fd.GetAutoIt.WinGetPosX - Retrieves the position and size of a given window

fd.GetAutoIt.WinGetPosY - Retrieves the position and size of a given window

fd.GetAutoIt.WinGetProcess - Retrieves the Process ID (PID) associated with a window

fd.GetAutoIt.WinGetState - Retrieves the state of a given window

fd.GetAutoIt.WinGetText - Retrieves the text from a window

fd.GetAutoIt.WinGetTitle - Retrieves the full title from a window

fd.GetAutoIt.WinKill - Forces a window to close

fd.GetAutoIt.WinList - Retrieves a list of windows

fd.GetAutoIt.WinMenuSelectItem - Invokes a menu item of a window

fd.GetAutoIt.WinMinimizeAll - Minimizes all windows

fd.GetAutoIt.WinMinimizeAllUndo - Undoes a previous WinMinimizeAll function

fd.GetAutoIt.WinMove - Moves and/or resizes a window

fd.GetAutoIt.WinSetOnTop - Change a window's "Always On Top" attribute

fd.GetAutoIt.WinSetState - Shows, hides, minimizes, maximizes, or restores a window

fd.GetAutoIt.WinSetTitle - Changes the title of a window

fd.GetAutoIt.WinSetTrans - Sets the transparency of a window

fd.GetAutoIt.WinWait - Pauses execution of the script until the requested window exists

fd.GetAutoIt.WinWaitActive - Pauses execution of the script until the requested window is active

fd.GetAutoIt.WinWaitClose - Pauses execution of the script until the requested window does not exist

fd.GetAutoIt.WinWaitNotActive - Pauses execution of the script until the requested window is not active

Control Manipulation

fd.GetAutoIt.ControlClick - Sends a mouse click command to a given control

fd.GetAutoIt.ControlCommand - Sends a command to a control

fd.GetAutoIt.ControlDisable - Disables or "grays-out" a control

fd.GetAutoIt.ControlEnable - Enables a "grayed-out" control

fd.GetAutoIt.ControlFocus - Sets input focus to a given control on a window

fd.GetAutoIt.ControlGetFocus - Returns the ControlRef# of the control that has keyboard focus within a specified window

fd.GetAutoIt.ControlGetHandle - Retrieves the internal handle of a control

fd.GetAutoIt.ControlGetPosHeight - Retrieves the position and size of a control relative to it's window

fd.GetAutoIt.ControlGetPosWidth - Retrieves the position and size of a control relative to it's window

fd.GetAutoIt.ControlGetPosX - Retrieves the position and size of a control relative to it's window

fd.GetAutoIt.ControlGetPosY - Retrieves the position and size of a control relative to it's window

fd.GetAutoIt.ControlGetText - Retrieves text from a control

fd.GetAutoIt.ControlHide - Hides a control

fd.GetAutoIt.ControlListView - Sends a command to a ListView32 control

fd.GetAutoIt.ControlMove - Moves a control within a window

fd.GetAutoIt.ControlSend - Sends a string of characters to a control

fd.GetAutoIt.ControlSetText - Sets text of a control

fd.GetAutoIt.ControlShow - Shows a control that was hidden

fd.GetAutoIt.ControlTreeView - Sends a command to a TreeView32 control

OS and Process Manipulation

fd.GetAutoIt.DriveMapAdd - Maps a network drive

fd.GetAutoIt.DriveMapDel - Disconnects a network drive

fd.GetAutoIt.DriveMapGet - Retreives the details of a mapped drive

fd.GetAutoIt.IsAdmin - Checks if the current user has administrator privileges

fd.GetAutoIt.ProcessClose - Terminates a named process

fd.GetAutoIt.ProcessExists - Checks to see if a specified process exists

fd.GetAutoIt.ProcessSetPriority - Changes the priority of a process

fd.GetAutoIt.ProcessWait - Pauses script execution until a given process exists

fd.GetAutoIt.ProcessWaitClose - Pauses script execution until a given process does not exist

fd.GetAutoIt.Run - Runs an external program

fd.GetAutoIt.RunAs - Runs an external program

fd.GetAutoIt.RunAsWait - Runs an external program

fd.GetAutoIt.RunWait - Runs an external program and pauses script execution until the program finishes

Examples

fd.WindowAction

DEFINITION: void fd.WindowAction(string actionType, string windowTitle);

DESCRIPTION: Alllows for the manipulation of a window or dialog.

PARAMETER 1: actionType = The action to run against the desired window.

Allowable Values:

  • “Activate” - will bring the application window to the forefront and give it focus.

  • “Minimize” - will minimize the window so that it is no longer visible.

  • “Maximize” - will maximize the window so that it uses the entire screen space.

  • “Restore” - will restore an application to its original size from a minimized state.

  • “Close” - will close the application completely.

PARAMETER 2: windowTitle = String that is contained in a windows title. It is beneficial to have the closest match possible to the desired window. For example “Notepad” will select window’s titled “Untitled – Notepad” or “Notepad++”. Leaving this parameter a blank string will allow this method to act upon the current active window.

EXAMPLE CODE:

' Activate a window containing the word “notepad”
fd.WindowAction("Activate", "Notepad")
' wait 1500 milliseconds to make sure text area has focus
fd.Wait(1.5)
fd.KeyPress("H, E, L, L, O")
' close the currently selected window
fd.WindowAction("Close", "");

fd.InsertText

DEFINITION: void fd.InsertText(string text)

DESCRIPTION: Insert a large block of text into the currently focused text box. This differs from fd.KeyPress in the fact that it treats the entire string as one autonomous “paste” into the text area. fd.KeyPress should be used if individual keypresses might be needed to trigger some underlying action into the EHR like a lookup of a drug or to trigger a menu item.

PARAMETER 1: text = The text to insert.

EXAMPLE CODE:

' Activate a window containing the word “notepad”
fd.WindowAction("Activate", "Notepad")
' wait 1500 milliseconds to make sure text area has focus
fd.Wait(1.5)
fd.InsertText ("Hello")

fd.Wait

DEFINITION: void fd.Wait(int timeinSeconds)

DESCRIPTION: Wait for a number of seconds.

PARAMETER 1: timeinSeconds = Number of seconds to wait

Allowable Values:Whole and decimal numbers. For example, 1 second, 0.5 seconds or 2.5 seconds.

EXAMPLE CODE:

' Activate a window containing the word “notepad”
fd.WindowAction("Activate", "Notepad")
' wait 1500 milliseconds to make sure text area has focus
fd.Wait(1.5)
fd.KeyPress("H, E, L, L, O")

fd.BuiltInCommand

DEFINITION: void fd.BuiltInCommand(string commandName)

DESCRIPTION: Built-in Commands are the pre-populated speech commands that M*Modal has built into Fluency Direct. You can use a speech command defined via the commandName parameter to perform the function you need.

PARAMETER 1: commandName = a string the represents any number of commands predefined via Fluency Direct.

Allowable Values: The list of all possible commands can be found at https://docs.mmodal.com/direct/index.php/user-guide/fluency-direct-9-0/speech-commands. Only those commands not containing variable parts such as <spokenWordText>, <text> are possible.

EXAMPLE CODE:

fd.InsertText ("Hello")
fd.BuiltInCommand("uppercase previous five words")

fd.MouseAction

DEFINITION: void fd.MouseAction(string mouseAction, string coordinatesOrigin, int x, int y)

DESCRIPTION: MouseAction is used to drive an EHR UI with mouse events. MouseAction allows you to designate specific mouse clicks or movements for the current window or dialog. For example; you could create a "New Message" script using mouse clicks in Outlook that would create a new message to send.

To begin, use the Command Editor to create a “Mouse Action” and then select the “Relative To” position. This position is based on the application window (NOT the screen). The relative position is important, because with consideration, you can make your MouseAction less problematic if you can’t pre determine window size. For example, a given button on a window might always be a consistent distance from the bottom right corner of the screen but a variable distance from the top left depending upon window size. You can typically change a window to a number of different sizes to best learn the best relative positioning.

Next, you will select your X and Y coordinates by clicking on the “Change” link. When you click Change, a blue dot will appear in the relative position over the application that you are in. Hover your mouse over the application window that you wish to perform the mouse click in and it will become highlighted in blue. Press the Spacebar to confirm the area and the X and Y coordinates will now change to numbers other than zero. Record these coordinates for your X and Y.

Note

When defining coordinates, you MUST be in the application that the command was intended to act upon. For example, if you register Mouse Clicks for creating a new document in Word, you must have Word open and active to use the command.

PARAMETER 1: mouseAction = The type of action desired.

Allowable Values:

  • “LeftClick” – simulates a left button click

  • “RightClick” – simulates a right button click

  • “DoubleClick” – simulates a double left button click

  • “MovePointer” – Moves the mouse pointer to the desired X and Y

PARAMETER 2: coordinatesOrigin = The relative positioning of the desired X, Y to the edge of the window. The relative position is important, because with consideration, you can make your MouseAction less problematic if you can’t pre determine window size. For example, a given button on a window might always be a consistent distance from the bottom right corner of the screen but a variable distance from the top left depending upon window size.

Allowable Values:

  • “TopLeft”

  • “TopRight”

  • “TopCenter”

  • “BottomLeft”

  • “BottomRight”

  • “BottomCenter”

  • “LeftMiddle”

  • “RightMiddle”

  • “WindowCenter”

EXAMPLE CODE: fd.MouseAction("LeftClick", "TopLeft", 582, 300)

fd.KeyPress

DEFINITION:void fd.KeyPress(string commaSeperatedkeyCombination)

DESCRIPTION:Used to simulate keystrokes into an textbox. This differs from fd.InsertText in the fact that it simulates the user typing each keystroke one at a time, whereas InsertText treats the entire string as one autonomous “paste” into the text area. Individual keypresses might be needed to trigger some underlying action into the EHR like a lookup of a drug or to trigger a menu item.

PARAMETER 1:commaSeperatedkeyCombination – a comma separated list f keystrokes. Use the command Key action step to determine the valid string to use for any given keystroke.

Sample of Allowable values:

  • “Ctrl + S”

  • “Alt + S”

  • “Tab”

  • “BackSpace”

  • “Enter”

  • “Left” – left arrow

  • “Delete”

  • “Period”

  • “F11”

  • “A” – lowercase a

  • “Shift + A” – uppercase a

  • “Shift + 2” - @

EXAMPLE CODE: fd.KeyPress("Shift + H, E, L, L, O");

fd.GetActiveWindowTitle

DEFINITION: string fd.GetActiveWindowTitle()

DESCRIPTION: Gets the window Title of the current dialog or window.

EXAMPLE CODE (Javascript): fd.InsertText ( fd.GetActiveWindowTitle())