SendKeys in NAV 2013

Does the SendKeys function still exist in NAV 2013?

It’s still possible to use the Windows Script Host Automation (at least in NAV 2013, I’m not sure in NAV 2013 R2):

Name DataType Subtype Length

WSHShell Automation ‘Windows Script Host Object Model’.WshShell

IF ISCLEAR(WSHShell) THEN

CREATE(WSHShell,FALSE,TRUE);

Simulate Ctrl+Shift+I key combination

WSHShell.SendKeys(’^+I’);

We can user Windows Script Host Object in NAV 2013 R2 and send keys can be used.

Hi Daniele,

Thanks for your post, but it does not seem to do what I wanted it to do.

I was trying to force the collapse of a part page with SendKeys(‘Alt+F6’)!

this blog will give some basic idea how to send key F5

http://dynamicsuser.net/blogs/mark_brummel/archive/2009/12/16/tip-25-update-header-page-from-the-line-page.aspx

Thanks, I have managed to send key stroke ‘F5’, but now I have another problem.

The command ‘F5’ is sent when focus is on a different part of the page - on the first fast tab (General) - rather than my new one, although I am sending the key stroke within the C/AL code block of the new tab.

I think I may have to wait for all the tabs to open and perhaps with a timer, 100ms or so later, set the focus to my new tab and then send the ‘F5’.

Why re you sending F5? Is it part of your requirement?

I just gave you example how to send keys using Code.

I’m sending ‘F5’ to the GUI, in an attempt to refresh a specific tab on the page I have opened.

Your example was fine - thank you - I did manage to send the ‘F5’ command, but the focus was not on the specific tab I was hoping to refresh.

I don’t think you can manage the update of a particular tab via code, but just refresh the entire page.