Sendkeys in Navision

With SendKeys you simulate user keystrokes – which mean it is possible to start applications, enter information, choose menus, buttons etc.

SendKeys is a part of Windows Script Host.

Currently I am using this functionality to take over a second Navision Client, to start an export of objects without any user interventions.


In Navision SendKeys are found in the automation Windows Script Host Object Model class WshShell.

The first thing to do is to create the automation:

IF ISCLEAR(WshShell) THEN
CREATE(WshShell);

Activate the application which has to behandled:

WshShell.AppActivate(AppName);


And then send the keys:

WaitForKeys := TRUE;

WshShell.SendKeys('{ESC 2}',WaitForKeys);
WshShell.SendKeys('{DOWN}',WaitForKeys);
WshShell.SendKeys('{LEFT}',WaitForKeys);
WshShell.SendKeys('Ver{ENTER}',WaitForKeys);

When you are finished sending keys then stop the automation by clearing it:

CLEAR(WshShell);

Pretty simple – right 🙂

Be the first to comment

Leave a Reply

Your email address will not be published.


*