sendkeys???

krazy89
Member Posts: 30
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
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
-
Why don't you use REPORT.RUN(parameters)?0
-
You are probably running the send key too early.
Put the code in the onopenform of the sections or wait a few seconds like using the beep function .0 -
hey guys...
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?!?!?
KraZyKraZy0 -
ara3n wrote:You are probably running the send key too early.
Put the code in the onopenform of the sections or wait a few seconds like using the beep function .
See Here:
http://dynamicsuser.net/blogs/kine/arch ... -beep.aspx0 -
Hey guys....
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,
KraZyKraZy0 -
adn the beep sound you hear before the report request form appear or after that?
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...0 -
hmm.. that's the funny part...
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??
KraZyKraZy0 -
Is there difference in used OS? (e.g. Vista)
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...0 -
hey Kine...
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,
KraZyKraZy0 -
I guess either the timing is wrong or the sendkey doesn't work like it should on that machine.
I would write some code with different keys sent to eliminate the latter.0 -
You should use a Timer in order to make it work and adjust it as needed
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.
CheersJoao Jesus
jpjesus@netcabo.pt0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions