StrokesPlus Forum
Table of Contents:

  1. Overview
  2. Getting Started
  3. Preferences
  4. Training Gestures
  5. Creating Actions
  6. Defining Applications
  7. Ignored Windows
  8. Variables available to all Lua scripts
  9. Action Functions

[back to top]    Overview:

StrokesPlus is a mouse gesture recognition program that allows you to automate repetitive tasks by simply drawing a gesture with your mouse or performing mouse and/or keyboard modifiers to fire off an action sequence.

Whether the action sequence you're wanting to fire uses a gesture, mouse/keyboard modifier(s), or both, you begin with pressing the selected Stroke button on your mouse. By default, the Stroke button is assigned to the right mouse button. To begin, press and hold the Stroke button and either draw the gesture or perform the mouse/keyboard modifier(s), then release the Stroke button. If the events are recognized as being tied to an action sequence, StrokesPlus will fire the action sequence.

In Figure 1 below, we're going to draw the letter R by holding down the right mouse button, drawing the gesture R, then release the right mouse button. The gesture R is assigned to an action which opens the Windows Run dialog and types "notepad" (Figure 2), presses Enter, pauses for a moment, then types "hello world" followed by pressing ALT+H (to open the Help menu in Notepad) and finally presses "a" to select About Notepad from the menu, which displays the About Notepad window (Figure 3).

Figure 1

Figure 2

Figure 3

Many of the common tasks which people choose to create action sequences for are the very mundane aspects of using Windows, such as minimizing or maximizing a window, refreshing a web page, or closing a program. But the extent to which you can leverage StrokesPlus to increase your productivity is only limited by your imagination!


[back to top]    Getting Started:

StrokesPlus comes with several gestures already trained and a variety of common action sequences already defined. To do anything other than use StrokesPlus to fire action sequences, you must right-click the StrokesPlus icon in the tray area of your taskbar, near the clock (Figure 4).

Figure 4

From this menu, you can:

  1. enter Training Mode (which can also be accomplished by middle-clicking the StrokesPlus icon)
  2. change the Stroke button
  3. enable or disable drawing of gestures on the screen
  4. disable StrokesPlus (which can also be accomplished by left-clicking the StrokesPlus icon or pressing CTRL+SHIFT+WIN+Z)
  5. Open the Ignore List window
  6. Open the Actions window (which can also be accomplished by left double-clicking the StrokesPlus icon)
  7. Open the Preferences window (which can also be accomplished by middle double-clicking the StrokesPlus icon)
  8. Reload StrokesPlus' configuration data from StrokesPlus.xml
  9. Open this Help page
  10. Exit StrokesPlus (which can also be accomplished by pressing CTRL+ALT+SHIFT+WIN+END)

[back to top]    Preferences:

Figure 5 represents the Preferences window in StrokesPlus. From this window, you can change several of StrokesPlus' features to meet your preferences.

Stroke Button - the mouse or keyboard button used to initiate firing action sequences

Ignore Key - held down before pressing the Stroke button if you do not want StrokesPlus to attempt to recognize an action. this is helpful when you want to perform some action in Windows or another application which requires using the Stroke Button. If you use a Stroke key, make sure you don't have the same key selected as the ignore key or StrokesPlus won't work.Note: See Cancel Delay below for these situations as well.

Cancel Delay - this is how long StrokesPlus waits for an action to timeout. For example, if you decided to right-click and drag some files in Windows Explorer, StrokesPlus would begin to look for action sequences to fire when you let go of the Stroke button. However, if you want StrokesPlus to stop capturing the sequence, simply keep the Stroke button held down and stop moving the mouse. After the number of milliseconds specified for Cancel Delay, StrokesPlus will stop capturing mouse and keyboard events, then replay the mouse events that occurred. In this instance, it would instantly move the mouse back to the starting position and send the right-click message, then move the mouse back to where you had it. So in this example, you would see the files attached to the mouse cursor just as you would if you had right-clicked and dragged some files in Explorer without StrokesPlus running (or if you had held the Ignore Key before pressing the right mouse button).

Stroke Style - These fields allow you to customize how StrokesPlus draws gestures on the screen. Red, Green, and Blue indicate the color combination which represent the actual color of the line. Width specifies how thick the line is. Min. Segment Length specifies the distance between drawing segments; mainly, this lets you set a minimum draw distance before S+ considers you've started drawing a Stroke. Length indicates the maximum length (trail) that StrokesPlus will draw, 0 for infinite. This doesn't affect the actual gesture being drawn, just how long the line is on the screen. Opacity affects the transparency of the line; 1 being nearly invisible and 255 being opaque (solid). Show instructs StrokesPlus whether or not to even draw the line at all.

Advanced / Experimental Options - these settings should used with caution as some of them could cause problems with StrokesPlus or other applications.

Match Precision - how finely StrokesPlus interpolates gestures to use for comparison. Default is 100 and there should be no need to change this setting.

Match Probability - the match likelihood of the drawn gesture to saved gestures. Higher makes the gesture matching more strict.

Aggressively Manage Memory - tells StrokesPlus to aggressively clean up memory at many points in the program's operation. Leave checked to ensure StrokesPlus uses the least amount of RAM while running. Uncheck if you want to let Windows manage the memory StrokesPlus uses; note that Windows is very liberal, only tidying up if other processes require memory used by other programs and available RAM has become limited.

Release/Reinitialize on Suspend/Resume - If checked, StrokesPlus will destory the tray icon and unhook the mouse and keyboard when Windows enters a suspended mode (e.g. selecting Sleep from the shutdown menu). When Windows resumes, StrokesPlus will recreate its icon and re-hook the mouse and keyboard (if S+ has not been disabled, of course).

Disable Multiple Instance Message - prevents StrokesPlus from displaying the popup message when you open more than one instance of StrokesPlus.

Disable New Gesture Message - prevents StrokesPlus from displaying the popup message when you click New to create a new gesture.

Reset Cancel Delay On Movement/Modifier - If unchecked, tells StrokesPlus to cancel gestures when the Cancel Delay is reached, regardless of mouse or keyboard activity.

Keep Gesture Draw Window On Top - always keep the transparent window to which StrokesPlus draws the gesture line on top. This can be helpful for low-power systems and prevent flickering UI elements for Windows XP users. However, there may be issues with other programs if they react to StrokesPlus' gesture window being above them. Therefore, this is an experimental feature.

Don't Hide Gesture Draw Window - when you're not drawing a gesture, the draw window is normally sent behind all other windows to increase performance and eliminate flickering and mouse lag when starting a new gesture. Uncheck this option to instruct StrokesPlus to hide the window completely. (This setting has no effect if Keep Gesture Draw Window On Top is checked.

Enable Mouse Wheel Relay - StrokesPlus will relay all mouse wheel scroll events directly to the control below the mouse cursor regardless of state. This lets you scroll controls, lists, windows which aren't active or selected by only scrolling the mouse wheel over top of them.

Fire Recognition on Mouse Wheel Scroll - StrokesPlus will attempt to recognize and fire actions when the mouse wheel is scrolled up or down (only when the Stroke button is being held down). This allows you to have actions which fire for each tick, this is helpful for volume actions, switching tabs, etc.

Capture Modifiers on Stroke Button Down* - In addition to capturing modifiers when they occur after the Stroke button is pressed, StrokesPlus will also get their state at the moment the Stroke button is pressed. So if you had the Control key held prior to pressing the Stroke button pressed (and held down at the time), the Control modifier would be recognized as part of the action definition.

Play Sound for No Match - plays a sound if the gesture doesn't exist or doesn't match a defined action

Sound (file) - The WAV file to play when no match. If empty, the sound defined for Question within Windows is played.

Figure 5


[back to top]    Training Gestures:

StrokesPlus comes with many gestures pre-trained, however, you can enter Training Mode if you want to create your own by selecting Training Mode from the StrokesPlus tray icon. You can also train StrokesPlus about existing gestures. For example, say that the way you draw the letter "R" on the screen is different than the way I do, StrokesPlus has learned the way I draw "R" and it may not recognize it when you draw "R". By entering Training Mode and drawing "R", you will see the window in Figure 7. If StrokesPlus recognizes the gesture, the text box will be pre-populated with the name of the gesture it believes was drawn. If StrokesPlus was incorrect in recognizing the gesture you intended, enter the name of the correct gesture here and click Save. This will add your drawing to the collection of point patterns associated with that gesture name. The more point patterns a gesture has associated with it, the better StrokesPlus may be at recognizing it.

Of course, if your drawing of "R" is dramatically different than the way I draw "R", it would be best to delete the "R" gesture from the Actions window and recreate one using only your point patterns so StrokesPlus will learn your style of "R" much faster. You will find that most gestures require only one point pattern (training capture), while others, like "R" and "B" will need several training sets for each letter since they're fairly similar, geometrically.

Figure 6


[back to top]    Creating Actions:

Actions are the lifeblood of StrokesPlus. Here is where you tell StrokesPlus exactly what to do when you complete a gesture.

An action is recognized if all of the criteria are met. This includes the Gesture, Mouse Modifiers, and/or Key Modifiers. Only one of these items must be selected to be recognized by StrokesPlus. For example, I have an action defined with only the Left Button mouse modifier; no Gesture or Key Modifier selected; so all I do is press the Stroke button (right, for me) and press the left mouse button and let go of the right button. This is great for very repetitive tasks; I use it for opening links in a new browser tab. I also have an action defined with only Scroll Up which I use to increase the volume.

Though most gesture involve drawing something on the screen as it's very easy to have many gestures where there are only so many mouse buttons. Note that modifiers do not have to be held for the duration of the sequence, only performed once after the Stroke button is pressed. So if you pressed the Stroke button and started to draw, you could tap the Control key once before releasing the Stroke button and it would be recognized as the drawing+Control key and if you have an action defined with that drawing and the Control key, StrokesPlus would fire the Lua script for the action.

The Available Actions dropdown displays a list of all actions exposed to Lua. The Info button will pop up a message describing the action. Clicking Insert will paste a snippet of the action into the Lua text box at the location of the cursor.

The Autosave check box tells StrokesPlus if you want it to automatically save changes when you switch to a different app or action, or close the Actions window. If Autosave is not checked, you must click Save before changing actions or closing the window, or changes will be lost.

Variables and Actions cover the variables and actions StrokesPlus exposes to Lua. For general Lua syntax, simply search Google for "Lua Programming Reference".

Figure 7


[back to top]    Defining Applications:

Global Actions are those which will fire regardless of what application is under the mouse (excluding Ignored windows, covered in the next section). However, you may want to have an entire set of gestures which are specific to only only application; like a web browser. To achieve this, click the Add App button, enter a name, and click OK. You will see a whole bunch of fields available to qualify and application and a Find Window box with a crosshair that can be used to locate an application, or only part of an application.

Only one field is required and generally the File Name is sufficient and will ensure the entire program is always matched. After using the Find Window crosshair, many of the fields will be populated with values. While you can leave them all as-is, it can create a very narrow scope that defines the app; potentially only a certain area of the app or only if the application's title happens to be exactly what was captured after using the Find Window tool. As I said, clear out all of the fields but File Name unless you're certain about the impact of how the qualifiers will affect your desired result.

The various Pattern fields are used to match based on regular expressions (uses BOOST regex library, FYI). This can be helpful if you want to match a broad or perhaps very specific type of condition to define an application.

When a gesture is complete, StrokesPlus will attempt to match applications first. If no match is found, then it will check the Global Actions for a match, unless Do not process Global Actions for this app, only app actions is checked

Figure 8


[back to top]    Ignored Windows:

Ignored windows are those which will cause StrokesPlus to ignore the Stroke button when it's pressed on a window which is in the ignore list. To add a window to the ignored list, click the Add button, enter a name, and click OK. You will see a whole bunch of fields available to qualify and application and a Find Window box with a crosshair that can be used to locate an application, or only part of an application.

Only one field is required and generally the File Name is sufficient and will ensure the entire program is always matched. After using the Find Window crosshair, many of the fields will be populated with values. While you can leave them all as-is, it can create a very narrow scope that defines the ignored window; potentially only a certain area of the app or only if the application's title happens to be exactly what was captured after using the Find Window tool. As I said, clear out all of the fields but File Name unless you're certain about the impact of how the qualifiers will affect your desired result.

The various Pattern fields are used to match based on regular expressions (uses BOOST regex library, FYI). This can be helpful if you want to match a broad or perhaps very specific type of condition to define an application which is to be ignored.

Don't forget to click Save after making any changes in this window.

Figure 9


[back to top]    Variables available to all Lua scripts:

The following variables are populated automatically when completing a gesture. They are often used by many of the action functions (covered in the next section) to identify the window(s) to be affected by the action.

sp_gesture_name (may also be referenced as gnm): string - The name of the drawn gesture

sp_gesture_start_x (may also be referenced as gsx): integer - The X coordinate of where the gesture began
sp_gesture_start_y (may also be referenced as gsy): integer - The Y coordinate of where the gesture began

sp_gesture_end_x (may also be referenced as gex): integer - The X coordinate of where the gesture ended
sp_gesture_end_y (may also be referenced as gey): integer - The Y coordinate of where the gesture ended

sp_wheel_delta (may also be referenced as gwd): integer - The mouse wheel scroll delta [positive or negative number], standard mouse wheels are 120 per wheel tick

Additionally, alien.core and alien.struct are available to Lua scripts for making direct DLL calls. You do not need to include:

require "alien"

..in your Lua script (as many sample scripts on the Internet do), you will receive an error, unless the alien DLLs are somewhere in the path, but I'm not so sure they would play well together...so that's at your own risk.

Example Lua Script to directly call user32.dll to display a message box (not via the bound acMessageBox(), this is directly calling it):

   local alien = alien.core
   local mb = alien.load("user32.dll")
   local messagebox = mb.MessageBoxA
   messagebox:types{ ret = 'long', abi = 'stdcall', 'long', 'pointer', 'string', 'long' }
   test = "test"
   messagebox(0, test, "test2", 0)

Note that making direct DLL calls can cause S+/the Lua engine to crash hard if you screw something up in the script or defining the call(s), so this is a use at your own risk feature. I would recommend installing Lua for Windows and testing scripts in there if you're having problems or before adding to an action (removing require "alien" references).

Also, you may include any variables or functions in the file StrokesPlus.lua in the same folder as StrokesPlus.exe. When StrokesPlus loads (or you select Reload Config from the tray menu), any Lua in StrokesPlus.lua is executed and persisted. For example, if you wanted to create your own Lua function that you wanted to be able to call from any action, you could store it in StrokesPlus.lua. Or perhaps you want to create some global variables that are shared across actions, they could be declared/initialized there as well.


[back to top]    Action Functions:

Locate Window Actions:

acFindWindow
acFindWindowByTitleRegex
acGetOwnerWindowByPoint
acGetParentWindowByPoint
acGetWindowByPoint
acGetForegroundWindow
acGetDesktopWindow

Window State Actions:

acActivateWindow
acPauseResumeThreadList
acSetProcessPriority
acTerminateProcess
acCloseApplication

Window Placement Actions:

acMoveWindow
acMinimizeWindow
acRestoreWindow
acMaximizeWindow
acMaximizeOrRestoreWindow
acTileWindows

Window Size Actions:

acGetWindowLeft
acGetWindowTop
acGetWindowRight
acGetWindowBottom
acSetWindowSize

Window Order Actions:

acSetTopmost
acClearTopmost
acToggleTopmost
acSendWindowToBottom
acPreviousApplication
acNextApplication

Window Transparency and Color Key Actions:

acGetWindowTransparency
acGetWindowColorKeyR
acGetWindowColorKeyG
acGetWindowColorKeyB
acSetWindowColorKey
acSetWindowTransparencyAndColorKey
acSetWindowTransparency

Miscellaneous Window Actions:

acGetWindowTitle
acGetClassName
acGetExecutableName

Multiple Monitor Actions:

acCenterWindowToScreen
acClipWindowToScreen
acFitWindowToScreen
acMaximizeToAllScreens
acGetMonitorFromPoint
acGetMonitorName
acSendWindowToPreviousMonitor
acSendWindowToMonitorByName
acSendWindowToMonitorByHandle
acSendWindowToNextMonitor
acGetMonitorFromName
acGetMonitorBottom
acGetMonitorTop
acGetMonitorLeft
acGetMonitorRight

Keyboard Actions:

acSendKeys
acSendWinDown
acSendWinUp
acSendControlDown
acSendControlUp
acSendAltDown
acSendAltUp
acSendShiftDown
acSendShiftUp

Mouse Actions:

acGetMouseLocationX
acGetMouseLocationY
acMouseMove
acMouseClick

Clipboard Actions:

acGetClipboardText
acSetClipboardText

Audio Actions:

acSetVolume
acGetVolume
acToggleMute
acGetMute
acSetMute
acPlaySound

Utility Actions:

acDelay
acGetSystemMetrics
acGetPixelRByPoint
acGetPixelGByPoint
acGetPixelBByPoint
acMessageBox
acDisplayText
acGetProcessIDFromPattern
acGetWindowFromProcessID
acRunProgram
acShellExecute
acLockWindows

Windows Messages Actions:

acSendMessage
acPostMessage

StrokesPlus Control Actions:

acShowAbout
acShowPrefs
acShowActions
acShowIgnoreList
acDisable
acDisableNext
acReloadConfig
acToggleTrayIcon
acExit


acActivateWindow(hwndTarget, x, y)
   Parameters:
     hwndTarget: The handle to the window to be activated; "nil" will use the x and y to locate the window
     x: The X (left) coordinate of the window to be activated
     y: The Y (top) coordinate of the window to be activated
   Returns: integer (always 1)
   Comments: Activates the window at the specified coordinates


acCenterWindowToScreen(hwndTarget, x, y, useworkarea)
   Parameters:
     hwndTarget: The handle to the desired window (if "nil", x and y will be used to get the window at those coordinates)
     x: If no hwndTarget is specified, this is gets the handle of the window at the x and y coordinates
     y: See above
     useworkarea: (boolean) whether to use the work area of the screen or not (work area excludes the space used by the taskbar)
   Returns: integer (always 1)
   Comments: Centers on the window on the screen


acClipWindowToScreen(hwndTarget, x, y, useworkarea)
   Parameters:
     hwndTarget: The handle to the desired window (if "nil", x and y will be used to get the window at those coordinates)
     x: If no hwndTarget is specified, this is gets the handle of the window at the x and y coordinates
     y: See above
     useworkarea: (boolean) whether to use the work area of the screen or not (work area excludes the space used by the taskbar)
   Returns: integer (always 1)
   Comments: Re-positions the window on the screen, does the best to ensure the window is not outside the screen boundaries, but does not resize the window


acClearTopmost(hwndTarget, x, y)
   Parameters:
     hwndTarget: The handle to the window; "nil" will use the x and y to locate the window
     x: The X (left) coordinate of the window
     y: The Y (top) coordinate of the window
   Returns: integer (always 1)
   Comments: Clears the TOPMOST flag of the window


acCloseApplication(hwndTarget, x, y)
   Parameters:
     hwndTarget: The handle to the window to be closed; "nil" will use the x and y to locate the window
     x: The X (left) coordinate of the window to be closed
     y: The Y (top) coordinate of the window to be closed
   Returns: integer (always 1)
   Comments: Closes the window at the specified coordinates


acDelay(duration)
   Parameters:
     duration: (ms) Number of millisecond to pause
   Returns: integer (always 1)
   Comments: Pauses the Lua script for the specified duration (Sleep(n))


acDisable()
   Returns: integer (always 1)
   Comments: Disables StrokesPlus


acDisableNext()
   Returns: integer (always 1)
   Comments: Disables the next gesture from being captured


acDisplayText()
   Parameters:
     message: The text to display
     font: The name of the font to use
     size: The size of the text
     red: The red portion of the color of the text color (RGB)
     green: The green portion of the color of the text color (RGB)
     blue: The blue portion of the color of the text color (RGB)
     duration: How long to display the text, in milliseconds
     x: The X (left) coordinate to place the text
     y: The Y (top) coordinate to place the text
   Returns: integer (always 1)
   Comments: Displays the specified text on the screen.
   Note: Any Lua script that follows acDisplayText() will be on hold until the duration has passed and the text is no longer displayed.


acExit()
   Returns: integer (always 1)
   Comments: Exits StrokesPlus


acFindWindow(classname, title)
   Parameters:
     classname: The class name of the window to be located
     title: The title of the window to be located
   Returns: integer - Handle to the window, 0 if not found
   Comments: Finds a window by class and title, exact match


acFindWindowByTitleRegex(titlepattern)
   Parameters:
     titlepattern: The regular expression to use when searching for a window title
   Returns: integer - Handle to the window, 0 if not found
   Comments: Finds the first window by matching the title to the regular expression passed in


acFitWindowToScreen(hwndTarget, x, y, useworkarea)
   Parameters:
     hwndTarget: The handle to the desired window (if "nil", x and y will be used to get the window at those coordinates)
     x: If no hwndTarget is specified, this is gets the handle of the window at the x and y coordinates
     y: See above
     useworkarea: (boolean) whether to use the work area of the screen or not (work area excludes the space used by the taskbar)
   Returns: integer (always 1)
   Comments: Fits the window to the screen it's mostly occupying, so it takes up the whole screen.


acGetClassName(hwndTarget, x, y)
   Parameters:
     hwndTarget: The handle to the window or control; "nil" will use the x and y to locate the window or control
     x: The X (left) coordinate of the window or control to be located
     y: The Y (top) coordinate of the window or control to be located
   Returns: string
   Comments: Gets the class name of the specified window or control. Note that unlike other actions where X and Y return the OWNING window, this control returns the window at the point specified, so if the point of over a button, the button's class name will be returned. You can call acGetOwnerWindowByPoint() or acGetParentWindowByPoint() if you'd like to walk up the container hierarchy.


acGetClipboardText()
   Returns: string
   Comments: Returns the current text of the clipboard


acGetDesktopWindow()
  Returns: integer
  Comments: Returns the handle of the Desktop window, this window which represents the Windows Desktop


acGetExecutableName(hwndTarget, x, y)
   Parameters:
     hwndTarget: The handle to the window; "nil" will use the x and y to locate the window
     x: The X (left) coordinate of the window to be located
     y: The Y (top) coordinate of the window to be located
   Returns: string
   Comments: Gets the name of the EXE which owns the window


acGetForegroundWindow()
  Returns: integer
  Comments: Returns the handle of the foreground (top) window, the one which is currently active


acGetMonitorBottom(monitorhandle, useworkarea)
   Parameters:
     monitorhandle: The handle to the monitor
     useworkarea: Whether to consider only the work area, not full monitor (excludes taskbar, docked windows)
   Returns: integer
   Comments: Gets the CY (bottom) coordinate of the specified monitor


acGetMonitorFromName(monitorname)
   Parameters:
     monitorname: The name of the monitor (value must be in escaped form, "\\" for "\", e.g. "\\.\DISPLAY1" would be written in Lua script as "\\\\.\\DISPLAY1")
   Returns: integer - monitor handle
   Comments: Gets handle to the specified monitor


acGetMonitorFromPoint(x, y)
   Parameters:
     x: the x coordinate of the point used to locate the monitor
     y: See above
   Returns: integer
   Comments: Returns the handle to the monitor where the x,y is located

acGetMonitorLeft(monitorhandle, useworkarea)
   Parameters:
     monitorhandle: The handle to the monitor
     useworkarea: Whether to consider only the work area, not full monitor (excludes taskbar, docked windows)
   Returns: integer
   Comments: Gets the X (left) coordinate of the specified monitor


acGetMonitorName(monitorhandle)
   Parameters:
     monitorhandle: Handle to the monitor
   Returns: string
   Comments: Returns the name of the monitor


acGetMonitorRight(monitorhandle, useworkarea)
   Parameters:
     monitorhandle: The handle to the monitor
     useworkarea: Whether to consider only the work area, not full monitor (excludes taskbar, docked windows)
   Returns: integer
   Comments: Gets the CX (right) coordinate of the specified monitor


acGetMonitorTop(monitorhandle, useworkarea)
   Parameters:
     monitorhandle: The handle to the monitor
     useworkarea: Whether to consider only the work area, not full monitor (excludes taskbar, docked windows)
   Returns: integer
   Comments: Gets the Y (top) coordinate of the specified monitor


acGetMouseLocationX()
   Returns: integer
   Comments: Returns the X (left) coordinate of the current mouse location


acGetMouseLocationY()
   Returns: integer
   Comments: Returns the Y (top) coordinate of the current mouse location


acGetMute()
   Returns: integer - 1 for muted, 0 for not muted
   Comments: Returns the state of the mute on the master channel


acGetOwnerWindowByPoint(x, y)
   Parameters:
     x: The X (left) coordinate of the window
     y: The Y (top) coordinate of the window
   Returns: integer
   Comments: Returns the handle of the owner (ancestor) window to which the target window belongs


acGetParentWindowByPoint(x, y)
   Parameters:
     x: The X (left) coordinate of the window
     y: The Y (top) coordinate of the window
   Returns: integer
   Comments: Returns the handle of the parent window to which the target window belongs


acGetPixelBByPoint(x, y)
   Parameters:
     x: The X (left) coordinate of the point
     y: The Y (top) coordinate of the point
   Returns: integer 0-255
   Comments: Gets the blue (B) part of the color at the specified point

acGetPixelGByPoint(x, y)
   Parameters:
     x: The X (left) coordinate of the point
     y: The Y (top) coordinate of the point
   Returns: integer 0-255
   Comments: Gets the green (G) part of the color at the specified point


acGetPixelRByPoint(x, y)
   Parameters:
     x: The X (left) coordinate of the point
     y: The Y (top) coordinate of the point
   Returns: integer 0-255
   Comments: Gets the red (R) part of the color at the specified point

acGetProcessIDFromPattern(filepattern)
   Parameters:
     filepattern: The name or regular expression pattern to search for.
   Returns: integer - the process ID if a match is found, 0 if not
   Comments: Determines if there is a process running which matches the file pattern. File pattern can be the exact name of the executable, or a regular expression for wildcard searches.


acGetSystemMetrics(value)
   Parameters:
     value: The ID (number) (based on Win32 specs) which to retreive
   Returns: integer - The value returned by Windows
   Comments: This directly calls GetsystemMetrics, which can be useful in finding out various metrics of the Windows configuration. See: http://msdn.microsoft.com/en-us/library/windows/desktop/ms724385.aspx


acGetVolume()
   Returns: integer - Current volume level, 0-100
   Comments: Returns the current volume of the master channel


acGetWindowBottom(hwndTarget, x, y)
   Parameters:
     hwndTarget: The handle to the desired window (if "nil", x and y will be used to get the window at those coordinates)
     x: If no hwndTarget is specified, this is gets the handle of the window at the x and y coordinates
     y: See above
   Returns: integer
   Comments: Gets the CY (bottom) of the specified window


acGetWindowByPoint(x, y)
   Parameters:
     x: The X (left) coordinate of the window
     y: The Y (top) coordinate of the window
   Returns: integer
   Comments: Returns the handle of the window at the specified coordinates


acGetWindowColorKeyB(hwndTarget, x, y)
   Parameters:
     hwndTarget: The handle to the window; "nil" will use the x and y to locate the window
     x: The X (left) coordinate of the window
     y: The Y (top) coordinate of the window
   Returns: integer 0-255
   Comments: Gets the blue (B) part of the color to which the window's color key is


acGetWindowColorKeyG(hwndTarget, x, y)
   Parameters:
     hwndTarget: The handle to the window; "nil" will use the x and y to locate the window
     x: The X (left) coordinate of the window
     y: The Y (top) coordinate of the window
   Returns: integer 0-255
   Comments: Gets the green (G) part of the color to which the window's color key is


acGetWindowColorKeyR(hwndTarget, x, y)
   Parameters:
     hwndTarget: The handle to the window; "nil" will use the x and y to locate the window
     x: The X (left) coordinate of the window
     y: The Y (top) coordinate of the window
   Returns: integer 0-255
   Comments: Gets the red (R) part of the color to which the window's color key is


acGetWindowFromProcessID(processID)
   Parameters:
     processID: The process ID to use when searching for a top-level window.
   Returns: integer - handle to the first top-level window of the process, or nil if no match was found.
   Comments: Searches for a top-level window that belongs to the process ID passed. If a match is found, the handle is returned, otherwise nil is returned.


acGetWindowLeft(hwndTarget, x, y)
   Parameters:
     hwndTarget: The handle to the desired window (if "nil", x and y will be used to get the window at those coordinates)
     x: If no hwndTarget is specified, this is gets the handle of the window at the x and y coordinates
     y: See above
   Returns: integer
   Comments: Gets the X (left) coordinate of the specified window


acGetWindowRight(hwndTarget, x, y)
   Parameters:
     hwndTarget: The handle to the desired window (if "nil", x and y will be used to get the window at those coordinates)
     x: If no hwndTarget is specified, this is gets the handle of the window at the x and y coordinates
     y: See above
   Returns: integer
   Comments: Gets the CX (right) of the specified window


acGetWindowTitle(hwndTarget, x, y)
   Parameters:
     hwndTarget: The handle to the window; "nil" will use the x and y to locate the window
     x: The X (left) coordinate of the window
     y: The Y (top) coordinate of the window
   Returns: string - Window title
   Comments: Returns the title of the window specified


acGetWindowTop(hwndTarget, x, y)
   Parameters:
     hwndTarget: The handle to the desired window (if "nil", x and y will be used to get the window at those coordinates)
     x: If no hwndTarget is specified, this is gets the handle of the window at the x and y coordinates
     y: See above
   Returns: integer
   Comments: Gets the Y (top) coordinate of the specified window


acGetWindowTransparency(hwndTarget, x, y)
   Parameters:
     hwndTarget: The handle to the window; "nil" will use the x and y to locate the window
     x: The X (left) coordinate of the window
     y: The Y (top) coordinate of the window
   Returns: integer 0-255
   Comments: Gets the level of transparency of a window, 0 being invisible, 255 being solid


acLockWindows()
   Returns: integer (always 1)
   Comments: Locks Windows, equivalent of pressing WIN+L


acMaximizeWindow(hwndTarget, x, y)
   Parameters:
     hwndTarget: The handle to the window to be maximized; "nil" will use the x and y to locate the window
     x: The X (left) coordinate of the window to be maximized
     y: The Y (top) coordinate of the window to be maximized
   Returns: integer (always 1)
   Comments: Maximizes the window at the specified coordinates


acMaximizeOrRestoreWindow(hwndTarget, x, y)
   Parameters:
     hwndTarget: The handle to the window to be restored or maximized; "nil" will use the x and y to locate the window
     x: The X (left) coordinate of the window to be restored or maximized
     y: The Y (top) coordinate of the window to be restored or maximized
   Returns: integer (always 1)
   Comments: Restores or maximizes the window, depending on its state at the specified coordinates


acMaximizeToAllScreens(hwndTarget, x, y)
   Parameters:
     hwndTarget: The handle to the desired window (if "nil", x and y will be used to get the window at those coordinates)
     x: If no hwndTarget is specified, this is gets the handle of the window at the x and y coordinates
     y: See above
   Returns: integer (always 1)
   Comments: Stretches the window so it takes up the whole desktop, across all screens. Generally, this isn't very practical, but it's there for what it's worth.


acMessageBox(message, title, style)
   Parameters:
     message: The main message to be displayed
     title: Title of the message box window
     style: The integer (based on Win32 specs) which represents the style of the message box, which includes the icon, buttons, and default button. nil for no style (Ok button only)
   Returns: integer - The value returned by the message box, if a style was specified, which button was clicked will be returned (like a Yes/No box, the return value indicates the button that was clicked)
   Comments: Displays a standard Windows message box. May pass in style to customize the icon and buttons.


acMinimizeWindow(hwndTarget, x, y)
   Parameters:
     hwndTarget: The handle to the window to be minimized; "nil" will use the x and y to locate the window
     x: The X (left) coordinate of the window to be minimized
     y: The Y (top) coordinate of the window to be minimized
   Returns: integer (always 1)
   Comments: Minimizes the window at the specified coordinates


acMouseClick(x, y, button, down, up)
   Parameters:
     x: The X (left) coordinate of where the click should occur
     y: The Y (top) coordinate of where the click should occur
     button: The mouse button which should be sent
         0: Secondary button (right by default, unless mouse buttons are swapped)
         1: Middle button
         2: Primary button (left by default, unless mouse buttons are swapped)
         3: X1 button
         4: X2 button
     down: (boolean) If the MOUSE_BUTTON_DOWN message should be sent
     up: (boolean) If the MOUSE_BUTTON_UP message should be sent
   Returns: integer (always 1)
   Comments: Send a mouse down and/or up event at the specified coordinates


acMouseMove(x, y)
   Parameters:
     x: The X (left) coordinate to move the mouse cursor to
     y: The Y (top) coordinate to move the mouse cursor to
   Returns: integer (always 1)
   Comments: Moves the mouse cursor to the specified coordinates


acMoveWindow(hwndTarget, x, y, left, top)
   Parameters:
     hwndTarget: The handle to the window to be moved; "nil" will use the x and y to locate the window
     x: The X (left) coordinate of the window to be moved
     y: The Y (top) coordinate of the window to be moved
     left: The new X (left) coordinate of the window's location
     top: The new Y (top) coordinate of the window's location
   Returns: integer (always 1)
   Comments: Moves the window using the specified coordinates


acNextApplication()
   Returns: integer (always 1)
   Comments: Switches to the next application in the window list, like holding ALT and pressing tab (cycles through the open programs)


acPauseResumeThreadList(hwndTarget, x, y, resume)
   Parameters:
     hwndTarget: The handle to the window; "nil" will use the x and y to locate the window
     x: The X (left) coordinate of the window
     y: The Y (top) coordinate of the window
     resume: (boolean) true to resume threads, false to suspend
   Returns: integer (always 1)
   Comments: Suspends or resumes all threads of a window. This is VERY dangerous and NOT recommended, by me or Microsoft, in fact.


acPlaySound(filename)
   Parameters:
     filename: The full path (remembering about escaping Lua strings) to the WAV file
   Returns: integer (always 1)
   Comments: Plays a sound.


acPostMessage(hwndTarget, MessageID, wParam, lParam)
   Parameters:
     hwndTarget: The destination handle of the window where the message is to be sent
     MessageID: (integer) The message ID to be sent.
     wParam: (integer) The wParam to be sent
     lParam: (integer) The lParam to be sent
   Returns: integer (always 1)
   Comments: This is a very simple form, not allowing for complex data structures in wParam and lParam.
     I intend to try and support any type of parameter in the future.


acPreviousApplication()
   Returns: integer (always 1)
   Comments: Switches to the previous window, like pressing ALT+TAB


acReloadConfig()
   Returns: integer (always 1)
   Comments: Instructs StrokesPlus to reload the data from the configuration file (StrokesPlus.xml)


acRestoreWindow(hwndTarget, x, y)
   Parameters:
     hwndTarget: The handle to the window; "nil" will use the x and y to locate the window
     x: The X (left) coordinate of the window
     y: The Y (top) coordinate of the window
   Returns: integer (always 1)
   Comments: Restores the specified window


acRunProgram(fullpath, parameters, seconds, style)
   Parameters:
     fullpath: Full path to EXE; requires escaped backslashes (C:\windows\notepad.exe needs to be written like C:\\windows\\notepad.exe).
     parameters: The command line parameters to pass to the program
     seconds: The seconds to wait for the program to exit (to get an exit code); if the duration has passed and the program is still running, 0 is returned.
     style: The window style for the program, using one of the nCmdShow value described here: http://msdn.microsoft.com/en-us/library/windows/desktop/ms633548.aspx
   Returns: integer - 0 or return code from program (if it exits before the seconds duration is reached)
   Comments: Runs a program


acSendAltDown()
   Returns: integer (always 1)
   Comments: Sends the Alt key down event


acSendAltUp()
   Returns: integer (always 1)
   Comments: Sends the Alt key up event


acSendControlDown()
   Returns: integer (always 1)
   Comments: Sends the Control key down event


acSendControlUp()
   Returns: integer (always 1)
   Comments: Sends the Control key up event


acSendKeys(keystring)
   Parameters:
     keystring: The string of send keys commands (covered here)
   Returns: integer (always 1)
   Comments: Sends keystrokes to the active window.


acSendMessage(hwndTarget, MessageID, wParam, lParam)
   Parameters:
     hwndTarget: The destination handle of the window where the message is to be sent
     MessageID: (integer) The message ID to be sent.
     wParam: (integer) The wParam to be sent
     lParam: (integer) The lParam to be sent
   Returns: integer (always 1)
   Comments: This is a very simple form, not allowing for complex data structures in wParam and lParam.
     I intend to try and support any type of parameter in the future.


acSendShiftDown()
   Returns: integer (always 1)
   Comments: Sends the Shift key down event


acSendShiftUp()
   Returns: integer (always 1)
   Comments: Sends the Shift key up event


acSendWinDown()
   Returns: integer (always 1)
   Comments: Sends the Win key down event


acSendWinUp()
   Returns: integer (always 1)
   Comments: Sends the Win key up event


acSendWindowToBottom(hwndTarget, x, y)
   Parameters:
     hwndTarget: The handle to the window; "nil" will use the x and y to locate the window
     x: The X (left) coordinate of the window
     y: The Y (top) coordinate of the window
   Returns: integer (always 1)
   Comments: Sends the specified window to the bottom of the window stack (imagine turning laying your screen flat and looking down at it)


acSendWindowToMonitorByHandle(monitorhandle)
   Parameters:
     monitorhandle: The handle to the desired monitor
   Returns: integer (always 1)
   Comments: Sends the window to the specified monitor (positions based on LEFT and TOP, does not resize)


acSendWindowToMonitorByName(monitorname)
   Parameters:
     monitorname: The name of the desired monitor (must be an escaped string! \\ for \, e.g. "\\.\DISPLAY1" would be written in Lua script as "\\\\.\\DISPLAY1")
   Returns: integer (always 1)
   Comments: Sends the window to the specified monitor (positions based on LEFT and TOP, does not resize)


acSendWindowToNextMonitor(hwndTarget, x, y)
   Parameters:
     hwndTarget: The handle to the desired window (if "nil", x and y will be used to get the window at those coordinates)
     x: If no hwndTarget is specified, this is gets the handle of the window at the x and y coordinates
     y: See above
   Returns: integer (always 1)
   Comments: Sends the window to the next monitor (positions based on LEFT and TOP, does not resize)


acSendWindowToPreviousMonitor(hwndTarget, x, y)
   Parameters:
     hwndTarget: The handle to the desired window (if "nil", x and y will be used to get the window at those coordinates)
     x: If no hwndTarget is specified, this is gets the handle of the window at the x and y coordinates
     y: See above
   Returns: integer (always 1)
   Comments: Sends the window to the previous monitor (positions based on LEFT and TOP, does not resize)


acSetClipboardText(value)
   Parameters:
     value: The text to save to the clipboard
   Returns: integer (always 1)
   Comments: Sets the clipboard text to "value"


acSetMute(value)
   Parameters:
     value: 1 to mute, 0 to unmute
   Returns: integer (always 1)
   Comments: Sets the mute state based on the value passed in


acSetProcessPriority(hwndTarget, x, y, priority)
   Parameters:
     hwndTarget: The handle to the window; "nil" will use the x and y to locate the window
     x: The X (left) coordinate of the window
     y: The Y (top) coordinate of the window
     priority: (integer) The value of the new priority (based on the dwPriorityClass value here: http://msdn.microsoft.com/en-us/library/windows/desktop/ms686219.aspx)
   Returns: integer (always 1)
   Comments: Sets the process priority of the window


acSetTopmost(hwndTarget, x, y)
   Parameters:
     hwndTarget: The handle to the window; "nil" will use the x and y to locate the window
     x: The X (left) coordinate of the window
     y: The Y (top) coordinate of the window
   Returns: integer (always 1)
   Comments: Sets the TOPMOST flag of the window to ON


acSetVolume(value, increment)
   Parameters:
     value: (integer 0-100) Value to set the volume to
     increment: (boolean) - true tells SP to use the Value parameter as an adjustment to the current volme, false sets the volume to the Value explicitly
   Returns: integer (always 1)
   Comments: Sets the master volume level


acSetWindowColorKey(hwndTarget, x, y, remove, red, green, blue)
   Parameters:
     hwndTarget: The handle to the window; "nil" will use the x and y to locate the window
     x: The X (left) coordinate of the window
     y: The Y (top) coordinate of the window
     remove: (boolean) true to remove the color key
     red: The red value of the color to make the color key
     green: The green value of the color to make the color key
     blue: The blue value of the color to make the color key
   Returns: integer (always 1)
   Comments: Sets the color key for a window, which makes all parts of a window which match the color (R,G,B) transparent. Can have odd results depending on the window!


acSetWindowSize(hwndTarget, x, y, left, top, width, height)
   Parameters:
     hwndTarget: The handle to the window to be moved/sized; "nil" will use the x and y to locate the window
     x: The X (left) coordinate of the window to be moved/sized
     y: The Y (top) coordinate of the window to be moved/sized
     width: The new width of the window
     height: The new height of the window
   Returns: integer (always 1)
   Comments: Moves and sizes the window using the specified coordinates and width/height


acSetWindowTransparency(hwndTarget, x, y, opacity)
   Parameters:
     hwndTarget: The handle to the window; "nil" will use the x and y to locate the window
     x: The X (left) coordinate of the window
     y: The Y (top) coordinate of the window
     opacity: The value to set the level of opacity to, 0-255 (255 is opaque)
   Returns: integer (always 1)
   Comments: Sets the level of transparency of a window, 0 being invisible, 255 being solid


acSetWindowTransparencyAndColorKey(hwndTarget, x, y, opacity, red, green, blue)
   Parameters:
     hwndTarget: The handle to the window; "nil" will use the x and y to locate the window
     x: The X (left) coordinate of the window
     y: The Y (top) coordinate of the window
     opacity: The value to set the level of opacity to, 0-255 (255 is opaque)
     red: The red value of the color to make the color key
     green: The green value of the color to make the color key
     blue: The blue value of the color to make the color key
   Returns: integer (always 1)
   Comments: Sets the transparency and color key for a window


acShellExecute(verb, file, parameters, directory, style)
   Parameters:
     verb: edit, explore, find, open, print. Search for ShellExecute MSDN on the Internet for more details.
     file: The file or program to open (or perform other actions against). If specifying the full path in this parameter, escaped backslashes are requires (C:\windows\notepad.exe needs to be written like C:\\windows\\notepad.exe)
     parameters: (optional) The command line parameters to pass to the program
     directory: (optional) Specifies the working directory
     style: The window style for the program (hidden, normal, maximizes, etc.), using one of the nCmdShow value described here: http://msdn.microsoft.com/en-us/library/windows/desktop/ms633548.aspx
   Returns: integer - (always 1)
   Comments: Executes the specified verb on the file or object specified. For example, specify a MS Word document with "open" and it will open it in MS Word. Or an EXE can be opened, similar to acRunProgram().


acShowAbout()
   Returns: integer (always 1)
   Comments: Shows the About window


acShowActions()
   Returns: integer (always 1)
   Comments: Shows the Actions window

acShowIgnoreList()
   Returns: integer (always 1)
   Comments: Shows the Ignore List window


acShowPrefs()
   Returns: integer (always 1)
   Comments: Shows the Preferences window


acTerminateProcess(hwndTarget, x, y)
   Parameters:
     hwndTarget: The handle to the window; "nil" will use the x and y to locate the window
     x: The X (left) coordinate of the window
     y: The Y (top) coordinate of the window
   Returns: integer (always 1)
   Comments: Kills the main process of the window specified. This does not send a friendly close message which prompts to save files, etc.


acTileWindows(mode, area, method)
   Parameters:
     mode: 1 to tile vertically, 2 to tile horizontally
     area: 0 to tile only on the screen where the window under the gesture start resides, 1 to tile across the entire virtual desktop
     method: 0 to have StrokesPlus handle the tiling, 1 to have Window handle the tiling
   Returns: integer (always 1)
   Comments: Tiles all open windows vertically or horizontally across either the screen or all screens. Note that some windows may not position properly due to non-standard window creation. I will continue to refine thiese actions accordingly, but try changing the method as well to see what works best for you.


acToggleMute()
   Returns: integer (always 1)
   Comments: Toggles the mute on the master channel


acToggleTopmost(hwndTarget, x, y)
   Parameters:
     hwndTarget: The handle to the window; "nil" will use the x and y to locate the window
     x: The X (left) coordinate of the window
     y: The Y (top) coordinate of the window
   Returns: integer (always 1)
   Comments: Toggles the TOPMOST flag of the window on or off


acToggleTrayIcon()
   Returns: integer (always 1)
   Comments: Toggles whether the StrokesPlus tray icon is hidden or visible. Can also be accomplished by pressing CTRL+SHIFT+WIN+S


[back to top]    acSendKeys Usage:

Based on the following project:
http://www.codeproject.com/KB/cpp/sendkeys_cpp_Article.aspx

----

Key Modifiers (indicate the button should be pressed along with the following character, useful for sending ALT+H, which would read "%h"):

@ = WINKEY
+ = SHIFT
^ = CTRL
% = ALT

Other Functions:

{VKEY X} - Sends the VKEY specified. Useful if there's a VKEY I don't have defined. For example, {VKEY 13} is equivalent to VK_RETURN.
See: http://msdn.microsoft.com/en-us/library/dd375731%28v=VS.85%29.aspx

{BEEP X Y} - Beeps with a frequency of X and a duration of Y ms.

{DELAY X} - Delays sending the next key of X milliseconds.
After the delaying the following key, the subsequent keys will not be further delayed unless there is a default delay value (see DELAY=X).
Example: {DELAY 1000} <-- delays subsequent key stroke for 1 second.

{DELAY=X} - Sets the default delay value to X milliseconds. This will cause every key to be delayed X ms.
If a value is already set and you specify {DELAY Y} you will have your following key delay Y ms but the subsequent keys will be delayed X ms.
Example: {DELAY=1000} <-- all subsequent keys will be delayed for 1 second.

Full SendKeys listing:

{ADD} = VK_ADD
{APPS} = VK_APPS
{AT} = @
{BACKSPACE} = VK_BACK
{BKSP} = VK_BACK
{BREAK} = VK_CANCEL
{BROWSERBACK} = VK_BROWSER_BACK
{BROWSERFAVORITES} = VK_BROWSER_FAVORITES
{BROWSERFORWARD} = VK_BROWSER_FORWARD
{BROWSERHOME} = VK_BROWSER_HOME
{BROWSERREFRESH} = VK_BROWSER_REFRESH
{BROWSERSEARCH} = VK_BROWSER_SEARCH
{BROWSERSTOP} = VK_BROWSER_STOP
{BS} = VK_BACK
{CAPSLOCK} = VK_CAPITAL
{CARET} = ^
{CLEAR} = VK_CLEAR
{DECIMAL} = VK_DECIMAL
{DEL} = VK_DELETE
{DELETE} = VK_DELETE
{DIVIDE} = VK_DIVIDE
{DOWN} = VK_DOWN
{END} = VK_END
{ENTER} = VK_RETURN
{ESC} = VK_ESCAPE
{ESCAPE} = VK_ESCAPE
{F10} = VK_F10
{F11} = VK_F11
{F12} = VK_F12
{F13} = VK_F13
{F14} = VK_F14
{F15} = VK_F15
{F16} = VK_F16
{F_1} = VK_F1
{F_2} = VK_F2
{F_3} = VK_F3
{F_4} = VK_F4
{F_5} = VK_F5
{F_6} = VK_F6
{F_7} = VK_F7
{F_8} = VK_F8
{F_9} = VK_F9
{HELP} = VK_HELP
{HOME} = VK_HOME
{INS} = VK_INSERT
{LBRACE} = {
{LEFT} = VK_LEFT
{LPAREN} = (
{LWIN} = VK_LWIN
{MEDIANEXTTRACK} = VK_MEDIA_NEXT_TRACK
{MEDIAPLAYPAUSE} = VK_MEDIA_PLAY_PAUSE
{MEDIAPREVTRACK} = VK_MEDIA_PREV_TRACK
{MEDIASTOP} = VK_MEDIA_STOP
{MULTIPLY} = VK_MULTIPLY
{NUMLOCK} = VK_NUMLOCK
{NUMPAD0} = VK_NUMPAD0
{NUMPAD1} = VK_NUMPAD1
{NUMPAD2} = VK_NUMPAD2
{NUMPAD3} = VK_NUMPAD3
{NUMPAD4} = VK_NUMPAD4
{NUMPAD5} = VK_NUMPAD5
{NUMPAD6} = VK_NUMPAD6
{NUMPAD7} = VK_NUMPAD7
{NUMPAD8} = VK_NUMPAD8
{NUMPAD9} = VK_NUMPAD9
{PERCENT} = %
{PGDN} = VK_NEXT
{PGUP} = VK_PRIOR
{PLUS} = +
{PRTSC} = VK_PRINT
{RBRACE} = }
{RIGHT} = VK_RIGHT
{RPAREN} = )
{RWIN} = VK_RWIN
{SCROLL} = VK_SCROLL
{SEPARATOR} - VK_SEPARATOR
{SLEEP} - VK_SLEEP
{SNAPSHOT} = VK_SNAPSHOT
{SUBTRACT} - VK_SUBTRACT
{TAB} = VK_TAB
{TILDE} = ~
{UP} = VK_UP
{VOLDOWN} = VK_VOLUME_DOWN
{VOLMUTE} = VK_VOLUME_MUTE
{VOLUP} = VK_VOLUME_UP
{WIN} = VK_LWIN