Simplicty and flexibility!


Keystrokes CDF
KeyMacro( FileName )
KeyStrokes( KeyString )
Keymacro( "import.mac" )
KeyStrokes( "_f3" )



This CDF is provided for illustration purposes only of the uses

for a Custom Defined Function within DataEase for Windows. This

CDF is provided 'As is' with no warranty whatsoever, either

expressed or implied. DataEase International, Inc. does not

warrant the CDF to be error free, nor does it warrant the CDF to

meet your specific requirements. In addition, this CDF is not

approved for use, nor it is subject to Technical Support by

Triangle Software International, Inc.


KeyMacro( FileName )

KeyStrokes( KeyString )


Keymacro( "import.mac" )

KeyStrokes( "_f3" )


This CDF will automatically send a series of keystrokes stored in a

command file to DataEase for immediate execution. The keystrokes

are entered into an ASCII text file of your choice using a normal

ASCII text editor. The keystrokes sent can be Function Keys, Alt

or Ctrl key combinations, Cursor movement keys and most typing

characters from the keyboard. Conventions for building this file

are explained below. Once built, the command file can be called as

part of a CDF passing arguement assigned to an Action Button or

Image placed on a Form or Live report.


The Windows System Queue defaults to 120 events. Every keystroke

is two events (KEYDOWN and KEYUP). This means that any single

demacro script can contain only about 60 keystrokes. Characters

can be two or more keystrokes. For example "a" is two keystrokes,

"A" is four keystrokes, and "Ç" is ten keystrokes! (it gets sent

as alt-0199). There is a way around this limitation. You can

increase the size of the Windows System Queue with the

undocumented command:

TypeAhead = xxxx

Where xxxx is an integer value. This command should be put in

your WIN.INI file in the [windows] group.


1. Filename:

an ASCII text file containing the set of keystrokes to

automatically execute.

2. KeyString:

an ASCII text string containing the set of keystrokes to

automatically execute.


To send text keystrokes, simply type them into the file. For

instance, to send PRICES.DAT, just type it into the file. No quotes

or special characters are needed. Spaces are allowed anywhere in

the text you type but are ignored (collapsed) when passed to

DataEase. So, the string: "Jeremiah Johnson" would be sent to

DataEase as "JeremiahJohnson". To embed hard spaces you must use

the token "_sp". Therefore: "Jeremiah_sp Johnson" would be sent as

"Jeremiah Johnson". Blank lines in the command file are also

ignored. Comment lines can be added if they begin with the string

"/*" and end with the string "*/. Failure to close a comment line

with "*/" will cause an error when the CDF is fired.

To send a combination of keystrokes such as ALT-PRTSC (to copy a

picture of the current window to the Clipboard), you embed the

second command within parentheses such as: _alt(_prtsc). When

sending an Accelerator Key combination, make sure to put the text

character in lower case. So to invoke FILE-OPEN you would enter

the command _ctrl(o)

If you want to use a Button to automatically enter text into a field

you must be sure to TAB back into or forward into the target field.

So if you have a button that will write the text "Federal Express"

into the DELIVERY field which is 2 tab order positions behind the

button, you must precede the text string with two _shift(_tab)


Once the command file is defined, you can call it via the DEMACRO

CDF from a button. The Button Action should be set to

EXPRESSION(CDF) and the Parameter box should have the following:





_ALT = ALT key,

_bksp = BACK SPACE key,

_break = BREAK key,

_caps = CAPS LOCK TOGGLE key,

_del = DELETE key,

_down = DOWN ARROW key,

_end = END key,

_enter = RETURN key,

_esc = ESCAPE key,

_home = HOME key,

_ins = INSERT TOGGLE key,

_left = LEFT ARROW key,

_pgdn = PGDN KEY key,

_pgup = PGUP KEY key,

_prtsc = PRINT SCREEN key,

_right = RIGHT ARROW key,

_tab = TAB key,

_up = UP ARROW key,

_sp = SPACE key,

_under = UNDERSCORE key,

_lpar = LEFT PAREN key,

_rpar = RIGHT PAREN key,

_scroll = SCROLL LOCK key,

_numlock = NUMLOCK key,

_F1 = F1 key,

_F2 = F2 key,

_F3 = F3 key,

_F4 = F4 key,

_F5 = F5 key,

_F6 = F6 key,

_F7 = F7 key,

_F8 = F8 key,

_F9 = F9 key,

_F10 = F10 key,

_F11 = F11 key,

_F12 = F12 key,


We have a Form into which we will Import data regularly using a

standard file name. We wish to automate this process by pressing

a button on the Form. The macro should bring up the IMPORT dialog,

select VARIABLE Length Text as the file format, Tab to the Source

Filename edit control, type in the text: "PRICES.DAT", and press

the <enter> key to execute the import.


Open the application within which you wish to integrate the

function. From the Menu Bar, select APPLICATION - CUSTOM FUNCTIONS.

Fill in the form as shown below and press F2 for each function (both

functions are contained in the same DLL).

Function Name: KeyMacro


Description: Keystrokes read from a file


Return Type: INT

DOS Mem Req't:

DOS Entry Point:

Parm 1 Name: FILENAME

Parm 1 Type: STRING

Function Name: KeyStrokes


Description: Keystrokes read from a string


Return Type: INT

DOS Mem Req't:

DOS Entry Point:

Parm 1 Name: KeyString

Parm 1 Type: STRING





Keystrokes CDF

The KeyStrokes function reads a string which itself consists of the keystrokes you wish to execute.

The CDF description:

Function Name: Keystrokes
CDF Library Name: demacro.dll
Return type: Int

One Parameter:
-Name: KeysString
-Type: String

The button action should be set to [Execute CDF] and the argument (including the quotation marks) is: KeyStrokes(“_tab”) or, if a combination of keystrokes is required, the argument is KeyStrokes(“_shift(_tab)”).

See Also

On the forum about Keystrokes CDF


Product: . Written by alembagheri tahmas 07/12/13 at 13:37:32

Hi there,I am trying to use an external MySQL DB in dataease. I have successfully create the ODBC link and added the DB to dataease. I can also access the DB from dataease. Now, just for testing purposes, I am trying to create a simple report b...

Product: DataEase for Windows 7.x. Written by George Washington 11/04/14 at 08:26:17

no se pude exportar ahora archivos a pdf, ni a excel o otros cosa mala. en verdad creo que hace faltaen las versiones anteriores me funcionaba mas o menos bien.&nbsp;le hace falta a los aplicativos que se desarrollan en Dataeasegr...

Product: DataEase 8 Reporter. Written by eduardo paez 02/05/14 at 14:40:11

Thanks. Anyway I'm trying to use this fuction but it seems to me that it doesn't work on 8.2. I tried also in a DQL.There's something wrong?<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA9IAAAJ3CAYAAAB4NWk3AAAAAXNSR0IArs4...

Product: . Written by Marco Marchesi 15/02/16 at 14:50:46


Product: Dataease [{8}]FIVE. Written by Chamil Rajindra 21/02/19 at 10:17:46

Thanks for the very good explanation!AS...

Product: . Written by afonso santos 28/10/19 at 00:50:14

I am pleased to see that the migration from Dos 4.53 is then sa 5.5 works. A really useful thing would be a compiler of SQL languages. Will you get there?Original Text:Mi compiaccio a vedere che la migrazione da Dos 4.53 è poi sa 5.5 funzio...

Product: . Written by Grossi Gioacchino 18/11/19 at 14:33:44

On the blog about Keystrokes CDF