Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Keyboard emulation under programatic control
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00678501
Message ID:
00679724
Views:
27
Hi,
I got it. It has to do in the order in which you SendKey. See below:

I lifted the following from a VB article
In order for sendkeys to work with a modal dialog, you have to call
the dialog and the actual keystrokes in one sendkeys.
menuAction(MenuFilePrinterSetup)
sendkeys("{HOME}{DOWN 2}{ENTER}")
will not work, because the menuaction calls up a dialog that suspends the code.

This is why you need to do an Alt-F, R, Home, Down 2, Enter in one command.

How cool is that. All I did was include the modal dialogs key presses in the same sendkey expression that called the modal dialog.

Thanx for ytour help
Neil

>>One more thing. I was thinking along the same lines as you were so I came out of vfp when I started to experience the modal problem and went to a script file with VBScript to lessen the interactions and influences of vfp.
>>
>>Neil
>
>I tried the following with notepad from VFP
DECLARE Sleep IN WIN32API;
>  INTEGER nMilli
>LOCAL oShell AS WScript.Shell
>oShell = CREATEOBJECT("WScript.Shell")
>oShell.Run('notepad.exe')
>= Sleep(1000)
>oShell.AppActivate('notepad.exe')
>= Sleep(1000)
>oShell.SendKeys("This is from VFP 7.0~")
>= Sleep(1000)
>* Save As
>oShell.SendKeys("%FA")
>= Sleep(1000)
>oShell.SendKeys("neiltest~")
Everything worked fine and the file was saved. I'm beginning to suspect that it's something about the application itself. Sorry.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform