AutoTest
Class AutoIt

java.lang.Object
  extended by AutoTest.AutoIt

public class AutoIt
extends java.lang.Object


Nested Class Summary
static class AutoIt.ByReferenceBoolean
           
static class AutoIt.ByReferenceDouble
           
static class AutoIt.ByReferenceInteger
           
static class AutoIt.ByReferenceLong
           
static class AutoIt.ByReferenceString
           
 
Constructor Summary
AutoIt()
           
 
Method Summary
 void BlockInput(int nToggle)
          Documentation for: BlockInput Will prevent any user input via the mouse or keyboard.
 void ClipGet(AutoIt.ByReferenceString szText)
          Documentation for: ClipGet Allows you to get text from the clipboard.
 void ClipPut(java.lang.String szText)
          Documentation for: ClipPut Allows you to get text from the clipboard.
 void Close()
          Documentation for: Close Closes down AutoIt.
 void DetectHiddenText(int nToggle)
          Documentation for: DetectHiddenText Some programs use hidden text on windows this can cause problems when trying to script them.
 int IfWinActive(java.lang.String szTitle, java.lang.String szText)
          Documentation for: IfWinActive Checks if a given window is currently active.
 int IfWinExist(java.lang.String szTitle, java.lang.String szText)
          Documentation for: IfWinExist Checks if a given window current exists (in any state).
 void IniDelete(java.lang.String szFile, java.lang.String szSection, java.lang.String szValue)
          Documentation for: IniDelete Deletes a specified value from a standard .INI file.
 void IniRead(java.lang.String szFile, java.lang.String szSection, java.lang.String szValue, AutoIt.ByReferenceString szResult)
          Documentation for: IniRead Reads a specified value from a standard .INI file.
 void Init()
          Documentation for: Init Resets AutoIt to defaults (window delays, key delays, etc.).
 void IniWrite(java.lang.String szFile, java.lang.String szSection, java.lang.String szValue, java.lang.String szResult)
          Documentation for: IniWrite Write a specified value to a standard .INI file.
 void LeftClick(int nX, int nY)
          Documentation for: LeftClick Simulates a mouse left-click at a given coordinate.
 void LeftClickDrag(int nX1, int nY1, int nX2, int nY2)
          Documentation for: LeftClickDrag Simulates a mouse left-click-drag operation.
 int MouseGetPosX()
          Documentation for: MouseGetPosX Gets the X coordinate of the mouse pointer.
 int MouseGetPosY()
          Documentation for: MouseGetPosY Gets the Y coordinate of the mouse pointer.
 void MouseMove(int nX, int nY)
          Documentation for: MouseMove Moves the mouse pointer to the specified coordinates.
 void RightClick(int nX, int nY)
          Documentation for: RightClick Simulates a mouse right-click at a given coordinate.
 void RightClickDrag(int nX1, int nY1, int nX2, int nY2)
          Documentation for: RightClickDrag Simulates a mouse right-click-drag operation.
 void Send(java.lang.String szLine)
          Documentation for: Send Set an error message.
 void SetCapslockState(int nToggle)
          Documentation for: SetCapslockState This command will correctly set the state of the CAPSLOCK key to either on or off.
 void SetKeyDelay(int nDelay)
          Documentation for: SetKeyDelay This functions will alter the amount of time that AutoIt pauses between each simulated keypress.
 void SetStoreCapslockMode(int nToggle)
          Documentation for: SetStoreCapslockMode By default, at the start of a "Send" command AutoIt will store the state of the CAPSLOCK key; at the end of the "Send" command this status will be restored.
 void SetTitleMatchMode(int nMode)
          Documentation for: SetTitleMatchMode This function will alter the way that AutoIt matches window titles in functions such as WinWait, IfWinActive, etc.
 void SetWinDelay(int nDelay)
          Documentation for: SetWinDelay This functions will alter the amount of time that AutoIt pauses after performing a WinWait-type function.
 void Shutdown(int nFlag)
          Documentation for: Shutdown This function can perform various types of shutdown on all Windows operating systems.
 void Sleep(int nMilliseconds)
          Documentation for: Sleep This function simply pauses for an amount of time.
 void WinActivate(java.lang.String szTitle, java.lang.String szText)
          Documentation for: WinActivate This function will activate a specified window.
 void WinClose(java.lang.String szTitle, java.lang.String szText)
          Documentation for: WinClose This function will close a specified window
 void WinGetActiveTitle(AutoIt.ByReferenceString szTitle)
          Documentation for: WinGetActiveTitle A string pointer to receive the window title.
 void WinHide(java.lang.String szTitle, java.lang.String szText)
          Documentation for: WinHide This function will hide a specified window.
 void WinKill(java.lang.String szTitle, java.lang.String szText)
          Documentation for: WinKill This function will forceably close a specified window.
 void WinMaximize(java.lang.String szTitle, java.lang.String szText)
          Documentation for: WinMaximize This function will maximize a specified window.
 void WinMinimize(java.lang.String szTitle, java.lang.String szText)
          Documentation for: WinMinimize This function will minimize a specified window.
 void WinMinimizeAll()
          Documentation for: WinMinimizeAll This function will minimize all windows.
 void WinMinimizeAllUndo()
          Documentation for: WinMinimizeAllUndo This function will undo a previous WinMinimizeAll call.
 void WinMove(java.lang.String szTitle, java.lang.String szText, int nX, int nY, int nWidth, int nHeight)
          Documentation for: WinMove Use this function to move/resize a specified window.
 void WinRestore(java.lang.String szTitle, java.lang.String szText)
          Documentation for: WinRestore This function will restore a window from a minimized state.
 void WinSetTitle(java.lang.String szTitle, java.lang.String szText, java.lang.String szNewTitle)
          Documentation for: WinSetTitle Changes the title of a specified window.
 void WinShow(java.lang.String szTitle, java.lang.String szText)
          Documentation for: WinShow This function will show a specified window previously hidden.
 int WinWait(java.lang.String szTitle, java.lang.String szText, int nTimeout)
          Documentation for: WinWait This function will pause until the specified window exists (or the function times out).
 int WinWaitActive(java.lang.String szTitle, java.lang.String szText, int nTimeout)
          Documentation for: WinWaitActive This function will pause until the specified window is active (or the function times out).
 int WinWaitClose(java.lang.String szTitle, java.lang.String szText, int nTimeout)
          Documentation for: WinWaitClose This function will pause until the specified window doesn't exist (or the function times out).
 int WinWaitNotActive(java.lang.String szTitle, java.lang.String szText, int nTimeout)
          Documentation for: WinWaitNotActive This function will pause until the specified window is not active (or the function times out).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AutoIt

public AutoIt()
Method Detail

Close

public void Close()
Documentation for: Close Closes down AutoIt. This function is called automatically when the DLL is unloaded.


Init

public void Init()
Documentation for: Init Resets AutoIt to defaults (window delays, key delays, etc.). This function is called automatically when the DLL is loaded.


Shutdown

public void Shutdown(int nFlag)
Documentation for: Shutdown This function can perform various types of shutdown on all Windows operating systems. The value of nFlag can be a combination of the flags below: Function
Log off the current user 0
Shutdown the workstation 1
Reboot the workstation 2
Force closing of applications (may lose unsaved work) 4
Shutdown and power off (if supported) 8 i.e. To shutdown and reboot, the value of nFlag would be 3.

Parameters:
nFlag - A combination of the flags given in the remarks section.

Sleep

public void Sleep(int nMilliseconds)
Documentation for: Sleep This function simply pauses for an amount of time.

Parameters:
nMilliseconds - The amount of time to sleep in milliseconds. (Note: 1000 milliseconds = 1 second)

BlockInput

public void BlockInput(int nToggle)
Documentation for: BlockInput Will prevent any user input via the mouse or keyboard. This function will have different effects depending on the operating system used:. Operating System "BlockInput" Results
Windows 95 No effect.
Windows 98 User input is blocked but AutoIt is also unable to simulate input.
Windows NT 4 (Without ServicePack 6) No effect.
Windows NT 4 (With ServicePack 6) User input is blocked and AutoIt can simulate input.
Windows 2000 User input is blocked and AutoIt can simulate input.

Parameters:
nToggle - This should be set to 1 to block input, and 0 to enable input.

LeftClick

public void LeftClick(int nX,
                      int nY)
Documentation for: LeftClick Simulates a mouse left-click at a given coordinate. The X and Y co-ordinates are relative to the currently active window. Run the full version of AutoIt in reveal mode to determine the required co-ordinates of a window. To perform a double-click, simply run the command twice :)

Parameters:
nX - X coordinate.
nY - Y coordinate.

LeftClickDrag

public void LeftClickDrag(int nX1,
                          int nY1,
                          int nX2,
                          int nY2)
Documentation for: LeftClickDrag Simulates a mouse left-click-drag operation. The X and Y co-ordinates are relative to the currently active window. Run the full version of AutoIt in reveal mode to determine the required co-ordinates of a window.

Parameters:
nX1 - X1 coordinate (from coordinate).
nY1 - Y1 coordinate (from coordinate).
nX2 - X2 coordinate (to coordinate).
nY2 - Y2 coordinate (to coordinate).

MouseMove

public void MouseMove(int nX,
                      int nY)
Documentation for: MouseMove Moves the mouse pointer to the specified coordinates. The X and Y co-ordinates are relative to the currently active window. Run the full version of AutoIt in reveal mode to determine the required co-ordinates of a window. @param nX X coordinate.

Parameters:
nY - Y coordinate.

MouseGetPosX

public int MouseGetPosX()
Documentation for: MouseGetPosX Gets the X coordinate of the mouse pointer. The X and Y co-ordinates are relative to the currently active window. Run the full version of AutoIt in reveal mode to determine the required co-ordinates of a window.


MouseGetPosY

public int MouseGetPosY()
Documentation for: MouseGetPosY Gets the Y coordinate of the mouse pointer. The X and Y co-ordinates are relative to the currently active window. Run the full version of AutoIt in reveal mode to determine the required co-ordinates of a window.


RightClick

public void RightClick(int nX,
                       int nY)
Documentation for: RightClick Simulates a mouse right-click at a given coordinate. The X and Y co-ordinates are relative to the currently active window. Run the full version of AutoIt in reveal mode to determine the required co-ordinates of a window. To perform a double-click, simply run the command twice :)

Parameters:
nX - X coordinate.
nY - Y coordinate.

RightClickDrag

public void RightClickDrag(int nX1,
                           int nY1,
                           int nX2,
                           int nY2)
Documentation for: RightClickDrag Simulates a mouse right-click-drag operation. The X and Y co-ordinates are relative to the currently active window. Run the full version of AutoIt in reveal mode to determine the required co-ordinates of a window.

Parameters:
nX1 - X1 coordinate (from coordinate).
nY1 - Y1 coordinate (from coordinate).
nX2 - X2 coordinate (to coordinate).
nY2 - Y2 coordinate (to coordinate).

Send

public void Send(java.lang.String szLine)
Documentation for: Send Set an error message. The Error subroutine will add the string value passed by the calling program to the Error File and then terminate the calling program. The "Send" command syntax is similar to that of ScriptIt and the Visual Basic "SendKeys" command. Characters are sent as written with the exception of the following characters: !' This tells AutoIt to send an ALT keystroke, therefore Send "This is text!a" would send the keys "This is text" and then press "ALT+a". N.B. Some programs are very choosy about capital letters and ALT keys, i.e. "!A" is different to "!a". The first says ALT+SHIFT+A, the second is ALT+a. If in doubt, use lowercase! +' This tells AutoIt to send a SHIFT keystroke, therefore Send "Hell+o" would send the text "HellO". Send "!+a" would send "ALT+SHIFT+a". ^' This tells AutoIt to send a CONTROL keystroke, therefore Send "^!a" would send "CTRL+ALT+a". N.B. Some programs are very choosy about capital letters and CTRL keys, i.e. "^A" is different to "^a". The first says CTRL+SHIFT+A, the second is CTRL+a. If in doubt, use lowercase! #' The hash is used as a key delimiter to make a line easier to read. i.e. Send "H#e#l#l#o" is the same as Send "Hello". Certain special keys can be sent and should be enclosed in braces:

Parameters:
szLine - A string pointer to the set of keystrokes to send.

SetCapslockState

public void SetCapslockState(int nToggle)
Documentation for: SetCapslockState This command will correctly set the state of the CAPSLOCK key to either on or off.

Parameters:
nToggle - This should be set to 1 to set capslock to ON, and 0 to set capslock to OFF.

SetKeyDelay

public void SetKeyDelay(int nDelay)
Documentation for: SetKeyDelay This functions will alter the amount of time that AutoIt pauses between each simulated keypress.

Parameters:
nDelay - This functions will alter the amount of time that AutoIt pauses between each simulated keypress.

SetStoreCapslockMode

public void SetStoreCapslockMode(int nToggle)
Documentation for: SetStoreCapslockMode By default, at the start of a "Send" command AutoIt will store the state of the CAPSLOCK key; at the end of the "Send" command this status will be restored. Use this command to turn off this behaviour.

Parameters:
nToggle - This should be set to 1 to store/restore the capslock at the start/end of a send command, and 0 to ignore capslock state. (Default is 1).

DetectHiddenText

public void DetectHiddenText(int nToggle)
Documentation for: DetectHiddenText Some programs use hidden text on windows this can cause problems when trying to script them. This command allows you to tell AutoIt whether or not to detect this hidden text. When you use the "/reveal" mode of the full AutoIt product, you will see all text, including hidden text.

Parameters:
nToggle - This should be set to 1 to enable hidden text detection, and 0 to disable. (Default is 0)

IfWinActive

public int IfWinActive(java.lang.String szTitle,
                       java.lang.String szText)
Documentation for: IfWinActive Checks if a given window is currently active. Returns 1 if the given window was active, otherwise it returns 0.

Parameters:
szTitle - A string pointer to the title of the window to match.
szText - A string pointer to the text of the window to match.

IfWinExist

public int IfWinExist(java.lang.String szTitle,
                      java.lang.String szText)
Documentation for: IfWinExist Checks if a given window current exists (in any state). Returns 1 if the given window exists (regardless of its state), otherwise it returns 0.

Parameters:
szTitle - A string pointer to the title of the window to match.
szText - A string pointer to the text of the window to match.

SetTitleMatchMode

public void SetTitleMatchMode(int nMode)
Documentation for: SetTitleMatchMode This function will alter the way that AutoIt matches window titles in functions such as WinWait, IfWinActive, etc.

mode 1: In the szTitle string you specify the start of a window title to match. i.e. for the notepad.exe window (Untitled - Notepad), valid matches would be: Untitled", "Untitled -", "Unt" and "Untitled - Notepad".

mode 2: In the szTitle string you can specify ANY substring of the window title you want to match. Again for the notepad.exe window valid matches would be: Untitled", "Untitled - Notepad", "Notepad", "No".

Parameters:
nMode - The mode of title matching to use -- see the remarks. Valid modes are 1 and 2. (Default is 1).

SetWinDelay

public void SetWinDelay(int nDelay)
Documentation for: SetWinDelay This functions will alter the amount of time that AutoIt pauses after performing a WinWait-type function.

Parameters:
nDelay - The value in milliseconds pause after a WinWait-related function. (Default 500ms).

WinActivate

public void WinActivate(java.lang.String szTitle,
                        java.lang.String szText)
Documentation for: WinActivate This function will activate a specified window.

Parameters:
szTitle - A string pointer to the title of the window to match.
szText - A string pointer to the text of the window to match.

WinClose

public void WinClose(java.lang.String szTitle,
                     java.lang.String szText)
Documentation for: WinClose This function will close a specified window

Parameters:
szTitle - A string pointer to the title of the window to match.
szText - A string pointer to the text of the window to match.

WinGetActiveTitle

public void WinGetActiveTitle(AutoIt.ByReferenceString szTitle)
Documentation for: WinGetActiveTitle A string pointer to receive the window title.

Parameters:
szTitle - A string pointer to receive the window title.

WinHide

public void WinHide(java.lang.String szTitle,
                    java.lang.String szText)
Documentation for: WinHide This function will hide a specified window.

Parameters:
szTitle - A string pointer to the title of the window to match.
szText - A string pointer to the text of the window to match.

WinKill

public void WinKill(java.lang.String szTitle,
                    java.lang.String szText)
Documentation for: WinKill This function will forceably close a specified window.

Parameters:
szTitle - A string pointer to the title of the window to match.
szText - A string pointer to the text of the window to match.

WinMaximize

public void WinMaximize(java.lang.String szTitle,
                        java.lang.String szText)
Documentation for: WinMaximize This function will maximize a specified window.

Parameters:
szTitle - A string pointer to the title of the window to match.
szText - A string pointer to the text of the window to match.

WinMinimize

public void WinMinimize(java.lang.String szTitle,
                        java.lang.String szText)
Documentation for: WinMinimize This function will minimize a specified window.

Parameters:
szTitle - A string pointer to the title of the window to match.
szText - A string pointer to the text of the window to match.

WinMinimizeAll

public void WinMinimizeAll()
Documentation for: WinMinimizeAll This function will minimize all windows.


WinMinimizeAllUndo

public void WinMinimizeAllUndo()
Documentation for: WinMinimizeAllUndo This function will undo a previous WinMinimizeAll call.


WinMove

public void WinMove(java.lang.String szTitle,
                    java.lang.String szText,
                    int nX,
                    int nY,
                    int nWidth,
                    int nHeight)
Documentation for: WinMove Use this function to move/resize a specified window.

Parameters:
szTitle - A string pointer to the title of the window to match.
szText - A string pointer to the text of the window to match.
nX - X coordinate.
nY - Y coordinate.
nWidth - New width of the window (use -1 to leave the size alone)
nHeight - New height of the window (use -1 to leave the size alone)

WinRestore

public void WinRestore(java.lang.String szTitle,
                       java.lang.String szText)
Documentation for: WinRestore This function will restore a window from a minimized state.

Parameters:
szTitle - A string pointer to the title of the window to match.
szText - A string pointer to the text of the window to match.

WinSetTitle

public void WinSetTitle(java.lang.String szTitle,
                        java.lang.String szText,
                        java.lang.String szNewTitle)
Documentation for: WinSetTitle Changes the title of a specified window.

Parameters:
szTitle - A string pointer to the title of the window to match.
szText - A string pointer to the text of the window to match.
szNewTitle - A string pointer to the text of the new window title.

WinShow

public void WinShow(java.lang.String szTitle,
                    java.lang.String szText)
Documentation for: WinShow This function will show a specified window previously hidden.

Parameters:
szTitle - A string pointer to the title of the window to match.
szText - A string pointer to the text of the window to match.

WinWait

public int WinWait(java.lang.String szTitle,
                   java.lang.String szText,
                   int nTimeout)
Documentation for: WinWait This function will pause until the specified window exists (or the function times out).

Parameters:
szTitle - A string pointer to the title of the window to match.
szText - A string pointer to the text of the window to match.
nTimeout - Specifies the number of seconds to wait for. Use the value 0 to wait indefinitely.

WinWaitActive

public int WinWaitActive(java.lang.String szTitle,
                         java.lang.String szText,
                         int nTimeout)
Documentation for: WinWaitActive This function will pause until the specified window is active (or the function times out).

Parameters:
szTitle - A string pointer to the title of the window to match.
szText - A string pointer to the text of the window to match.
nTimeout - Specifies the number of seconds to wait for. Use the value 0 to wait indefinitely.

WinWaitNotActive

public int WinWaitNotActive(java.lang.String szTitle,
                            java.lang.String szText,
                            int nTimeout)
Documentation for: WinWaitNotActive This function will pause until the specified window is not active (or the function times out).

Parameters:
szTitle - A string pointer to the title of the window to match.
szText - A string pointer to the text of the window to match.
nTimeout - Specifies the number of seconds to wait for. Use the value 0 to wait indefinitely.

WinWaitClose

public int WinWaitClose(java.lang.String szTitle,
                        java.lang.String szText,
                        int nTimeout)
Documentation for: WinWaitClose This function will pause until the specified window doesn't exist (or the function times out).

Parameters:
szTitle - A string pointer to the title of the window to match.
szText - A string pointer to the text of the window to match.
nTimeout - Specifies the number of seconds to wait for. Use the value 0 to wait indefinitely.

IniDelete

public void IniDelete(java.lang.String szFile,
                      java.lang.String szSection,
                      java.lang.String szValue)
Documentation for: IniDelete Deletes a specified value from a standard .INI file.

An INI file is taken to be a file of the following format:

    [SectionName]
    Value=Result
  
The full path of the INI file must be given, however, it is acceptable to use something similar to ".\myfile.ini" to indicate a file in the current working directory.

See also IniRead, IniWrite

Parameters:
szFile - A string pointer to the filename of the .INI file.
szSection - A string pointer to the required section of the .INI file.
szValue - A string pointer to the value to delete.

IniRead

public void IniRead(java.lang.String szFile,
                    java.lang.String szSection,
                    java.lang.String szValue,
                    AutoIt.ByReferenceString szResult)
Documentation for: IniRead Reads a specified value from a standard .INI file.

Parameters:
szFile - A string pointer to the filename of the .INI file.
szSection - A string pointer to the required section of the .INI file.
szValue - A string pointer to the value to read.
szResult - A string pointer to receive the result.

IniWrite

public void IniWrite(java.lang.String szFile,
                     java.lang.String szSection,
                     java.lang.String szValue,
                     java.lang.String szResult)
Documentation for: IniWrite Write a specified value to a standard .INI file.

An INI file is taken to be a file of the following format:

    [SectionName]
    Value=Result
  
The full path of the INI file must be given, however, it is acceptable to use something similar to ".\myfile.ini" to indicate a file in the current working directory.

Parameters:
szFile - A string pointer to the filename of the .INI file.
szSection - A string pointer to the required section of the .INI file.
szValue - A string pointer to the value to read.
szResult - A string pointer to result to write.

ClipGet

public void ClipGet(AutoIt.ByReferenceString szText)
Documentation for: ClipGet Allows you to get text from the clipboard. A maximum of 4096 characters of text can be received; ensure that the text buffer you pass is at least this large.

Parameters:
szText - A pointer to a string buffer that will receive the text from the clipboard.

ClipPut

public void ClipPut(java.lang.String szText)
Documentation for: ClipPut Allows you to get text from the clipboard. A maximum of 4096 characters of text can be received; ensure that the text buffer you pass is at least this large.

Parameters:
szText - A pointer to a string buffer that contains the text you want to send.