if isclear(WSHShell) then
create(WSHShell);
WSHShell.SendKeys('%f');
WSHShell.SendKeys('m');
WSHShell.SendKeys('o');
//beep(1203,200); or an another WSHShell.SendKeys('{DOWN}');
WSHShell.SendKeys('{DOWN}');
WSHShell.SendKeys('{ENTER}');
clear(WSHShell);
EDIT:
the reason why Sendkeys doesn't work: The windows need some time to display. Bute the keys are already send. But there is not window to get the keystroke ;-) so, use beep(Requence,Duration) or split your WSH Code ...
Tip: use ShortCutKeys when possible. That reduces problems when using more than one language, or when upgrading to a different version of NAV.
ShortCut for opening a company: Ctrl+O.
WSHShell.SendKeys('^o')
Keep It Simple and Stupid (KISS), but never oversimplify.
the beep function doesn´t work. the problem is that the open company window opens after getting the last sendkey, so it doesn´t execute the sendkey('{ENTER}')
This does not seemt to work. I have also tried putting the word "ENTER" instead of "~"...that didnt work aswell.
Your question doesn;t make any sence.
You want the system to send an enter request using send keys when pressing enter?
If you are pressing enter in the first place then there is no need for sendkeys to send an enter request?
We use Sendkeys in a few parts of nav right now.
One is autoopening the Apply Vendor Entries form after entering a vendor number. Instead of having to click Functions->Apply Entries.
OnAfterValidate() //of "Account No."
AutoOpenPaymentEntries; //run custom function
AutoOpenPaymentEntries() //custom function
PurchSetup.GET;
IF PurchSetup."Auto Open Payment Journal" THEN BEGIN
CREATE(WshSHell);
WshSHell.SendKeys('+{f9}');
CLEAR(WshSHell);
END;
the reason I am trying to do this is because I want the Remaining Balance from my last post to calculate every time the user presses enter.
This code is under trigger Remaining Balance -- OnAfterValidate ().
Right now it only updates the remaning balance field if i click on the form itself. I want it to automatically update it. Therefore, i was trying to do it using sendkeys (either when user presses enter or tab).
Another solution that i have tried was using OnTimer trigger (that wasnt very appealing since it would annoy the user)
Comments
Here is a list of all keys
http://www.mibuso.com/forum/viewtopic.php?t=25712
second:
EDIT:
the reason why Sendkeys doesn't work: The windows need some time to display. Bute the keys are already send. But there is not window to get the keystroke ;-) so, use beep(Requence,Duration) or split your WSH Code ...
Regards
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
ShortCut for opening a company: Ctrl+O.
you are relying on the companies remaining in the same order - sending the company name and an extra enter is probably safer
Dynamics Nav Add-ons
http://www.simplydynamics.ie/Addons.html
This does not seemt to work. I have also tried putting the word "ENTER" instead of "~"...that didnt work aswell.
Your question doesn;t make any sence.
You want the system to send an enter request using send keys when pressing enter?
If you are pressing enter in the first place then there is no need for sendkeys to send an enter request?
We use Sendkeys in a few parts of nav right now.
One is autoopening the Apply Vendor Entries form after entering a vendor number. Instead of having to click Functions->Apply Entries.
Can you explain your use for it?
http://www.BiloBeauty.com
http://www.autismspeaks.org
This code is under trigger Remaining Balance -- OnAfterValidate ().
Right now it only updates the remaning balance field if i click on the form itself. I want it to automatically update it. Therefore, i was trying to do it using sendkeys (either when user presses enter or tab).
Another solution that i have tried was using OnTimer trigger (that wasnt very appealing since it would annoy the user)
On my forms when I enter a value the field update immediately.
Here's even another example of totaling and updating immedately.
viewtopic.php?f=23&t=45905
Did you look at deposits?
http://www.BiloBeauty.com
http://www.autismspeaks.org