Keyboard simulation in ATEasy?

Solution Available
John K.
Bacau,

Nov 22, 2010
55 Posts

1  |  0  

Re: Keyboard simulation in ATEasy?

Hi there! I have a task that implies an automatic "user input", that is a simulated keyboard data insertion. Is there any way I can do this in ATEasy? The application has to open an .exe file, insert a string into a text field and click the "Next" button a couple of times, all that automaticly. Is there any possibility to do this? Please help me.

Solution Available
Arne V.
Almelo OV,

Nov 22, 2010
3 Posts

1  |  0  

Re: Keyboard simulation in ATEasy?

Hi Alex,

we've the same issue with some 3th party tools;

Here is a solotion:

- Add c:\windows\system32\user32.dll to libraries
- Add procedure:
keybd_event ( val byre bVk, val Byte bScan, val DWord dwFlags,val long lExtraInfo): void

see for more info : http://msdn.microsoft.com/en-us/library/ms646304(VS.85).aspx


example of sending <RETURN> in case of adding library to system:

! VK_RETURN
system.keybd_event(0x0D,0x45,0,0)

- Important: When debugging using the ATEasy environment it is posible that the keys will modify your code !
(keys are written directly in the keyboard buffer - Be sure the right window has focus )

Tested with ATEasy 6

Example to send 5 digit serialnumber to external application:
sTemp = right(sSerialNbr,5)

! Add 0x30 for ascii conversion
system.keybd_event(0x30 + val(mid(sTemp,0,1)),0x45,0,0)
system.keybd_event(0x30 + val(mid(sTemp,1,1)),0x45,0,0)
system.keybd_event(0x30 + val(mid(sTemp,2,1)),0x45,0,0)
system.keybd_event(0x30 + val(mid(sTemp,3,1)),0x45,0,0)
system.keybd_event(0x30 + val(mid(sTemp,4,1)),0x45,0,0)


Please let me know if your problem is solved,

Arne



Please Note
You need to have a M@GIC account to participate in the Forums.
Not yet registered on our website? Click here to register today!

All content, information and opinions presented on the Marvin Test Solutions User Forums are those of the authors of the posts and messages and not Marvin Test Solutions'. All attachments and files are downloaded at your own risk. [Read More]