Hotkeys Macros

A hotkey is a combination of keystrokes that initiates actions in the Windows operating system (OS). For example, the Windows clipboard has reserved several hotkeys such as Ctrl-c (^c) for copying selected text into the clipboard, while ^x cuts selected text and ^v pastes it. These clipboard hotkeys are common to most Windows text-based applications. Hotkeys Macros allows you to create your own hotkeys, which can be programmed to perform virtually any task in the Windows OS.

A Hotkeys Macros program represents lines of instructions for the Windows operating system to perform when a corresponding hotkey is pressed. Macro instructions are the equivalent of typing and/or clicking to the active window or issuing system commands to the OS. With the Hotkeys Macro Event Recorder any action you can do in Windows can be recorded into a macro file and reproduced by pressing an associated hotkey. Along with keystrokes and mouse clicks, the Hotkeys Macros language includes 60 system commands to provide complete control of the Windows OS. The functionality of these commands is described in the following document.

The Hotkeys Editor allows you to create a macro by recording keystrokes and mouse clicks or by writing a macro from scratch. A single macro file can contain the code for many hotkeys, which can work independently or as a single program unit. Macro files can be organized so that a main macro uses the other macros like functions  There are 4 attributes that define a Hotkeys Macro: the keystrokes that define a hotkey, a description of the macro, an enable flag, and the actions to take when the hotkey is pressed.

The following convention was established to record non-printable characters such as TAB into a macro (text) format. The plus sign +, caret ^, percent sign %, tilde ~, parentheses ( ) and brackets [ ] have special meanings to Hotkeys. To specify one of these characters, enclose it within braces {}. For example, to specify the plus sign, use {+}. Brackets [ ] are used to enclose special macro commands (see Table 2). To specify brace characters, use {{} and {}}.

To specify that any combination of SHIFT, CTRL, and ALT should be held down while several other keys are pressed, enclose the code for those keys in parentheses. For example, to specify to hold down SHIFT while E and C are pressed, use "+(EC)". To specify to hold down SHIFT while E is pressed, followed by C without SHIFT, use "+EC".

To specify repeating keys, use the form {Key Number}. You must put a space between Key and Number. For example, {LEFT 42} means press the LEFT ARROW key 42 times; {h 10} means press the h key 10 times.

To specify characters that aren't displayed when you press a key such as ENTER or TAB and keys that represent actions rather than characters, use the codes shown in Table 1:

Table 1

Key Code Key Code
BACKSPACE {BACKSPACE}{BS}or (BKSP} 8
BREAK {BREAK} 19
CAPS LOCK {CAPSLOCK} 20
DEL or DELETE {DELETE}or {DEL} 46
DOWN ARROW {DOWN} 40
END {END} 35
ENTER {ENTER}or ~ 13
ESC {ESC} 27
HELP {HELP}  
HOME {HOME} 36
INS or INSERT {INSERT} or {INS} 45
LEFT ARROW {LEFT} 37
NUM LOCK {NUMLOCK} 144
PAGE DOWN {PGDN} 34
PAGE UP {PGUP} 33
PRINT SCREEN {PRTSC} 44
RIGHT ARROW {RIGHT} 39
SCROLL LOCK {SCROLLLOCK} 145
TAB {TAB} 9
UP ARROW {UP} 38
F1 {F1} 112
F2 {F2} 113
F3 {F3} 114
F4 {F4} 115
F5 {F5} 116
F6 {F6} 117
F7 {F7} 118
F8 {F8} 119
F9 {F9} 120
F10 {F10} 121
F11 {F11} 122
F12 {F12} 123
F13 {F13} 124
F14 {F14} 125
F15 {F15} 126
F16 {F16} 127

 

To specify keys combined with any combination of the SHIFT, CTRL, and ALT keys, precede the key code with one or more of the following codes:

Key Code Key Code
SHIFT + 160
CTRL ^ 162
ALT % 164

 

Comments:

  • You can't use Hotkeys to send keystrokes to an application that is not designed to run in Microsoft Windows.

  • When a hotkey is detected, the keystrokes are NOT passed on to the current application.

  • Your hotkeys could interfere with another application's own hotkeys.

  • Some applications could possibly hijack your hotkeys.

  • It is NOT recommended that single keystrokes be used for hotkeys other than the function keys since these keys will then be disabled for ALL applications!

  •  

    Special Variables

    There are special reserved variables that act like functions to set or get values. These variables can be used in assignment statements and should be treated as functions and not be used as standard variables in your macro. Note that all special variables are not case sensitive.

    Special Variable Action
    READCLIPTEXT Set or get text from the TTS Reader
    TIMER Get number of seconds past midnight
    TIME Returns the current system time
    DATE Returns the current system date
    PATH Set or get current default folder path
    MID(StrVar Start End) Get a substring
    LEN(StrVar) Returns a string's character length
    VAL(StrVar) Converts a character string to a number
    STR(NumVar) Converts a number to a character string
    TIMEOUT Set or get max runtime for a macro (mins)
    ASCII Convert an ASCII code to a character
    UCASE(StrVar) Convert a string to upper case characters

     

     Macro Commands

    There are several commands that can be included in your macro code to perform actions that are not directly accessible via keystrokes and mouse clicks. These commands must be enclosed by square brackets and should be placed on a separate line in the macro. Note that all commands are not case sensitive.

    Table 2

    Action Macro Command
    Loop [LOOP Cond]..[ENDLOOP]
    Quit Loop [QUITLOOP]
    If..Else..EndIf [IF Cond]..[ELSE]..[ENDIF]
    Load File [LOADFILE "Filename"]
    Save File [SAVEFILE "Filename"]
    Open File [OPEN n "Filename"] (n=1-9)
    Close File [CLOSE n] (n=1-9)
    Read File Rec [READ n REC] (n=1-9)
    Write File Rec [WRITE n REC] (n=1-9)
    Set Variable [VAR=Val]
    Send Keystrokes [SENDKEYS "String"]
    Wait Some Time [WAIT Sec] (or "Time Date")
    Monitor Clipboard [CLIP ON/OFF]
    Spell Check Mode [SPELLCHECKMODE ON/OFF]
    Spell Check Text [SPELLCHECK]
    Cancel If.. [CANCEL IF Cond]
    Make MP3 File [MAKEMP3 "Filename"]
    Print Selected Text [PRINTSELECTED]
    Print File [PRINT "Filename"]
    Load Clipboard [LOADCLIP "Filename"]
    Save Clipboard [SAVECLIP "Filename"]
    Get Clipboard [GETCLIP Var]
    Set Clipboard [SETCLIP "String"]
    Get Multi-Clip [GETMULTICLIP n Var] (n=1-5)
    Set Multi-Clip [SETMULTICLIP n "String"] (n=1-5)
    System Command [COMMAND "Line"]
    User Input [USERINPUT "Title" Var]
    Yes/No/Cancel [YESNOCANCEL "Question" Ans]
    Show Hotkeys [LISTHOTKEYS]
    Set Focus [SETFOCUS "Classname" Ans]
    Webpage Source [WEBSOURCE "URL" Src]
    Call Macro [HOTKEY n] (n=1-999 or "Hotkey")
    Mouse Left Dn [LEFTDOWN Xpix Ypix]
    Mouse Left Up [LEFTUP Xpix Ypix]
    Mouse Right Dn [RIGHTDOWN Xpix Ypix]
    Mouse Right Up [RIGHTUP Xpix Ypix]
    Define Click Zone [CLICKZONE Xmin Ymin Xmax Ymax Trap]
    Test for Keystrokes [KEYLOG Var] (use var RESET to initialize)
    File (Dir) Exist? [PATHEXISTS "Path" Ans]
    Get Short Filename [SHORTPATH "Filename" SPath]
    Copy File [COPYFILE "Source" "Destination"]
    Delete File [KILLFILE "Filename"]
    Find String [FINDSTRING "String" "Substring" NChar]
    Find Files [FINDFILES "StartPath" Selection]
    Date Difference [DATEDIFF "DateFrom" "DateTo" Diff] (days)

     

    Conditions for LOOP, IF and CANCEL IF constructs use the following operators:

    X=Y X is equal to Y
    X<>Y X is not equal to Y
    X>=Y X is greater than or equal to Y
    X<=Y X is less than or equal to Y
    X>Y X is greater than Y
    X<Y X is less than Y
     
    • Only the logical operators AND and OR are in effect, e.g. [IF X=2 AND Y>=3 OR X<Z]. These operators can only be used for IF and LOOP conditions and must be separated by spaces.
    • Literal strings such as "Hello world" must be quoted otherwise they are considered variables.
    • Spaces may be placed between variables and operators, inside quotes or used to indent lines.
    • Variable names are not case sensitive and must contain only letters (no spaces or numbers).
    • Variables must be assigned a value before being accessed in an equation.
    • You can not mix variable types (character & number) in the same equation. Use functions STR(Number) and VAL(String) to match variable types.
       

    Concatenate strings with & e.g.:

    [VAR="world"]
    [HELLO="Hello"&VAR&"2006"]
    [SETCLIP HELLO] Hello world 2006 is sent to the clipboard

    Add the RETURN key to a string with ~ in quotes e.g.:

    [VAR="Hello"&"~"&"World"] places Hello and World on separate lines

    Any character can be represented with the special ASCII string variable. Assign the variable an ASCII character code (0-255) and when the variable gets accessed it returns the character. e.g:

    [ASCII="34"] Set ASCII code
    [SETCLIP ASCII] Send a double quote character to the clipboard

    Note that number operators / * + - ( ) must be used for numbers only, e.g.:

    [X=(Y+2)*X/5-10] where Y and X must be number type variables

     

    Examples

    • Note that all the comments in the following code examples in blue print are for instruction only and would not be allowed in the actual macro code.

     

    Code Comments

    You can document the macro code with non-executable comment lines by starting a line with the # character. This must be the first non-blank character on the line, which causes the Hotkeys Editor to ignore the line. Use the [SENDKEYS] statement if you wish to send # as the first character on a line.

    # This comment line will be ignored
    [I=1]
    [LOOP X=1-10]
    # Computes 10 to the power of 10
    [I=I*10]
    [ENDLOOP]

     

    Set Variable

    [Var=Val] Set variable Var to a  value
     
    [X=2] Set X to a number value
    [X="Hello world"] Set X to a string value
    [X=Y] Set X to the value of variable Y

    Note that only string and number type variables may be set. Variable names must NOT contain a number, e.g. X2=Y3 is not valid.

     

    Loop

    [LOOP X=1,2,4-6,10] Loop 6 times, X is a variable with the values 1,2,4,5,6,10
    (code)
    [ENDLOOP]
    or
    [LOOP X=Y] Loop while X=Y, quit loop when X<>Y
    (code)
    [ENDLOOP]


    The number of times to loop is defined by the condition in the
    [LOOP..] statement. The condition is either a sequence counter e.g. X=1,2,4-6,10 or a True/False test e.g. X=Y, where the loop ends when X=Y is False. With a sequence, each time through the loop the sequence variable is assigned the next value in the sequence. Note that a range can represent a numbered sequence, e.g. 1-5 is 1,2,3,4,5 Use a dash (-) to set a range and commas (,) to separate numbers.

    • Note that endless loops in a macro are a hazard and consequently Hotkeys will not allow a macro to exceed 3 hours of execution time or 100,000 executed lines of code, unless the TIMEOUT variable is set. Use a number range rather than a condition in your [LOOP] statement whenever possible. The ESCAPE key halts a running macro in an endless loop. 

     

    Quit Loop

    [LOOP X=1-1000]
            (code)
            [IF Y=X] test for premature end of loop
                    [QUITLOOP]  go directly to [ENDLOOP]
            [ENDIF]
            (code)
    [ENDLOOP]


    The QUITLOOP command is equivalent to setting the LOOP condition to TRUE then bypassing all commands between QUITLOOP and ENDLOOP.

     

    If..Else..EndIf

    [IF X=Y OR F=""] Execute code if variable X equals variable Y or variable F is empty
    (code)
    [ELSE] (Optional) Execute code if X is not equal to Y and F is not empty
    (code)
    [ENDIF]

    The [IF..] condition must be composed of variables or literals separated by the =, <, >, (, ), OR, AND operators. You may not include equations in the condition, e.g. X+Y or X&Y. Special variables are permitted.

     

    Load File

    [LFILE="C:\TMP\NOTES.TXT"]
    [LOADFILE LFILE] Loads a text file into the ReadClip TTS Reader

    The TTS Reader can be used like a variable to hold text which macros can share. Access the reader with the variable READCLIPTEXT, (read from or copy to). For example:

    [GETCLIP READCLIPTEXT] Copy the clipboard into the ReadClip Reader.
    [SETCLIP READCLIPTEXT] Copy any text in the ReadClip Reader into the clipboard.

     

    Save File

    [GETCLIP READCLIPTEXT] Copy the clipboard into the ReadClip Reader.
    [OFILE="C:\TMP\READCLIP.TXT"]
    [SAVEFILE OFILE] Saves the text in the ReadClip TTS Reader (if any) to a file.

    The clipboard text can be saved to a file by first copying the clipboard to the TTS Reader.

     

    Open File/Read/Write/Close

    This code creates a batch file that when executed deletes all the files in a folder. This code illustrates opening a text file to read or write records, and closing the file. Use a [LOOP] statement to read through a file’s records. Reaching the end of file behaves like the [QUITLOOP] statement and automatically exits the loop.

    [IN=1] Assign a unit number (1-9) for the input file
    [FOLDER="C:\PICS"] Set the target folder
    [DFILE="C:\TMP\FILENAMES.TXT"] Destination file for output
    [CMD="COMSPEC DIR/B "&FOLDER&" >"&DFILE] Set up the command line
    [COMMAND CMD] Send command
    [WAIT 1] Give the command time to create the file
    [OPEN IN DFILE] Open input file (use variable or string in quotes)
    [OUTFILE="C:\PICS\DELFILES.BAT"] Output file for write
    [OUT=2] Assign a unit number (1-9) for the output file
    [OPEN OUT OUTFILE] Open file OUTFILE
    [LOOP X=1-10000] Set loop to a bigger number than needed
    [READ IN REC] Read 1 record into variable REC, exits the loop at end of file
    [OREC="DELETE "&REC] Output record
    [WRITE OUT OREC] Write record to OUTFILE
    [ENDLOOP] Enclose the LOOP
    [CLOSE IN] Close input file
    [CLOSE OUT] Close output file
     
    • Records can not be read from and written to the same opened file.
    • An error is generated when attempting to open a non-existing file for reading
    • All opened files will be closed after a macro terminates
    • Only text records can be read from an opened file, (delimited by CR)
    • Only text records can be written to an opened file
    • Up to 9 files may be opened simultaneously
    • Each opened file must have a unique unit number (1-9)

     

    Cancel If

    [LOOP X=1-1000] Big loop
    [GETCLIP F] Copy clipboard to variable F
    [CANCEL IF F=""] Quit macro if the clipboard is empty
    (code)
    [WAIT 1] Delay 1 second for each test
    [ENDLOOP]
     
    This command can be placed anywhere in the code to abruptly quit the macro if a specified condition is met.

     

    Sendkeys

    [VAR="This is some text to send"]
    [SENDKEYS VAR] Sends the string to the active window as if typed from the keyboard.

    This command allows you to compose a text string before sending it to the active window, otherwise, a Hotkeys command line can only send a literal string to the active window. The sent string must conform to the same Hotkeys formatting rules as printable and non-printable characters. The actions resulting from the sent string depend on the active target application.

     

    Wait

    [T=10]
    [WAIT T] Halts the processing for T seconds
    or
    [T="10:14:55 AM 25/04/2007"]
    [WAIT T] Halts the processing until the specified date

    The range is .1 to 3600 seconds. If a time and date are designated, then the processing is halted until that time is reached. This is the only method for a macro to exceed a running time set by the TIMEOUT variable. Use the ESC key to abort the macro while it's waiting.

     

    Clipboard

    Access the Windows clipboard or ReadClip's multi-clipboard

    [CLIP ON] Monitor the clipboard for Read or Spell Check
    [CLIP OFF] Stop monitoring clipboard
    [LOADCLIP "filename"] Load a text file into the clipboard
    [SAVECLIP "filename"] Save text (or an image) from the clipboard to a file
    [GETCLIP Var] Copy the clipboard text into a variable
    [SETCLIP "String"] Copy a string (or variable) into the clipboard
    [SETMULTICLIP n "String"] Copy a string (or variable) into a clip (1 to 5)
    [GETMULTICLIP n Var] Copy a clip (1 to 5) into a variable

     

    Make MP3 File

    [MAKEMP3 "filename"] Converts selected text into a spoken MP3 file.

    This command enters the filename into the Make MP3 dialog form and allows the user to adjust the MP3 settings prior to the conversion. The command fails if the file pathway does not exist or there is no text in the TTS Reader. Use the READCLIPTEXT variable to insert text into the TTS Reader.

     

    Print

    [PRINTSELECTED] Prints selected text, if any (not formatted).
    or
    [DOC="C:\TMP\DOCUMENT.RTF"]
    [PRINT DOC] Print file (formatted)

     

    Spell Check

    [SPELLCHECKMODE ON] Spell check mode On
    [SPELLCHECKMODE OFF] Spell check mode Off
    [SPELLCHECK] Spell check selected text.

    Once SPELLCHECKMODE is ON, and ReadClip is monitoring the clipboard, any text that gets copied into the clipboard will be spell checked. Use the [CLIP ON] command to get ReadClip to monitor the clipboard (for read or spell check).

    The
    [SPELLCHECK] command spell checks selected text and fails if no text has been selected.
     

     

    System Command

    [CMDFILE= "C:\TMP\NOTES.TXT"] File to load
    [CMD="NOTEPAD.EXE "&CMDFILE] Designate the target program (NotePad)
    [COMMAND CMD] Send command line to the OS

    The COMMAND function uses the Windows command line interface to issue commands to the OS. This example opens Notepad and loads a text file. To run a system command such as DIR, prefix the command line with COMSPEC, e.g.

    [COMMAND "COMSPEC DIR/B C:\PICS\*.JPG >PICFILES.LIS"] Creates a file listing the names of all the JPG files in folder C:\PICS.

    Note there must be a space after COMSPEC. All system commands that use the COMSPEC prefix do not display the command window and keep the focus on the current application.

    If the command string starts with mailto: then your command line will attempt to create an email via your default email program with the address, subject, and the body filled in and ready for submission.

    E.g. create new email in Outlook Express (if OE is your default email program).

    [USERINPUT "Enter an email address" EMAIL]
    [CANCEL IF EMAIL=""]
    [USERINPUT "Message to send:" TEXTBOX]
    [CANCEL IF TEXTBOX=""]
    [T=TEXTBOX&"~"&"This is the last line."] RETURN (~) is replaced by "%0D%0A" in the sent string
    [M="mailto:"&Email&"?subject=Re:Help"&"&body= "&T]
    [COMMAND M]
     

     

    Yes/No/Cancel

    [YESNOCANCEL "Question" ANS] Suspends the macro and requests a response from the user.
     

    The quoted question (or variable) should be answerable to Yes or No or Cancel. If the question does not contain a question mark (?) then the only response from the user is OKAY. The ANS variable is a string that will contain either "YES" or "NO" or "CANCEL" from the user. The ANS variable is not used for a non-question response (OKAY). By default the Question (or message) text is center-aligned. To left or right align the Question (or message), name the ANS variable to LJUSTIFY or RJUSTIFY, respectively, e.g. [YESNOCANCEL "Question" LJUSTIFY]

    If the ANS variable is set to a number value (in quotes) then the message box will behave like a popup that will disappear after ANS seconds, e.g. [ANS="5"]. The ANS variable can also be initialised to [ANS="0"] before the [YESNOCANCEL] statement to force an OK response from the user.

     

    User Input

    [USERINPUT "Prompt Message" VAR] Suspends the macro and requests input from the user.

    The quoted prompt message (or variable) should describe the type of information requested. If the user response variable is named TEXTBOX then the user can input multiple lines of text via a textbox control. The prompt message can also be used to display text in the textbox.

    The prompt message can also be formatted to open 1 of 5 common dialog boxes for user input.
    Use the Functions->[USERINPUT] menu option on the Hotkeys Editor to access all available dialog parameters, which includes retrieving short path file names, e.g. C:\DOCUME~1\ALLUSE~1\DOCUME~1\Hotkeys.txt

     

    List Hotkeys

    [LISTHOTKEYS] Opens a listing of the ReadClip hotkeys and their descriptions.

    This allows you to assign a hotkey to view a listing of all the defined hotkeys. The user can edit or enable/disable individual hotkeys from the listing.

     

    Set Focus

    [CLASSNAME="Notepad"]
    [SETFOCUS CLASSNAME SUCCESS] Sets the focus to the topmost instance of Notepad.

    This command allows you to set the focus to a specific application. The class name of the application to receive the focus must be set in the "Classname" parameter. If the class name is not recognized or the target application is not open, this procedure will fail and the "Success" parameter is set to "NO" The application class name must match exactly. Setting the focus on an application brings it to the foreground and highlights the title bar to indicate that it's the active form. Use the Insert>[SETFOCUS]  menu option in the Hotkeys Editor to determine the class name for an application.

     

    Webpage Source

    [URL="http://www.readclip.com"]
    [SRC="c:\source\readclip.htm"]
    [WEBSOURCE URL SRC] Retrieve the source HTML code from the URL and write it to a file

    This command specifies a webpage URL and returns the HTML source code in the SRC variable. The macro stops at this statement and waits up to 1 minute for a response before timing out, in which case the SRC variable is assigned the string "Timed Out". If the SRC variable is initialized to a file name, the source code will be written to the file instead and the SRC variable is not modified. If for any reason the file cannot be created or written to, then the SRC variable is assigned the string "File Error". Note that an error condition occurs when attempting to read from a non-existing file, so it is recommended to test the SRC string before attempting to read from the file.

     

    Call Macro

    [HOTKEY "Select All"] Adds an existing Hotkey's macro code to the current macro.

    Designate the hotkey by number, or by the hotkey in quotes (e.g."^a"), or the hotkey description in quotes (e.g. "Select All"). A reference to a variable is not permitted. This command fails if the hotkey cannot be found. This command allows you to call another (or the same) hotkey from the current macro. Note that the macro code actually replaces the [HOTKEY] statement. This is similar to calling a subroutine, except that the called hotkey’s variables are not hidden from the calling macro.  Note that a called (subroutine) macro should NOT contain a [HOTKEY] command that refers back to the calling macro. This can potentially lock both macros into an endless loop, which can result in memory overflow and catastrophic error. Use the ESC key to quit a running macro.

     

    Mouse Events

    Mouse events are usually recorded while creating a macro. Mouse commands must be enclosed in brackets and they have 3 parameters:

    1) Button Up/Down
    2) X-pixel screen position
    3) Y-pixel screen position
     
    [LEFTDOWN 240 468]
    [LEFTUP 240 468]
    [RIGHTDOWN 240 468]
    [RIGHTUP 240 468]

    Drag and drop operations can be simulated by a change in position between the LEFTDOWN and LEFTUP mouse events. When creating a macro, the [WAIT] command is included to simulate the time elapsed between mouse events.

     

    Click Zone

    [CLICKZONE Xmin Ymin Xmax Ymax Trap]

    Mouse clicks within a defined region on the screen can be intercepted to activate code within a macro. The macro stops at the CLICKZONE statement and only proceeds when a mouse click is detected in the defined click zone, or the macro times out (default=3hrs). If the macro times out, no statements are executed. All actions to take are defined in the macro code proceeding the CLICKZONE command.  A mouse click detected within the click zone is returned in the Xmin, Ymin variables (unless they are literal values).

    The CLICKZONE statement must be enclosed in brackets and has 5 parameters:

    1. X-minimum pixel screen position
    2. Y-minimum pixel screen position
    3. X-maximum pixel screen position
    4. Y-maximum pixel screen position
    5. Trap TRUE=traps the mouse clicks FALSE=sends mouse clicks to screen

    [LOOP X=1-1000] big loop
            [CLICKZONE 100 100 200 200 TRUE] define the click zone around an icon (macro stops here and waits)
            [USERINPUT "Input a password to access this program." VAR] a click in the zone has been trapped
            [IF VAR="zebra"] guess the password and allow access to the click zone
                    [LEFTDOWN 150 150] double-click icon (clicks are only detected at the CLICKZONE statement)
                    [LEFTUP 150 150]
                    [WAIT .2]
                    [LEFTDOWN 150 150]
                    [LEFTUP 150 150]
            [ENDIF]
    [ENDLOOP]
     


    Key Logging

    [KEYLOG Var] copy all the keystrokes in the key log buffer into variable Var
    [KEYLOG RESET] use the variable name RESET to clear the key log buffer

    This function retrieves all keystrokes that have been pressed since the first [KEYLOG Var] statement was executed. The first occurrence of the [KEYLOG Var] statement activates the key logger and initializes the key log buffer. Use a variable called RESET to clear the key log buffer. All subsequent [KEYLOG Var] statements copy all the keystrokes stored in the key log buffer into a variable.


    Path Exists

    [PATHEXISTS “Path” ANS] ANS="YES" or "NO" if the file or folder exists
    or
    [PATHEXISTS “Path” CREATE] CREATE="YES" if successful creating "Path" or "NO" otherwise

    This function returns whether or not a file or pathway exists. "Path" may be a literal string or a variable name. The ANS string variable returns “YES”, if a file or path exists, and “NO”, otherwise. If the ANS variable is named CREATE then the folder "Path" is created and the CREATE variable returns whether or not the folder was created successfully. If the target folder is not specified ("") the current default folder will be assumed.
     

     

    Short Filename

    [SHORTPATH "Filename" SPATH] SPATH holds the short filename

    This function returns the short path of a filename. This may be required when a filename parameter is included in the [COMMAND Cmd] statement. Many Windows applications parse their command line parameters with spaces, which may be part of a long pathway. Converting to a short path, however, removes all spaces and converts the folder and file names to an f8.3 format, e.g. C:\DOCUME~1\ALLUSE~1\DOCUME~1\READCL~1\Hotkeys.txt

     

    Copy File

    [COPYFILE "Source" "Destination"] Copy to or overwrite the destination file

    This function creates a copy of the source file to a destination file. The source and destination files should include their respective folders, otherwise the current default path is assumed. The function fails if the source file or the destination folder does not exist. If "Destination" is a variable named
    RENAME, then the "Source" file is renamed instead of copied.

     

    Delete File

    [KILLFILE “Filename”] no confirmation is given

    This function deletes a file from a folder. The function fails if the file does not exist or is locked by another application. The filename should include the folder path unless the
    PATH variable has been set to the target folder. The filename may be a literal string or a string variable.

     

    Find Substring

    [NChar=1] set the start search position (use a negative value for a reverse search)
    [FINDSTRING “String” “Substring” NChar] places the search results in NChar

    This function searches for a sub-string within a string and if found returns its character position relative to the first character in the string into the NChar variable. If the search fails NChar=0. Variables and literals may be used for the string parameters. The number variable NChar is assigned the start position, which must be a number between 1 and LEN(String). If NChar is assigned a negative start position then the search starts at +(NChar) and a reverse search is performed to the first character in the search string. Note that all strings are case sensitive.

     

    Find Files

    [FSEL="C:\Docume~1\AllUse~1\Docume~1\ReadCl~1\Search.txt"]
    [SPATH=PATH] start in current PATH folder
    [FINDFILES SPATH FSEL] if FSEL is initialised the file selection output is written to a file

    This function opens up a file search dialog box that allows you to perform a recursive search for files in folders and sub-folders. Files may be selected from the search results, which are returned via the FSEL variable or written to a file (if initialised in the FSEL variable). The dialog box also provides a history of previously selected folders and changes to the PATH variable.

     

    Date Difference

    [DATEFROM="10:23 AM 09/03/2006"] set reference date
    [DATETO=TIME&DATE] current time & date
    [DATEDIFF DATEFROM DATETO DIFF] the returned difference is in fraction of days

    This function compares 2 dates and returns their difference in fraction of days. If either DATEFROM or DATETO is a filename, then the creation date of the file is used (if it exists).

     

    Comments:

    There are 3 methods for running a macro: by pressing the associated hotkeys, or by clicking the Run button on the Hotkeys Editor or the List Hotkeys form, or with a QuickLaunch desktop icon. It's important to note that for a macro to function correctly the exact same conditions must exist in the Windows environment as when the macro was created. The macro must also begin from the same starting point (the topmost Windows application). It’s almost guaranteed that the macro will fail otherwise and possibly with undesired consequences. For this reason the Hotkeys program offers to delay the start of the macro by a time specified by the user to ensure that the focus is placed in the appropriate window. Keep this in mind if you’re writing a macro program that modifies files or data such as a makeshift data entry macro.

    When a macro is running, the ESC key can be used to halt its execution. Clicking on the ReadClip icon while the macro is running will also stop its execution.

    Create a macro by writing the code directly into the Hotkeys Editor or by selecting the Make Hotkeys Macro option in the Hotkeys menu. This feature logs all your keystrokes and mouse clicks and records them into the Hotkeys Editor. Click on the ReadClip icon to stop recording the macro.

    Send all queries to support@readclip.com

     

    Back