Alphabetical Command and Function Index

Click on a command or function name for details. Entries in large font are the most commonly used.

Go to entries starting with: E,   I,   M,   S,   W,   #

Name Description
{ ... } (Block) Blocks are one or more statements enclosed in braces. Typically used with function definitions and control flow statements.
{ ... } / Object() Creates a scriptable associative array.
[ ... ] / Array() Creates a scriptable associative array with integer keys.
Abs() Returns the absolute value of the specified number.
AutoTrim Determines whether traditional assignments like Var1 = %Var2% omit spaces and tabs from the beginning and end of Var2.
Asc() Returns the numeric value of the first byte or UTF-16 code unit in the specified string.
ASin() Returns the arcsine (the number whose sine is the specified number) in radians.
ACos() Returns the arccosine (the number whose cosine is the specified number) in radians.
ATan() Returns the arctangent (the number whose tangent is the specified number) in radians.
BlockInput Disables or enables the user's ability to interact with the computer via keyboard and mouse.
Break Exits (terminates) any type of loop statement.
Catch Specifies the code to execute if an exception is raised during execution of a try statement.
Ceil() Returns the specified number rounded up to the nearest integer (without any .00 suffix).
Chr() Returns the string (usually a single character) corresponding to the character code indicated by the specified number.
Click Clicks a mouse button at the specified coordinates. It can also hold down a mouse button, turn the mouse wheel, or move the mouse.
ClipWait Waits until the clipboard contains data.
ComObjActive() Retrieves a registered COM object.
ComObjArray() Creates a SafeArray for use with COM.
ComObjConnect() Connects a COM object's event sources to functions with a given prefix.
ComObjCreate() Creates a COM object.
ComObject() Creates an object representing a typed value to be passed as a parameter or return value.
ComObjEnwrap() / ComObjUnwrap() Wraps/unwraps a COM object.
ComObjError() Enables or disables notification of COM errors.
ComObjFlags() Retrieves or changes flags which control a COM wrapper object's behaviour.
ComObjGet() Returns a reference to an object provided by a COM component.
ComObjMissing() Creates a "missing parameter" object to pass to a COM method.
ComObjParameter() Wraps a value and type to pass as a parameter to a COM method.
ComObjQuery() Queries a COM object for an interface or service.
ComObjType() Retrieves type information from a COM object.
ComObjValue() Retrieves the value or pointer stored in a COM wrapper object.
Continue Skips the rest of a loop statement's current iteration and begins a new one.
Control Makes a variety of changes to a control.
ControlClick Sends a mouse button or mouse wheel event to a control.
ControlFocus Sets input focus to a given control on a window.
ControlGet Retrieves various types of information about a control.
ControlGetFocus Retrieves which control of the target window has input focus, if any.
ControlGetPos Retrieves the position and size of a control.
ControlGetText Retrieves text from a control.
ControlMove Moves or resizes a control.
ControlSend / ControlSendRaw Sends simulated keystrokes to a window or control.
ControlSetText Changes the text of a control.
CoordMode Sets coordinate mode for various commands to be relative to either the active window or the screen.
Cos() Returns the trigonometric cosine of the specified number.
Critical Prevents the current thread from being interrupted by other threads, or enables it to be interrupted.
DetectHiddenText Determines whether invisible text in a window is "seen" for the purpose of finding the window. This affects commands, built-in functions and control flow statements such as WinExist() and WinActivate.
DetectHiddenWindows Determines whether invisible windows are "seen" by the script.
DllCall() Calls a function inside a DLL, such as a standard Windows API function.
Drive Ejects/retracts the tray in a CD or DVD drive, or sets a drive's volume label.
DriveGet Retrieves various types of information about the computer's drive(s).
DriveSpaceFree Retrieves the free disk space of the drive which contains the specified path, in megabytes.
Edit Opens the current script for editing in the associated editor.
Else Specifies one or more statements to execute if an If statement evaluates to false.
EnvAdd Sets a variable to the sum of itself plus the given value (can also add or subtract time from a date-time value). Synonymous with: Var += Value.
EnvDiv Sets a variable to itself divided by the given value. Synonymous with: Var /= Value.
EnvGet Retrieves an environment variable.
EnvMult Sets a variable to itself times the given value. Synonymous with: Var *= Value.
EnvSet Writes a value to a variable contained in the environment.
EnvSub Sets a variable to itself minus the given value (can also compare date-time values). Synonymous with: Var -= Value.
EnvUpdate Notifies the OS and all running applications that environment variable(s) have changed.
Exception() Creates an object with properties, also common to exceptions created by runtime errors.
Exit Exits the current thread or (if the script is not persistent) the entire script.
ExitApp Terminates the script.
Exp() Returns e (which is approximately 2.71828182845905) raised to the Nth power.
FileAppend Writes text to the end of a file (first creating the file, if necessary).
FileCopy Copies one or more files.
FileCopyDir Copies a folder along with all its sub-folders and files (similar to xcopy).
FileCreateDir Creates a folder.
FileCreateShortcut Creates a shortcut (.lnk) file.
FileDelete Deletes one or more files.
FileEncoding Sets the default encoding for FileRead, FileReadLine, Loop Read, FileAppend, and FileOpen().
FileExist() Checks for the existence of a file or folder and returns its attributes.
FileInstall Includes the specified file inside the compiled version of the script.
FileGetAttrib Reports whether a file or folder is read-only, hidden, etc.
FileGetShortcut Retrieves information about a shortcut (.lnk) file, such as its target file.
FileGetSize Retrieves the size of a file.
FileGetTime Retrieves the datetime stamp of a file or folder.
FileGetVersion Retrieves the version of a file.
FileMove Moves or renames one or more files.
FileMoveDir Moves a folder along with all its sub-folders and files. It can also rename a folder.
FileOpen() Opens a file to read specific content from it and/or to write new content into it.
FileRead Reads a file's contents into a variable.
FileReadLine Reads the specified line from a file and stores the text in a variable.
FileRecycle Sends a file or directory to the recycle bin if possible, or permanently deletes it.
FileRecycleEmpty Empties the recycle bin.
FileRemoveDir Deletes a folder.
FileSelectFile Displays a standard dialog that allows the user to open or save file(s).
FileSelectFolder

Displays a standard dialog that allows the user to select a folder.

FileSetAttrib Changes the attributes of one or more files or folders. Wildcards are supported.
FileSetTime Changes the datetime stamp of one or more files or folders. Wildcards are supported.
Finally Ensures that one or more statements are always executed after a Try statement finishes.
Floor() Returns the specified number rounded down to the nearest integer (without any .00 suffix).
For Repeats a series of commands once for each key-value pair in an object.
Format() Formats a variable number of input values according to a format string.
FormatTime Transforms a YYYYMMDDHH24MISS timestamp into the specified date/time format.
Func() Retrieves a reference to a function.
GetKeyName() Retrieves the name or text of a key.
GetKeyVK() Retrieves the virtual key code of a key.
GetKeySC() Retrieves the scan code of a key.
GetKeyState Checks if a keyboard key or mouse/joystick button is down or up. Also retrieves joystick status.
GetKeyState() Checks if a keyboard key or mouse/joystick button is down or up. Also retrieves joystick status.
Gosub Jumps to the specified label and continues execution until Return is encountered.
Goto Jumps to the specified label and continues execution.
GroupActivate Activates the next window in a window group that was defined with GroupAdd.
GroupAdd Adds a window specification to a window group, creating the group if necessary.
GroupClose Closes the active window if it was just activated by GroupActivate or GroupDeactivate. It then activates the next window in the series. It can also close all windows in a group.
GroupDeactivate Similar to GroupActivate except activates the next window not in the group.
Gui Creates and manages windows and controls. Such windows can be used as data entry forms or custom user interfaces.
GuiControl Makes a variety of changes to a control in a GUI window.
GuiControlGet Retrieves various types of information about a control in a GUI window.
Hotkey Creates, modifies, enables, or disables a hotkey while the script is running.
Hotstring() Creates, modifies, enables, or disables a hotstring while the script is running.
If (expression) Specifies one or more statements to execute if an expression evaluates to true.
If (legacy) Specifies one or more statements to execute if the comparison of a variable to a value evaluates to true.
If var [not] between Checks whether a variable's contents are numerically or alphabetically between two values (inclusive).
If var [not] in/contains MatchList Checks whether a variable's contents match one of the items in a list.
If var is [not] type Checks whether a variable's contents are numeric, uppercase, etc.
IfEqual / IfNotEqual Compares a variable to a value for equality. Synonymous with: if Var = Value | if Var != Value.
IfExist / IfNotExist Checks for the existence of a file or folder.
IfGreater / IfGreaterOrEqual Compares a variable to a value. Synonymous with: if Var > Value | if Var >= Value.
IfInString / IfNotInString Checks if a variable contains the specified string.
IfLess / IfLessOrEqual Compares a variable to a value. Synonymous with: if Var < Value | if Var <= Value.
IfMsgBox Checks which button was pushed by the user during the most recent MsgBox command.
IfWinActive / IfWinNotActive Checks if the specified window exists and is currently active (foremost).
IfWinExist / IfWinNotExist Checks if the specified window exists.
IL_Create()
IL_Add()
IL_Destroy()
The means by which icons are added to a ListView or TreeView control.
ImageSearch Searches a region of the screen for an image.
IniDelete Deletes a value from a standard format .ini file.
IniRead Reads a value, section or list of section names from a standard format .ini file.
IniWrite Writes a value or section to a standard format .ini file.
Input Waits for the user to type a string.
InputBox Displays an input box to ask the user to enter a string.
InputHook() Creates an object which can be used to collect or intercept keyboard input.
InStr() Searches for a given occurrence of a string, from the left or the right.
IsByRef() Returns a non-zero number if the specified ByRef parameter was supplied with a variable.
IsFunc() Returns a non-zero number if the specified function exists in the script.
IsLabel() Returns a non-zero number if the specified label exists in the script.
IsObject() Returns a non-zero number if the specified value is an object.
IsSet() Returns a non-zero number if the specified variable has been assigned a value.
KeyHistory Displays script info and a history of the most recent keystrokes and mouse clicks.
KeyWait Waits for a key or mouse/joystick button to be released or pressed down.
ListHotkeys Displays the hotkeys in use by the current script, whether their subroutines are currently running, and whether or not they use the keyboard or mouse hook.
ListLines Displays the script lines most recently executed.
ListVars Displays the script's variables: their names and current contents.
LoadPicture() Loads a picture from file and returns a bitmap or icon handle.
Log() Returns the logarithm (base 10) of the specified number.
Ln() Returns the natural logarithm (base e) of the specified number.
Loop (normal) Performs a series of commands repeatedly: either the specified number of times or until break is encountered.
Loop (files & folders) Retrieves the specified files or folders, one at a time.
Loop (parse a string) Retrieves substrings (fields) from a string, one at a time.
Loop (read file contents) Retrieves the lines in a text file, one at a time (performs better than FileReadLine).
Loop (registry) Retrieves the contents of the specified registry subkey, one item at a time.
LV_Add()
LV_Delete()
LV_DeleteCol()
LV_GetCount()
LV_GetNext()
LV_GetText()
LV_Insert()
LV_InsertCol()
LV_Modify()
LV_ModifyCol()
LV_SetImageList()
The means by which the rows and columns of a ListView control are added, modified or retrieved.
Max() Returns the highest value of one or more numbers.
Menu Creates, deletes, modifies and displays menus and menu items. Changes the tray icon and its tooltip. Controls whether the main window of a compiled script can be opened.
MenuGetHandle() Retrieves the Win32 menu handle of a menu.
MenuGetName() Retrieves the name of a menu given a handle to its underlying Win32 menu.
Min() Returns the lowest value of one or more numbers.
Mod() Modulo. Returns the remainder of the specified dividend divided by the specified divisor.
MouseClick Clicks or holds down a mouse button, or turns the mouse wheel. NOTE: The Click command is generally more flexible and easier to use.
MouseClickDrag Clicks and holds the specified mouse button, moves the mouse to the destination coordinates, then releases the button.
MouseGetPos Retrieves the current position of the mouse cursor, and optionally which window and control it is hovering over.
MouseMove Moves the mouse cursor.
MsgBox Displays the specified text in a small window containing one or more buttons (such as Yes and No).
NumGet() Returns the binary number stored at the specified address+offset.
NumPut() Stores a number in binary format at the specified address+offset.
ObjAddRef() / ObjRelease() Increments or decrements an object's reference count.
ObjBindMethod() Creates a BoundFunc object which calls a method of a given object.
ObjClone()
ObjCount()
ObjDelete()
ObjGetAddress()
ObjGetCapacity()
ObjHasKey()
ObjInsert()
ObjInsertAt()
ObjLength()
ObjMaxIndex()
ObjMinIndex()
ObjNewEnum()
ObjPop()
ObjPush()
ObjRemove()
ObjRemoveAt()
ObjSetCapacity()
These functions are equivalent to built-in methods of the Object type. It is usually recommended to use the corresponding method instead.
ObjGetBase() Retrieves an object's base object.
ObjRawGet() Retrieves a key-value pair from an object, bypassing the object's meta-functions.
ObjRawSet() Stores or overwrites a key-value pair in an object, bypassing the object's meta-functions.
ObjSetBase() Sets an object's base object.
OnClipboardChange() Registers a function or function object to run whenever the clipboard's content changes.
OnError() Specifies a function to run automatically when an unhandled error occurs.
OnExit Specifies a subroutine to run automatically when the script exits.
OnExit() Specifies a callback function to run automatically when the script exits.
OnMessage() Specifies a function or function object to call automatically when the script receives the specified message.
Ord() Returns the ordinal value (numeric character code) of the first character in the specified string.
OutputDebug Sends a string to the debugger (if any) for display.
Pause Pauses the script's current thread.
PixelGetColor Retrieves the color of the pixel at the specified x,y coordinates.
PixelSearch Searches a region of the screen for a pixel of the specified color.
PostMessage Places a message in the message queue of a window or control.
Process Performs one of the following operations on a process: checks if it exists; changes its priority; closes it; waits for it to close.
Progress Creates or updates a window containing a progress bar.
Random Generates a pseudo-random number.
RegExMatch() Determines whether a string contains a pattern (regular expression).
RegExReplace() Replaces occurrences of a pattern (regular expression) inside a string.
RegDelete Deletes a subkey or value from the registry.
RegRead Reads a value from the registry.
RegWrite Writes a value to the registry.
RegisterCallback() Creates a machine-code address that when called, redirects the call to a function in the script.
Reload Replaces the currently running instance of the script with a new one.
Return Returns from a subroutine to which execution had previously jumped via function-call, Gosub, Hotkey activation, GroupActivate, or other means.
Round() Returns the specified number rounded to N decimal places.
Run Runs an external program.
RunAs Specifies a set of user credentials to use for all subsequent uses of Run and RunWait.
RunWait Runs an external program and waits until it finishes.
SB_SetIcon()
SB_SetParts()
SB_SetText()
The means by which the bar of a StatusBar control is modified.
Send / SendRaw / SendInput / SendPlay / SendEvent Sends simulated keystrokes and mouse clicks to the active window.
SendLevel Controls which artificial keyboard and mouse events are ignored by hotkeys and hotstrings.
SendMessage Sends a message to a window or control and waits for acknowledgement.
SendMode Makes Send synonymous with SendInput or SendPlay rather than the default (SendEvent). Also makes Click and MouseMove/Click/Drag use the specified method.
SetBatchLines Determines how fast a script will run (affects CPU utilization).
SetCapsLockState Sets the state of CapsLock. Can also force the key to stay on or off.
SetControlDelay Sets the delay that will occur after each control-modifying command.
SetDefaultMouseSpeed Sets the mouse speed that will be used if unspecified in Click and MouseMove/Click/Drag.
SetEnv (Var = Value) Assigns the specified value to a variable.
SetFormat Sets the format of integers and floating point numbers generated by math operations.
SetKeyDelay Sets the delay that will occur after each keystroke sent by Send or ControlSend.
SetMouseDelay Sets the delay that will occur after each mouse movement or click.
SetNumLockState Sets the state of NumLock. Can also force the key to stay on or off.
SetScrollLockState Sets the state of ScrollLock. Can also force the key to stay on or off.
SetRegView Sets the registry view used by RegRead, RegWrite, RegDelete and registry loops, allowing them in a 32-bit script to access the 64-bit registry view and vice versa.
SetStoreCapsLockMode Whether to restore the state of CapsLock after a Send.
SetTimer Causes a subroutine to be launched automatically and repeatedly at a specified time interval.
SetTitleMatchMode Sets the matching behavior of the WinTitle parameter in commands such as WinWait.
SetWinDelay Sets the delay that will occur after each windowing command, such as WinActivate.
SetWorkingDir Changes the script's current working directory.
Shutdown Shuts down, restarts, or logs off the system.
Sin() Returns the trigonometric sine of the specified number.
Sleep Waits the specified amount of time before continuing.
Sort Arranges a variable's contents in alphabetical, numerical, or random order (optionally removing duplicates).
SoundBeep Emits a tone from the PC speaker.
SoundGet Retrieves various settings of a sound device (master mute, master volume, etc.)
SoundGetWaveVolume Retrieves the wave output volume of a sound device.
SoundPlay Plays a sound, video, or other supported file type.
SoundSet Changes various settings of a sound device (master mute, master volume, etc.)
SoundSetWaveVolume Changes the wave output volume of a sound device.
SplashImage Creates or updates a window containing an image.
SplashTextOn / SplashTextOff Creates or removes a customizable text popup window.
SplitPath Separates a file name or URL into its name, directory, extension, and drive.
Sqrt() Returns the square root of the specified number.
StatusBarGetText Retrieves the text from a standard status bar control.
StatusBarWait Waits until a window's status bar contains the specified string.
StrGet() Copies a string from a memory address, optionally converting it from a given code page.
StringCaseSense Determines whether string comparisons are case sensitive (default is "not case sensitive").
StringGetPos Retrieves the position of the specified substring within a string.
StringLeft Retrieves a number of characters from the left-hand side of a string.
StringLen Retrieves the count of how many characters are in a string.
StringLower Converts a string to lowercase.
StringMid Retrieves one or more characters from the specified position in a string.
StringReplace Replaces the specified substring with a new string.
StringRight Retrieves a number of characters from the right-hand side of a string.
StringSplit Separates a string into an array of substrings using the specified delimiters.
StringTrimLeft Removes a number of characters from the left-hand side of a string.
StringTrimRight Removes a number of characters from the right-hand side of a string.
StringUpper Converts a string to uppercase.
StrLen() Retrieves the count of how many characters are in a string.
StrPut() Copies a string to a memory address, optionally converting it to a given code page.
StrReplace() Replaces the specified substring with a new string.
StrSplit() Separates a string into an array of substrings using the specified delimiters.
SubStr() Retrieves one or more characters from the specified position in a string.
Suspend Disables or enables all or selected hotkeys and hotstrings.
Switch Executes one case from a list of mutually exclusive candidates.
SysGet Retrieves screen resolution, multi-monitor info, dimensions of system objects, and other system properties.
Tan() Returns the trigonometric tangent of the specified number.
Thread Sets the priority or interruptibility of threads. It can also temporarily disable all timers.
Throw Signals the occurrence of an error. This signal can be caught by a try-catch statement.
ToolTip Creates an always-on-top window anywhere on the screen.
Transform Performs miscellaneous math functions, bitwise operations, and tasks such as ASCII/Unicode conversion.
TrayTip Creates a balloon message window near the tray icon. On Windows 10, a toast notification may be shown instead.
Trim() / LTrim() / RTrim() Trims characters from the beginning and/or end of a string.
Try Guards one or more statements (commands or expressions) against runtime errors and exceptions thrown by the throw command.
TV_Add()
TV_Delete()
TV_Get()
TV_GetChild()
TV_GetCount()
TV_GetNext()
TV_GetParent()
TV_GetPrev()
TV_GetSelection()
TV_GetText()
TV_Modify()
TV_SetImageList()
The means by which the items of a TreeView control are added, modified or retrieved.
Until Applies a condition to the continuation of a Loop or For-loop.
UrlDownloadToFile Downloads a file from the Internet.
Var = Value Assigns the specified value to a variable.
Var := expression Evaluates an expression and stores the result in a variable.
VarSetCapacity() Enlarges a variable's holding capacity or frees its memory. Normally, this is necessary only for unusual circumstances such as DllCall().
While-loop Performs a series of commands repeatedly until the specified expression evaluates to false.
WinActivate Activates the specified window.
WinActivateBottom Same as WinActivate except that it activates the bottommost matching window rather than the topmost.
WinActive() Checks if the specified window is active and returns its unique ID (HWND).
WinClose Closes the specified window.
WinExist() Checks if the specified window exists and returns the unique ID (HWND) of the first matching window.
WinGetActiveStats Combines the functions of WinGetActiveTitle and WinGetPos into one command.
WinGetActiveTitle Retrieves the title of the active window.
WinGetClass Retrieves the specified window's class name.
WinGet Retrieves the specified window's unique ID, process ID, process name, or a list of its controls. It can also retrieve a list of all windows matching the specified criteria.
WinGetPos Retrieves the position and size of the specified window.
WinGetText Retrieves the text from the specified window.
WinGetTitle Retrieves the title of the specified window.
WinHide Hides the specified window.
WinKill Forces the specified window to close.
WinMaximize Enlarges the specified window to its maximum size.
WinMenuSelectItem Invokes a menu item from the menu bar of the specified window.
WinMinimize Collapses the specified window into a button on the task bar.
WinMinimizeAll / WinMinimizeAllUndo Minimizes or unminimizes all windows.
WinMove Changes the position and/or size of the specified window.
WinRestore Unminimizes or unmaximizes the specified window if it is minimized or maximized.
WinSet Makes a variety of changes to the specified window, such as "always on top" and transparency.
WinSetTitle Changes the title of the specified window.
WinShow Unhides the specified window.
WinWait Waits until the specified window exists.
WinWaitActive / WinWaitNotActive Waits until the specified window is active or not active.
WinWaitClose Waits until the specified window does not exist.
#ClipboardTimeout Changes how long the script keeps trying to access the clipboard when the first attempt fails.
#CommentFlag Changes the script's comment symbol from semicolon to some other string.
#Delimiter Changes the script's command parameter delimiter from comma to some other character.
#DerefChar Changes the script's dereference symbol from percent to some other character.
#ErrorStdOut Sends any syntax error that prevents a script from launching to the standard error stream (stderr) rather than displaying a dialog.
#EscapeChar Changes the script's escape character (e.g. backslash vs. accent).
#HotkeyInterval Along with #MaxHotkeysPerInterval, specifies the rate of hotkey activations beyond which a warning dialog will be displayed.
#HotkeyModifierTimeout Affects the behavior of hotkey modifiers: Ctrl, Alt, Win, and Shift.
#Hotstring Changes hotstring options or ending characters.
#If Creates context-sensitive hotkeys and hotstrings. Such hotkeys perform a different action (or none at all) depending on the result of an expression.
#IfTimeout Sets the maximum time that may be spent evaluating a single #If expression.
#IfWinActive / #IfWinNotActive / #IfWinExist / #IfWinNotExist Creates context-sensitive hotkeys and hotstrings. Such hotkeys perform a different action (or none at all) depending on the type of window that is active or exists.
#Include / #IncludeAgain Causes the script to behave as though the specified file's contents are present at this exact position.
#InputLevel Controls which artificial keyboard and mouse events are ignored by hotkeys and hotstrings.
#InstallKeybdHook Forces the unconditional installation of the keyboard hook.
#InstallMouseHook Forces the unconditional installation of the mouse hook.
#KeyHistory Sets the maximum number of keyboard and mouse events displayed by the KeyHistory window. You can set it to 0 to disable key history.
#LTrim Enables or disables trimming of indentation in continuation sections.
#MaxHotkeysPerInterval Along with #HotkeyInterval, specifies the rate of hotkey activations beyond which a warning dialog will be displayed.
#MaxMem Sets the maximum capacity of each variable to the specified number of megabytes.
#MaxThreads Sets the maximum number of simultaneous threads.
#MaxThreadsBuffer Causes some or all hotkeys to buffer rather than ignore keypresses when their #MaxThreadsPerHotkey limit has been reached.
#MaxThreadsPerHotkey Sets the maximum number of simultaneous threads per hotkey or hotstring.
#MenuMaskKey Changes which key is used to mask Win or Alt keyup events.
#NoEnv Avoids checking empty variables to see if they are environment variables (recommended for all new scripts).
#NoTrayIcon Disables the showing of a tray icon.
#Persistent Keeps a script permanently running (that is, until the user closes it or ExitApp is encountered).
#Requires Displays an error and quits if a version requirement is not met.
#SingleInstance Determines whether a script is allowed to run again when it is already running.
#UseHook Forces the use of the hook to implement all or some keyboard hotkeys.
#Warn Enables or disables warnings for specific conditions which may indicate an error, such as a typo or missing "global" declaration.
#WinActivateForce Skips the gentle method of activating a window and goes straight to the forceful method.