hey everyone...
i've been trying to get a report to go straight into preview with the sendkeys command:
SalesHead.SETFILTER("No.","No.");
PickTicket.SETTABLEVIEW(SalesHead);
PickTicket.RUN;
CREATE(WshShell);
WshShell.SendKeys('%{v}');
CLEAR(WshShell);
this should send the PickTicket report straight into preview mode without user input... but the funny part is... this works on my computer... but when i goto another computer in the local network.. and try it on our test db... it doesn't work... it stops on the report dialog and waits for user input to either print/preview... this is really weird...
one guess is that it might be because of the language option... but his hotkey is 'v' also... same as mine...
so i really don't understand it... if anyone has any idea.. please let me know!!!
Thanks,
KraZy
KraZy
0
Comments
Put the code in the onopenform of the sections or wait a few seconds like using the beep function .
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
as for the Report.RUN(Parameters); --> that will automatically send the report to the printer.. which is NOT what i want... i only want it previewed... and not printed...
as for the sending it too soon --> the weird part is.. it works on my computer... but when i goto another computer on the local network, it doesn't work... i don't understand why it has 2 different responses to the same command?!?!?
KraZy
See Here:
http://dynamicsuser.net/blogs/kine/arch ... -beep.aspx
http://www.BiloBeauty.com
http://www.autismspeaks.org
i tried putting in a
BEEP(440,100);
command before the sendkeys command... but still doesn't work for 1 particular laptop that's connected to the network...
the laptop is currently using MS Media Centre ver 2002...
don't know if that makes a difference or not???
Thanks,
KraZy
And another thing - check the language of the client. May be he is using another language and the hotkey for the Preview button is another...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
on his laptop... i don't hear a beep at all... on my desktop... i hear the beep... and everything is good... goes straight to the preview page...
on another desktop that's on the local network... it also works fine... i hear the beep.. and then straight to preview page...
only on his laptop that it doesn't work...
he's also on english.. as his preview hotkey is 'v'.. so that shouldn't be the problem...
Any other ideas??
KraZy
Has the notebook some sound card? On some notebooks you can hear the beep from the soundcard, not from the speaker (notebooks do not have one :-)).
And you can try longer beep time or add sleep command before it...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
the laptop does have a sound card.. that shouldn't be the issue...
as for operating systems... the desktops here use win xp pro... the laptop uses ms media centre ver 2002... (which might be the problem!!??)
i'll try using the SLEEP command before the beep... but i'm guessing that won't work either... but i'll try it and let you know..
Thanks,
KraZy
I would write some code with different keys sent to eliminate the latter.
1. The timer interval should be set to a range between 10 - 100 ms
2. http://msdn2.microsoft.com/en-us/librar ... dkeys.aspx
The SendKeys class is susceptible to timing issues,
which some developers have had to work around.
The updated implementation is still susceptible to timing issues,
but is slightly faster and may require changes to the workarounds.
The SendKeys class tries to use the previous implementation first,
and if that fails, uses the new implementation. As a result, the
SendKeys class may behave differently on different operating systems.
Additionally, when the SendKeys class uses the new implementation,
the SendWait method will not wait for messages to be processed when
they are sent to another process.
Take a look at this example code:
<Control1102053039> - OnPush()
IF CONFIRM(Text100001,FALSE,"User ID") THEN BEGIN
IF ISCLEAR(WSH) THEN
CREATE(WSH);
IF ISCLEAR(Timer) THEN
CREATE(Timer);
Timer.Interval(100);
Timer.Enabled(TRUE);
END;
Timer::Timer(Milliseconds : Integer)
WSH.SendKeys('%{F4}');
Hope it helps.
Cheers
jpjesus@netcabo.pt