Description: C:\Users\Martin\Documents\Development\Website\kt3new_files\image001.gif



Version 3.20

Version 3.15

Version 3.14

Version 3.13. 2

Version 3.12. 2

Version 3.11. 2

Version 3.10. 2

Version 3.07. 3

Version 3.06. 3

Version 3.05. 3

Version 3.04. 3

Version 3.03. 4

Version 3.02. 4

Version 3.01. 4

V3.00 New Features. 5

Trigger Text (similar to autotext, autocomplete etc). 5

Variables. 5

Syntax highlighting. 5

Left-click menu navigation and groups. 5

Goto and Labels. 5

New Cancel field. 6

New "if" logic. 6

Changes to Wait, Pause and Loop fields. 6

Changes to Wait field. 6

Changes to Ask field. 6

Changes to Include, Clipboard and Selection fields. 7

Selection field. 7

Changes to Message and Input fields. 7

Changes to Activate and Run fields. 7

Changes to key combinations. 8

Environment variables. 8

Item hotkey turned off while item running. 8

Symbols and Accented characters. 8

Change to Mouse action wizard. 8

Some timings speeded up. 8

No focus error. 9

Changes in Edit text items window.. 9

"Changing to action:macro" dialog. 9

Right click anywhere change. 9

"On Window" schedule. 9

Timed schedule. 9

Paste functionality. 9

{Enter} keystroke. 9

New fields {IgnoreReturns} {IgnoreTabs} and {IgnoreBlanks}. 9

Organizer window.. 10

Bug fixes. 10

Ignore returns / no keyboard focus error. 10

Enter key not clearing in Key combination wizard. 10

Pause of less than one second. 10

Right-click anywhere. 10

Integer Variables. 10

String Variables. 12

"If" logic. 13


Version 3.20

·    Fix for compatibility with Windows 10. V3.15 users please note – no need to upgrade unless you have Windows 10.

Version 3.15

·    If you have an "Edit hotkey" set in Settings / Customize, this will now take you to the last edited or run item (previously last edited). So if you use a KeyText item and realize there is a correction you want to make in it, pressing the Edit hotkey will take you straight to the item in the Edit window.

·    To help users with keyboards which have no Pause key, the f12 key now has the same effect - allowing the pausing and resuming of a macro item while it is running.

·    Fixed: the Auto-add feature would sometimes append to the wrong item after a {Selection} field was used.

·    Fixed: when more than one global string variable was used in an item, sometimes their values would not be remembered.

·    Fixed: After a {CallSelect...} field, sometimes other fields - eg {Ctrl c}, {IgnoreReturns} - would not work correctly.

·    Fixed: the {Ctrl} field, to press the Ctrl key on its own, was not working.

Version 3.14

·    The Caps Lock restore option (in Settings Global) would not work after an item linked to another item. Now fixed.

·    The setting in Settings Customize to allow a right-click of an item in the KeyText menu to open the Edit window did not work consistently in Windows 7. Now fixed.

Version 3.13

·    Detects Windows 7, and on first use displays a dialog advising the user that the KeyText icon in the taskbar Notification Area cannot be shown automatically. The dialog contains a button that opens the Windows Notification Area Settings, and allows "Show icon and notifications" to be chosen for KeyText.

·    In rare circumstances, changes to the Menu text of an item were lost when moving from one item to another in the Edit text items window. Now fixed.

·    After use of a regular expression, sometimes the result of an "Ask" field was not filled in correctly. Now fixed.

·    After use of the press/release shift keys, for example {Alt+} and {Alt-} to press and release Alt, sometimes subsequent text would not be typed correctly. Now fixed.

Version 3.12

·    "Check for updates" button now added to the About dialog (if the "How to purchase" button is not active), and Edit text items Help menu.

·    In the Key Combination wizard, the Windows key can now be chosen in combination with Shift, Ctrl and/or Alt. Note that the field syntax itself has not changed, as this combination was already allowed - just not selectable in the wizard.

·    In the "Check text" wizard (Insert Field Wizard / Macro Control / If clipboard etc contains), the option to ignore trailing Returns on the clipboard is now enabled for the "have no text" selection. Again, note that the field syntax itself has not changed, as this functionality was already allowed - just not selectable in the wizard.

·    The Edit text items window did not remember if it was maximized the last time it was used; now fixed.

·    "Trigger text" has been added as a menu selection to the Item menu of the Edit text items window. If selected, focus moves to the Trigger text box on the toolbar.

·    If an item is set to ignore returns, tabs or blanks, and only these characters occurred after a {Run...} field (for example: {IgnoreBlanks}{Run "calc.exe"}      ), there would be a delay before the item finished; now fixed. [Delay was because KeyText thought it had more to do after the Run field.]

·    Fixed the following Wait field scenario {Wait 1 $"c:\temp\*.*" if not found goto notfound}} when the specified folder is empty. Now, if no files are found, the item will go to the label :notfound, as expected.

·    Fixed regular expression error when using the operators \{min,max\} if min was 0 or not specified. For example, {Clipboard ".\{,10\}" "&"} would result in up-to 11 characters in the replacement text.

·    Fixed bug which could result in an item being truncated - in the following example scenario. An item calls another item using {Call X}. The called item contains an Input field, similar to {Input "Test" "Message"} or {temp=Input "Test" "Message"}. When the running item reaches the Input field, Cancel is clicked (or Esc is pressed), cancelling the called item and returning control to the original item. If, when the item has finished, the called item is opened in the Edit text items window, text after the canceled field will have disappeared, and if the item is then also edited and saved - that loss would be permanent. Now fixed.

Version 3.11

·    Fixed problem in v3.10 where occasionally the KeyText unlock code (for the full version) would not be stored.

·    Fixed problem where command line arguments for running KeyText did not work, including desktop shortcuts to run individual macros.

·    Addressed issues with Trigger text when used on keyboard layouts with "dead" keys for entering accented characters.

Version 3.10

·    Fixed long save-time problem when changing KeyText data. Note this was only observed when running in Vista, and when KeyText was launched at startup.

·    Extended the Activate field to allow specifying a window other than the top window with the given title. For example, {Activate 2 "Notepad"} will find the 2nd window down with Notepad in the title. Note that an integer variable can be used instead of a number.

·    The trigger-text suspended setting is now remembered from one KeyText session to the next, and the ability to set it has been added to the top of the Organizer dialog (in addition to the right-click menu).

·    Bug found when assigning to an integer variable the value of integer y, as in {#n=y}; now fixed. Note - this affected the sample item "Calculate day of week", which sometimes gave the wrong response.

·    "Out of range" bug on multiplying an integer variable by another variable which is negative was reported; for example, {#a*=#b} gave  this error if integer b held a negative value. Now fixed.

·    If there was a {Selection} field in a called item, and on running the item no selected text was found, the macro would stop rather than return control to the calling item. Now fixed.

·    When using an item with a hotkey and a {LinkSelect...} field, after the first time it was run the hotkey would no longer function. Now fixed.

·    Fixed bug in date formats where single quotes can be used to delimit text to be included "as is"; an extra single quote would appear in the output. Now fixed.

·    Default KeyText data file changed to KeyText3.kt3 (was KeyText.kt3) to avoid confusion when converting an old KeyText.ktt to .kt3 format.

Version 3.07

·   Fixed some issues relating to using KeyText on Windows Vista - including fix to Trigger Text.

·   The field {IgnoreReturns Off} can now be used in an item to override "Ignore all Returns" (if that has been set in global settings).

Version 3.06

·   Added shortcut key "d" to toggle Auto-add in the Options dialog.

·   Fixed problem in "Display a message" insert field wizard page which prevented the Automatic close seconds count being added to a Message field.

·   Fixed bug which occurred if global variable names longer than 26 characters were used.

·   Fixed bug relating to auto-reset of global integer variables where a set time is specified.

·   Fixed bug which caused an item to run on past the end if an "If....then" field was used but no "Endif" was found.

·   Further updates made to program to improve compatibility with Windows Vista.

Version 3.05

·   The Help file states that to include a curly bracket { in an item, two should be used, as in {{ - in order to stop KeyText interpreting it as a field. However, this did not work, and the item would stop short. Now fixed.

·   Some updates made to program and help file to improve compatibility with Windows Vista.

Version 3.04

·   Fixed problem where a nested "If...then...End if" contained a field with an embedded field. If the outer "If...then...End if" evaluated as false, KeyText jumped to the wrong End if.

·   An item set to Action:Paste which began with a field and was launched by Trigger Text would sometimes omit the first few characters. Now fixed.

Version 3.03

·   Added ability to set integer variables to the current mouse cursor co-ordinates, allowing KeyText to simulate mouse actions relative to the current location.

·   Changed documentation to indicate that the scope of a local integer variable is the item it is in, and any items it calls or links to.

·   Local string variables scope included called items; now extended to also include linked-to items.

·   Changes to global string variables are now saved prior to a call or link so that the new value is available in the called or linked-to item.

·   Fixed bug which sometimes meant that Trigger Texts would not work after an item was started using a hotkey.

·   Fixed bug where (very rarely) the Ctrl key on its own could get set as a KeyText hotkey.

·   Fixed minor errors in the output from the Insert Field wizard (relating to Goto and Input fields).

·   Fixed error in loops when they are nested more than 2 deep.

·   A Goto backwards in a loop meant that the loop count was lost (and it did not repeat at Endloop). Now fixed.

·   Use of {Esc} in an item would, in certain circumstances, cause the item to abort, rather than send Esc to the target application. Now fixed.

·   Fixed problem where an "If" test for no text would not always give the correct result.

Version 3.02

·   The "Include string variable, clipboard etc" section of the Insert field wizard has been extended to show a drop-down list of the current global string variables, to allow you to select one of them (or type the name of a new one).

·   Mouse action functionality expanded to allow a click and drag operation from the current mouse location.

·   When setting up an "if" on an environment variable, the Insert field wizard gave incorrect syntax. Now fixed.

·   Syntax coloring for an "if" on an environment variable was incorrect. Now fixed.

·   The Help file tutorial gave incorrect syntax for an "if" on a string variable, in the section "How to vary text depending on user input". Now corrected.

Version 3.01

Trigger Text bug fixes:

String variables

Insert Field Wizard

Help file

V3.00 New Features

Trigger Text (similar to autotext, autocomplete etc)

New field on the "Edit text items" tool bar (2nd text box from right) allows you to specify a series of characters (up to 20) which will trigger that macro. KeyText will monitor keystrokes, and when that sequence is detected will delete the letters and launch the macro.

Example uses:

Set #em to type your email address anywhere.

Set  e// to type é.

Or have a macro with text "calendar", and trigger text "calander" - so that every time you mis-type it, it is corrected.

Note that if you have more than one KeyText running at a time, all trigger texts are active.

Trigger texts can all be suspended by selecting "Suspend trigger text" from the right-click menu.

Trigger texts can be viewed in the Organizer window; and if you sort on Trigger text by clicking the column header, you will see them grouped together.

It is possible to exclude certain applications or windows from responding to trigger texts. For example, if an item with trigger text begins with:

{If title contains "word" cancel}

{If exe = "notepad.exe" cancel}

then the trigger text for that item will be ignored if the active window title contains "word", or the application is notepad. These fields must be at the beginning of the item to have this effect, and – for this scenario only – will also work in an Action:Paste item.

The following special keys can be included in trigger text: {f1}, {f2}... {f12}, {Num *}, {Num +}, {Num -}, {Num .}, {Num /}, {Num 1}, {Num 2}, {Num 3}, {Num 4}, {Num 5}, {Num 6}, {Num 7}, {Num 8}, {Num 9}. For example, if you wanted the f10 key followed by 123 to start an item, use Trigger text:


[Note that if you have changed the characters to designate a field, you must use [f10]123 or <f10>123.]


See sections on Integer Variables and String Variables below.

Syntax highlighting

Macros in the "Edit text items" window will now show color highlighting for fields, strings within fields, comments and labels (new). Also new is color shading on the tabs for selecting items; red indicates the item contains text, green for empty, and yellow indicates the item has changed since the window was opened.

Left-click menu navigation and groups

There is a new item on KeyText’s left-click menu: Go to group>. This opens up a popup with 1 to 9, and allows you to go straight to that group of items. For example, selecting 5 will take you to the 5A to 5Z range, avoiding pressing Next four times.

You can also name these groups with a new option in the Organizer dialog: "Group names".

For example, you could give group 5A to 5Z the group name "Accounts"; this will appear in the title bar of the Edit text items window, as a label on the 5A to 5Z list on the left-click menu, and on the popup mentioned above allowing navigation straight to that group.

Goto and Labels

Goto label functionality has been added. A label is specified as follows:


and {goto myLabel} will jump to it. This feature is also available in the Wait field (see the appropriate wizard), so that, for example:

{Wait 10.0 "myText" if not found goto notFound}

will continue if a window with title "myText" appears within 10 seconds, but jump to {:notFound} if not found.

Goto label is also available as part of the new "if" features.

New Cancel field

{Cancel} has been added to abort an item, and can be useful when if or goto logic is used.

New "if" logic

Conditional logic is now available in KeyText, based on:

clipboard text (equals, not equals, contains, not contains, empty, or like regular expression)

selected text (equals, not equals, contains, not contains, empty, or like regular expression)

window title (equals, not equals, contains, not contains, empty, or like regular expression)

exe (process) name (equals, not equals, contains, not contains, or like regular expression)

string variable ("ask" field result) (equals, not equals, contains, not contains, or like regular expression)

Environment variable (equals, not equals, contains, not contains, or like regular expression)

pixel color

integer variable


With the exception of integer variables, these can be set up using new wizard screens. In the Insert field wizard, select "Macro control", and then choose the "If clipboard text / window title..." or the "If pixel color" option. Regular Expressions can be used when examining the text, allowing different actions to take place depending on what is on the clipboard, selection etc.


For further information see section If logic below.

Changes to Wait, Pause and Loop fields

The number 0, when used in a Wait, Pause or Loop, continues to start an indefinite wait, pause, or loop – for consistency with previous versions. However, if the zero is from a variable or the result of an Ask field this indicates no pause or wait, or that the loop should be skipped. For example, {Loop {#x}}this would be skipped if variable x=0{Endloop}.

Note that {Loop 1} is now allowed.

Changes to Wait field

As mentioned, "goto" label is now an option in a Wait field.

Another new option is the ability to wait for status bar text. Note that this will only work if the foreground application uses the standard windows "status bar" common control. It can therefore be used with Internet Explorer to wait for "Done", as in:

{Wait 60.0 -"Done"}

This would continue as soon as "Done" appeared in the status bar – but cancel if not found within 60 seconds.

But this would not work in Firefox, as it does not use the standard status bar.

[Note – a possible way of detecting page done in Firefox would be to use {If pixel color...} to detect the color of the Stop toolbar button – which changes from red to grey when the page has loaded. See If logic.]

Changes to Ask field

Note that the response to an Ask field is now a string variable which, if its name ends in @, is treated as "global" and is stored for use later by any item.

The Ask dialog box is now scrollable, so that the amount of text that can be entered is no longer limited by the size of the text box.

Five new options are available on the Ask wizard:

1.         Choose whether Return key adds a new line, or is similar to clicking OK. The default is new line; to edit an existing Ask field so that Return clicks OK, add ^ character, as in: {Ask ^"Enter information" "Pressing Return will OK this dialog"}

2.         Previously the user response to the Ask field was inserted at the location of the Ask field – and again at any repetition of the title (wrapped in curly brackets). Now you can choose not to have the user response inserted at the Ask field. ; To edit an existing Ask field so that it is not replaced with its response, add - (minus/hyphen) character, as in: {Ask -"Enter information" "(which will not be inserted at this point)"}

3.         Choose whether static text displayed on the dialog is centred or left-aligned.

4.         Choose to have the output URL encoded, so that, for example, a SPACE character types as %20. {Ask %"Search" "Enter search text"} would, if you responded Red Balloon, give Red%20Balloon. Remembering that the name of the Ask can be used to repeat the response, with this example {Search} would output Red Balloon, and {Search%} would output Red%20Balloon.

5.         Added the ability to do a regular expression replace when repeating the ask result (or string variable); this can be set up on the "Include clipboard…" wizard page. For example, {Search "\(.\{3\}\).*" "\L\1"} would ouput red - the first 3 characters of Red Balloon, in lower case.

Changes to Include, Clipboard and Selection fields

The Clipboard field now gives the current contents of the clipboard, not, as before, the contents when the item started. For this previous functionality use {StartClipboard}.

An additional option is available for these fields: "Encode text for URL". This ensures that when KeyText outputs the text everything except numbers, letters and certain characters are encoded as, for example, %20 (SPACE). This allows, for example, a Selection field to be included in the URL of a Run field and ensures that any selected special characters are correctly encoded.

Also added the ability to do a regular expression replace, allowing manipulation, capitalisation, etc of the clipboard, selection etc.

Selection field

If KeyText finds {Selection} in an item set to Action:Macro, when running it the selected text in the foreground window is copied to the clipboard and used to replace the {Selection} field.

KeyText now checks the process name before doing this, as not all applications accept a Ctrl-C for paste.

If the process is command.exe or cmd.exe KeyText will simulate a Return keypress, which copies marked text to the clipboard.

If the process is emacs.exe KeyText will simulate Alt-W.

Any other process – KeyText will simulate Ctrl-C.

Changes to Message and Input fields

New option in the wizard allows you to choose whether static text displayed on the dialog is centred or left-aligned.

Changes to Activate and Run fields

Activate, and the activate option within a Run field, have been extended to allow exact match of window title. See the appropriate wizard pages. For consistency with the Wait field, the character to denote this is "!". However, this was previously used in Activate/Run for force activate. This is now denoted by *, but backward compatibility is preserved as the position of the ! is significant.

For example, {Activate !"exactTitle"} will activate a window with the exactTitle specified. {Activate! !"exactTitle"} or {Activate* !"exactTitle"} will force-activate it.

Changes to key combinations

It is now possible to have KeyText press shift/ctrl/alt key combinations which do not include another key. For example, {Ctrl} will simply simulate a press and release of the Ctrl key.

It is also possible (but not through the wizard – must be entered manually) to specify that a key be held down – for example, {Shift+}, {a+} etc to press, {Shift-}, {a-} to release. So {Shift+}abcde{Shift-} would type: ABCDE.

Note that key repeat will not occur if a key is "held down" by KeyText.

Environment variables

System environment variables can now be included in a macro, using, for example,  {EnvVar "USERNAME"}. The "Include Clipboard, selection (etc)" wizard option lets you set this up.

Also – when using a Run field to launch a file, and environment variables in the form %variableName% are expanded.

Item hotkey turned off while item running

A hotkey associated with an item is now turned off while the item is running. Combined with new if/then logic, this can allow KeyText to trap/pass through hotkeys depending on the application running. For example, to trap the F1 function key in Notepad only – but allow it to operate normally for every other application – use an item with hotkey F1, and starting as follows:

{If exe not contains "notepad" then}{F1}{Cancel}{Endif}...else do Notepad specific stuff here...

Also note that if a KeyText dialog is up (eg, Settings, Edit text items) and a hotkey associated with any item is pressed, if KeyText is not the foreground window the hotkey will be passed through. In the above example, this means that KeyText would not trap the F1 if it had a dialog up.

Symbols and Accented characters

To "type" symbols and accented characters (characters with ANSI code >127) KeyText previously "asked" the Windows operating system if there was a key combination for that character, and then pressed it. If there was none, KeyText used the Alt 0nnn (numeric keypad) method of entering such characters.

KeyText has now been changed to use the Alt 0nnn method for all such characters - although the previous method can be selected in Settings/Global by selecting "Key combination (if available)".

Reason for change... An example. With a UK setup, when KeyText "asks" for the key combination for é, Windows responds: Ctrl-Alt e. In, for example, Notepad, this does type é. However in Microsoft Word the same key combination types €, the Euro symbol. This inconsistency is not experienced with the Alt 0nnn method.

Change to Mouse action wizard

The Edit window below the wizard is now hidden when dragging the target to select a mouse location. In addition a new checkbox "Hide wizard while dragging target" has been added, to allow the full screen to be viewed when selecting mouse target. The wizard will appear again when the mouse button is released.

A similar checkbox and functionality are available on the "If pixel color" wizard page when dragging the color dropper.

Some timings speeded up

KeyText’s typing in certain circumstances could be slow; this has been speeded up. Also the delay after an item has finished is reduced.

No focus error

Reduced the occurrence of the "No window has keyboard focus" error; items may therefore now interact with the desktop.

Changes in Edit text items window

Pressing Ctrl S is now equivalent to clicking OK in the Edit text items window. Selecting "Edit text items" in the right-click menu will now take you to the last edit point (or item A, the first time). A new hotkey has been added (see Settings / Customize). If the Edit text items window is not open (and no KeyText dialogs are open) it will open the Edit window at your last edit point. If the Edit text items window (or any KeyText dialog) is open but not in the foreground, it will be brought to the front. And if the Edit text items window is open and at the front, it will save and close - as if OK is pressed.

"Changing to action:macro" dialog

New checkbox on the dialog "Text contains field(s) which require the action "Macro" to work. Changing now.", which allows you to prevent it appearing again.

Right click anywhere change

When using right-click anywhere, if more than one list of items was displayed the Back/Next items could move up if the last list had fewer items than the others. This last list is now padded with blank lines so that the mouse does not have to be moved to find Back/Next in a different location.

"On Window" schedule

The character limit in the "Set schedule" dialog for an "On window" schedule remains at 80; however, if not doing a "Match whole of title" search it will now search for the specified text in the first 255 characters of the window title (previously 80).

Timed schedule

Added "Seconds" as an additional option when selecting times/intervals to set an item to run, so that an item can be set to run, say, every 30 seconds. Timings are approximate, as they depend on the system clock rate. Note that the timer starts counting down each time the item starts – and that the "Minutes" interval time has been changed to match this; previously it started timing from each time the item finished. This should mean that the item starts at approximately the scheduled intervals.

Paste functionality

KeyText now checks the process name before running an item which is set to Action:Paste, as not all applications accept a Ctrl-V for paste.

If the process is command.exe or cmd.exe KeyText will simulate a paste using the control menu (edit / paste).

If the process is emacs.exe KeyText will simulate Ctrl-Y.

Any other process – KeyText will simulate Ctrl-V.

{Enter} keystroke

{Enter} and {Return} are now typed differently by KeyText – {Enter} is now set as an extended key to simulate pressing of the numeric keypad Enter. For most applications this will make no difference, but there are a few applications which distinguish between Return and Enter.

New fields {IgnoreReturns} {IgnoreTabs} and {IgnoreBlanks}

{IgnoreReturns} will override the default behaviour for dealing with Returns, as specified in Settings / Global. {IgnoreTabs} allows tab characters in an item to be ignored, and {IgnoreBlanks} will skip Returns, tabs and SPACE characters. You can also use  {IgnoreReturns Off} {IgnoreTabs Off} and {IgnoreBlanks Off}to allow these to be processed again (or override default behaviour). These new fields can be added using the Macro Control section of the Insert field wizard.

Organizer window

The Organizer window now has buttons for Group names and Manage variables. In addition, the list of items can be sorted by the column headers (this does not affect the actual order of items – just the display). This gives the easiest way of seeing which items have trigger text associated with them – sort on Trigger text.

The Organizer window is now re-sizeable.

Bug fixes

Ignore returns / no keyboard focus error

Incorrect "No window has keyboard focus" error appeared when KeyText is set to ignore returns, and an item begins with a comment, followed by a return, followed by a field such as {Run...} (and no window has focus). Now fixed.


Enter key not clearing in Key combination wizard

In the Key combination wizard, if Enter is "added", the key button remained pressed. Now fixed.


Pause of less than one second

If entered as {Pause .5} this did not work. Now fixed.

Right-click anywhere

Did not work correctly in a dual monitor setup where monitor 2 was on the left. Now fixed.

Integer Variables

Integer variables have been implemented, and are seen as an expert feature – and therefore not available through the Insert field wizard; they must be entered manually.


The # character is used to denote a field which makes use of variables.


Each macro can make use of integer variables a, b, c... through to z, which all default to zero.


Assigning variables

They can be assigned values as in these examples:


{#b=a}      (b will also equal 1)

{#c=Input "Input dialog title" "Enter value for c"}

There is also a special assignment to assist in date manipulation:

{#d=DaysInMonth 2,2004} would set variable d to 29. Or use {#d=DaysInMonth m,y} if variables m and y are the month and year.



Arithmetic (integer only) can be performed as in these examples:



The following are available: +=, -=, *=, /= and %= (mod or remainder)

In all cases the result of the calculation is assigned to the left-hand operand. So if x currently is 3 and y is 4, after {#x*=y} x will equal 12.


Outputting variables

To output the variable – either in text, or as part of another field – use:


Or, for example, {Loop {#x}} to start a loop to be performed x times.

Width and leading zero can also be specified. For example:

{#y "10"} will output y with leading spaces up to a width of 10.

{#y "010"} will output y with leading zeros up to a width of 10.


Special formats are available to convert integers into date information. For example, if variable m is 2:

{#m "MMM"} will give Feb and

{#m "MMMM"} will give February

(or the month name in your own language). Similarly "ddd" and "dddd" will give the weekday name associated with the number, where 0 is Sunday, and D will give 1st, 2nd, 3rd etc. "tt" will give AM if the variable is less than 12, else PM.


Global variables

Local variables a-z can be associated with global variables whose values are stored and can be accessed by any item from any KeyText data (.ktt) file.

For example:


The first time this is used, a global variable with the name Counter will be set up, with the current value of n.

Once the global variable exists, the above field would set n to the value stored in Counter.

When a macro with an association to a global variable ends, the global variable is updated with the current value of the local variable.

For example, say you want a macro to generate a filename which includes a counter which increments on each use.

{#a@"FileCount"}data{#a "04"}.txt{#a+=1}

On first use this would type data0000.txt. The next time it is used it would type data0001.txt, and so on.


Managing global variables

You can manage global variables through the "Manage variables" option in the KeyText Organizer. This allows you to view – and change – the current value, and also optionally set a reset value and specify that the variable should be reset to this:

When KeyText starts

Or every day at a given time

Or every Monday (etc)

Or on a set day each month.

If, in the above example, you wanted a filename which showed the month, and then a counter which was reset to 1 on the 1st day of each month, you could use:

{#a@"MonthCount"}{Date "yyMM"}{#a "04"}.txt{#a+=1}

and set MonthCount to reset to 1 on the 1st. In April 2006 this would generate 06040001.txt, 06040002.txt and so on.


Date / time / random variables

A variable can be associated with part of a date or time.


For example:


would associate variable s with the current seconds (system clock). Each time {#s} is used it would output the current seconds from the time.


Options are: month, dayofweek, dayofyear, day, hour12, hour, minute, second.


Note that if, further down the item, you assigned a new value to that variable, for example {#s=10}, it would break the association with seconds – and s would hold the value 10.


A variable can be set to produce random numbers. For example:

{#r@rand 100}

After this, {#r} would output a random number between 0 and 99.

Or {#r@rand #b} would output random numbers between 0 and b minus 1.


Again, note that if you assign a new value to a random number variable, it breaks the association with random numbers. So, for example,

{#r@rand 10}{#r} {#r} {#r}{#r+=1} - {#r} {#r} {#r}

might produce 2 9 4 - 7 7 7

In other words, the {#r+=1} has generated a new random number for r, added one to it, and turned it into a normal variable.


“If” logic based on variables must be programmed manually

For example:

{if #a=0 goto label}

{if #a>b then}

Available logical operators are:

=    not = (or !=)   >=   <=   <   >


goto, then, call, link and cancel are available.


String Variables

KeyText allows the use of string variables which, in conjunction with regular expressions gives powerful string manipulation abilities.


String variable names can be a combination of letters, numbers, space and other characters, but not ' " = %or {} (or whichever field delimiters you are using). A minimum of 2 characters is required (and trailing spaces are ignored). They should not start with a KeyText reserved words such as Pause, Loop, Shift, Input etc.


The @ symbol can only be used at the end of the variable name, and denotes that the string variable is global. That is - it can be used by any item, and from any instance of KeyText. Global variables are stored in a special encrypted file called KeyText.gsv, and you can move it to any location you like - use the File location button on the Manage Variables dialog. [Note that although encrypted, its contents are not password protected, and could be accessed by anyone running KeyText.]


A password can be set to prevent the global variables from being changed. The intention of this is to allow network users to share a single gsv file, while restricting the ability to change it. For example, say a company has a featured product of the day, which is set every morning. A user with password access could set a global variable ProductOfTheDay@ to the featured product name, set it to prevent changes, and then every user could have access to it - and it could be referenced in a number of different items.


Note that the scope of a local (as opposed to global) string variable is the current item, and any items directly called by that item.


The string contents assigned to a string variable can be up to 2048 characters long.


Assigning variables

They can be assigned values as in these examples:

{Full name = "John Smith"}

{Featured product@ = "KeyText"}

{Color required = Input "Color" "Please enter required color"}

{Ask -"Sex" "Enter M of F"}  (in this case the string variable name is Sex)

{Ask -"Phone number@" "Enter phone number"}  (this sets a global string variable, but note that the @ will not appear in the Ask dialog title bar)


The Input method above can be set up in the Insert Field Wizard display a message or ask for user input section.


Note the difference between Ask and Input. When an item is started, KeyText scans for Ask questions - and asks them at the start. With Input the question is asked when it is reached in the item. Only the Ask field can be used in an item set to Action:Paste.


Note that field nesting can give interesting possibilities. For example:

{String two = "{String One}"} will make String two have the same content as String one.

{Start clipboard = "{Clipboard}"} will give a variable "Start clipboard" whose contents will be the text contents of the clipboard.

{Clip1 = "{Clipboard "\(.\).*" "\L\1"}"} will give a variable "Clip1" whose contents will be the first character on the clipboard, in lower case.

The following example associates integer variable w with the day of the week (0-6), and by "outputting" that into quotes, the string variable Weekday will contain Sunday, Monday etc. (in your own language).

{#w@dayofweek}{Weekday = "{#w "dddd"}"}


Outputting string variables

Note that the Insert Field Wizard helps you to set up the output of a string variable; choose the option "Include Clipboard, Selection…".

To output the variable - either "typed" or pasted in your text, or as part of another field - wrap it in field delimiters.

Using the above examples:

{Full name} would output John Smith.

{Featured product@} would output KeyText.

{Featured product@ ".*\(....\)" "\1"} would output Text (last 4 characters of KeyText).

{Weekday ".*" "\U&"} would output SUNDAY, MONDAY etc, depending on the actual day.


This last two examples show the use of regular expressions. The output could also be URL encoded:

{Full name %} would output John%20Smith.


Global string variables

By adding the @ to the end of the string variable name, its value is stored for future use by other items - or other KeyText data files. If it is changed by an item (or by Manage Variables), its new value will be used by all items referencing it.


Managing global string variables

You can manage global string variables through the Manage variables button in the KeyText Organizer, and selecting the Strings option. This allows you to add or delete variables, to edit their contents, to determine where they are stored and if they can be changed.


"If" logic

Conditional logic is now available in KeyText, based on:

clipboard text (equals, not equals, contains, not contains, empty, or like regular expression)

selected text (equals, not equals, contains, not contains, empty, or like regular expression)

window title (equals equals, not equals, contains, not contains, empty, or like regular expression)

exe (process) name (equals, not equals, contains, not contains, or like regular expression)

string variable ("ask" field result) (equals, not equals, contains, not contains, or like regular expression)

Environment variable (equals, not equals, contains, not contains, or like regular expression)

pixel color

integer variables


With the exception of variables, these can be set up using new wizard screens. In the Insert field wizard, select "Macro control", and then choose the "If clipboard text / window title..." or the "If pixel color" option.

The resulting pages allow you to set up the logic you require with options to:


start another item

call another item

goto a label

or continue.


If continue is chosen, this allows if/then/else logic; for example:

{If clipboard contains "green" then} green functionality...

{Else if clipboard contains "blue" then} blue functionality...

{Else} something else...


and continue here


The wizard will set up the {If... then} part; Else, Else if and Endif must be entered manually.



Nested ifs are allowed.

When setting a pixel color to detect, make use of the "dropper" to locate the required pixel and set the desired color. Note that Tolerance can be set to allow near matches.


"If" logic based on variables must be programmed manually; see also section on variables.


For example:

{if #a=0 goto label}

{if #a>#b then}

Available logical operators are:

=    not = (or !=)   >=   <=   <   >


goto, then, call, link and cancel are available.


Note: and/or functionality is not implemented. Only simple logic as above.