WireKeys supports different ways of using it`s functionality from other applications and scripts:
Command line, plugin and a macro.
Using command line, you can start quick-runs or macros from shortcuts (and bat/cmd/lnk/js/vbs files).
To do so start WireKeys.exe with command line switch "-execute": "WireKeys.exe -execute=XXX" where XXX is the name of the macro
or quick-run item and it will be executed. To execute action, set its number instead of macro name
prepended with '!', for example "WireKeys.exe -execute=!15" will eject CD-Rom. To see action numbers
look at this page.
To use WK from macro script, use special WireKeys object. Example:
Sends message to the windows and continues execution
SetWindowPosition
Window handle, position X, position Y
Sets window position to specified (X,Y) point
SetWindowSize
Window handle, new width, new height
Sets window size to specified (width,height)
GetScreenPixel
X coordinate, Y coordinate
Returns color of the pixel in the screen in (X,Y) position as the string like "#0A33FF".
GetCursorPixel
None
Returns color of the pixel in the screen in the cursor position as the string like "#0A33FF"
GetCursorPosX,GetCursorX
GetCursorPosY,GetCursorY
None
Returns X or Y coordinate of the mouse cursor respectively
GetWindowFromPoint
X coordinate, Y coordinate, Check disabled windows flag (0/1, 0 by default)
Returns handle of the window in the specified position
GetWindowUnderCursor
Check disabled windows flag (0/1, 0 by default)
Returns handle of the window under cursor
GetWindowText
Window handle
Returns Text/Title of the specified window
GetWindowClass
Window handle
Returns class name of the specified window
IsEnabled
Window handle
Returns window "enabled" state (0/1)
EnableWindow
Window handle, enable flag (1/0)
Enables or disables specified window
IsVisible
Window handle
Returns window "visibility" (0/1)
SetVisible
Window handle, visibility flag (1/0)
Shows or hide specified window
Text-related and keyboard-related functions
Function name
Parameters
Description and example
GetSelectedText,Copy
None
Returns selected text from active application (or path to selected files in applications like Explorer)
PutSelectedText,Paste
Text to paste
Inserts text from 1st parameter into currently active application
PasteClip
Clipboard number
Inserts text from WireKeys additional clipboard
SetClipboard
Text to set
Set the text into clipboard
SendText, SendKeys
Text to send
Sends text from 1st parameter into currently active application
GetClipboard
None
Returns content of the Windwos clipboard. If clipboard contains file link, this function will return path to that file
PasteClipboard
None
Inserts original content of clipboard into active application
GetCaretX,GetCaretY
None
Returns X or Y coordinate of the caret. If caret position is not accessible, mouse cursor position is used
WaitKeyRelease
None
Stops execution until all keys (on keyboard or mouse) are unpressed. Useful for replaing key presses that can be altered by accidentally pressed Shift key, for example
i18n
Text
Returns translation of the text (from corresponding lng file) in the current language
fromUTF8, toUTF8
Text
Returns conversion of the text to/from UTF8 encoding
TestDosMask
String, Mask
Returns "0" if string does not match mask and "1" otherwise. Mask can have "*" and "?" characters for partial matches
BlockHotkey
None
Blocks all hotkeys. Call again to unblock them.
BlockKeyboard
None
Blocks keyboard. Call again to unblock it.
PauseWirekeys
'0' or '1'
Pauses WK completely (disables all hotkeys, sounds, activity etc.). This function is faster than BlockKeyboard or BlockHotkey
Other functions
Function name
Parameters
Description and example
GetCookie
Cookie name
Returns cookie value. Cookies are saved between calls. You can use them for remembering things between different calls to macro
PutCookie,SetCookie
Cookie name and cookie value
Sets cookie value. Cookies are saved between calls. You can use them for remembering things between different calls to macro
Sleep
Time to sleep, in milliseconds
Stops execution for specified amount of time
Wait
Time to sleep, in seconds
Stops execution for specified amount of time
MessageBox
Message text, Message box parameters (can be empty)
Shows message box with specified parameters. Execution stops until dialog is closed
ShowBaloon
Message text, Message title, timeout (milliseconds, can be empty)
Shows baloon near the tray icon with specified parameters.
ShowBaloonAtPosition
Text,Title,Baloon position X,Baloon position Y
Shows baloon in specified position of the screen
ShowOsd
Message text, timeout (milliseconds, can be empty)
Shows message in OSD with specified parameters.
Alert
Message text, Message title, timeout (milliseconds, can be empty)
Shows message box with specified parameters. Execution will not be paused.
ShowPopupMenu
Menu items. You can give menu items in one string, separate items with "|" in that case.
Shows popup menu (in the cursor position). Returns number of the selected item or -1. Example: WireKeys.ShowPopupMenu("item1","item2","item3");WireKeys.ShowPopupMenu("item1|item2|item3");
Ask
Dialog title, default value
Shows dialog with single edit box. User can change the value and return it to the script
AskFile
Dialog title, valid extrensions list
Shows "Open file" dialog. You can limit list of valid files (by extension) using second parameter of the function. Returns path to selected file or empty string if any error occured.
AskFolder
Dialog title, start folder
Shows "Browse for folder" dialog. Returns path to selected folder or empty string if any error occured.
CallAction,CallMacro
Name of macro/action to execute
Calls specified action or macro. See help for command line parameter "-execute".
CallDll
Path to Dll, function name, function parameter
Calls exported function from dll and returns result as string
CallPlugin
plugin name, function parameter
Calls special function from plugin and returns result as a string
ShellExec
Application/document name
Calls application or document as if started from "Run..." dialog
SwitchResolution
X resolution, Y resolution
Sets monitor resolution to specified values
SetWkOption
Option name, option value
Sets WireKeys option. Available options are: "ScreenSaverAutoStartFile" (value is the file path),"ScreenSaverAutoStopFile" (value is 0/1)
isAppRunning
Name of exe file (option with path) to detect
Returns "1" if the process with the same name is started and "0" otherwise. Check is case insensitive
isKeyPressed
Key code or one of the following strings: "shift","alt","control","rwin","lwin","lbutton","rbutton","mbutton"
Returns "1" if the key with specified code is pressed, 0 otherwise
CloseApp
Name of exe file (option with path) to close and close type
Set second parameter to "1" to kill application and '"0" to close it. Returns "1" if the process with the same name is closed and "0" otherwise. Check is case insensitive.
PlaySound
Name of wav/mp3/wma/... or video file, loop sound flag (0/1)
Plays media file (music or video). To stop sound, call this function again with empty path
LoadURL
URL
Returns string with the content of the given web-site (in text representation). Returns empty string if URL is not accessible
SaveScreenshot
File path, file type
Saves screenshot of the whole screen into file. Use type==0 for bmp format and type 1 for jpg
EmptyRecycleBin
None or path to desired disk
Empties recycle bin of the choosen drive. If none specified, all recycle bins will be cleaned
OpenCD,CloseCD
Disk letter
Opens/closes CD/DVD drive
StartInternetConnection
Connection name
Connects to internet using connection with the given name