need help with OnEvent command

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
esuohlluf
Junior Coder
Posts: 41
Joined: Thu Mar 23, 2006 5:33 am

need help with OnEvent command

Post by esuohlluf » Thu Apr 06, 2006 5:59 pm

I ran this test code for the OnEvent command to see if it would execute
as I expected.

Label>start
OnEvent>KEY_DOWN,a,0,KeyPress1
OnEvent>KEY_DOWN,s,0,KeyPress2
OnEvent>KEY_DOWN,d,0,KeyPress3
OnEvent>KEY_DOWN,f,0,KeyPress4

SRT>KeyPress1
MessageModal>a was pressed
END>KeyPress1

SRT>KeyPress2
MessageModal>s was pressed
END>KeyPress2

SRT>KeyPress3
MessageModal>d was pressed
END>KeyPress3

SRT>KeyPress4
MessageModal>f was pressed
END>KeyPress4

Goto>start


When run the message box displays after the first event, then if I close out the message box and
and try another key I get violation messages.

ex.
'access violation at address 0048021B in module 'mssched.exe'.read of address 00000180'

User avatar
JRL
Automation Wizard
Posts: 3503
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Apr 06, 2006 6:15 pm

Move Label>start to below the OnEvent> commands.


OnEvent>KEY_DOWN,a,0,KeyPress1
OnEvent>KEY_DOWN,s,0,KeyPress2
OnEvent>KEY_DOWN,d,0,KeyPress3
OnEvent>KEY_DOWN,f,0,KeyPress4

Label>start

Later,
Dick

esuohlluf
Junior Coder
Posts: 41
Joined: Thu Mar 23, 2006 5:33 am

Post by esuohlluf » Thu Apr 06, 2006 6:32 pm

I moved Label>start to below the OnEvent> commands and got the same result.
First press of any of the four letters brought up the message box the second press brought up a violation.

User avatar
JRL
Automation Wizard
Posts: 3503
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Apr 06, 2006 6:59 pm

Works for me...

Try adding a small wait at the end

OnEvent>KEY_DOWN,a,0,KeyPress1
OnEvent>KEY_DOWN,s,0,KeyPress2
OnEvent>KEY_DOWN,d,0,KeyPress3
OnEvent>KEY_DOWN,f,0,KeyPress4

Label>start
SRT>KeyPress1
MessageModal>a was pressed
END>KeyPress1

SRT>KeyPress2
MessageModal>s was pressed
END>KeyPress2

SRT>KeyPress3
MessageModal>d was pressed
END>KeyPress3

SRT>KeyPress4
MessageModal>f was pressed
END>KeyPress4

Wait>0.1
Goto>start

esuohlluf
Junior Coder
Posts: 41
Joined: Thu Mar 23, 2006 5:33 am

Post by esuohlluf » Thu Apr 06, 2006 7:44 pm

Yes the Wait solved it. It does work with the start label in either location
in the code.

Thank You

esuohlluf
Junior Coder
Posts: 41
Joined: Thu Mar 23, 2006 5:33 am

Post by esuohlluf » Fri Apr 07, 2006 3:10 pm

Problems still do resurface with this code . With the Wait it executes as expected most of the time but the violation messages still apprear on
occasion. I have cranked up the Wait to various times and that doesn't
seem to effect the occassional violation messages.

Is there any possibilty that this code can fail depending on the windows
that are opened?

User avatar
JRL
Automation Wizard
Posts: 3503
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Fri Apr 07, 2006 3:43 pm

I tried opening different apps and could not make this script fail.

The error "access violation at address xxxxx" would indicate a memory conflict. This could be related to something running on your computer perhaps even a background application. It might also be related to your operating system.

I'm running WinXP SP1. I have nothing special running in the background. I don't have any memory intensive apps like CAD, Image editing or games.

This may be a question Marcus will have to answer. Or perhaps someone who has high memory usage apps could test this script?

Later,
Dick

esuohlluf
Junior Coder
Posts: 41
Joined: Thu Mar 23, 2006 5:33 am

Post by esuohlluf » Fri Apr 07, 2006 4:02 pm

I'm also running xp (pro) and I don't have anything unusual running in the
background.

As a matter of fact when I am working my way through learning the program outside of a firewall it's the only program running.

This violation will occur when I have the main window of MS open rather than minimized.

I would like Marcus to answer this but I'm not sure how I can get him to do that.

I have reinstalled the ghost image of my OS to factory and have reinstalled MS just to cover as many bases as I can.

User avatar
JRL
Automation Wizard
Posts: 3503
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Fri Apr 07, 2006 4:08 pm

Last week Marcus said:
I'll be in Sardinia and, hopefully, Sicily next week.
I expect he'll be back online next week (April 10, 2006), but I don't know that for sure.

Later,
Dick

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts