I'm needing to send key strokes to a old DOS program run under MultiView 2000 Terminal Emulator and everything is working ok until I send a SendKey {F7}.

After each SendKey i do a brief sleep.

I do not get a error it just does not do anything.  Any help would be appreciated.

Dim SecPauseTime as Integer
SecPauseTime = 15

AppActivate extAppName
Sleep iSecPauseTime * 10

SendKeys 2
Sleep iSecPauseTime

SendKeys {ENTER}
Sleep iSecPauseTime

SendKeys PIES
Sleep iSecPauseTime

SendKeys {ENTER}
Sleep iSecPauseTime

SendKeys {F7}
Sleep iSecPauseTime

Phil ChapmanAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

Mike TomlinsonConnect With a Mentor Middle School Assistant TeacherCommented:
I assume you see that  the "sendkeys 2" puts a "2" in a field on "extAppName"..
a. SendKeys requires that the OtherApp has focus.. Does it appear to still have focus at the F7?
b. Maybe the {Enter} takes focus away from the Text entry field on "OtherApp" - F7 might not do anything if focus is not where it should be.
b. If you manually click on the OtherApp and press F7, does that work?
Phil ChapmanAuthor Commented:
SendKets 2 puts a 2 in the other application
The other application still has focus
If you press F7 while in the other application it does what it suspose to do.
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Mike TomlinsonMiddle School Assistant TeacherCommented:
Try sending F7 with the keybd_event() API instead:
Const VK_F7 = &H76

Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Declare Function MapVirtualKey Lib "user32" Alias "MapVirtualKeyA" (ByVal wCode As Long, ByVal wMapType As Long) As Long

        keybd_event VK_F7, MapVirtualKey(VK_F7, 0), 0, 0 ' key down
        keybd_event VK_F7, MapVirtualKey(VK_F7, 0), 2, 0 ' key up

Open in new window

Phil ChapmanAuthor Commented:
Idle Mind,
When I mix SendKeys with Keybd_event and MapVirtualKet it gets the sequence out of order
How would I get the values of
strTemp = "ABC123"
so I can just used the API calls?

I  tride passing the API calls the
ASC(MID(strTemp ,I,1))
Phil ChapmanAuthor Commented:
strTemp = "ABCabc123"
Does not work using ASC values
Phil ChapmanAuthor Commented:
I see what the problem is it's looking at my Caps lock
Phil ChapmanAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.