Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Keyboard emulation under programatic control
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00678501
Message ID:
00679741
Vues:
17
Very interesting! I'll have to remember that trick. Congratulations!!

Mike

>Thank you.
>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
>
>
>>Neil,
>>
>>Sorry, I don't have much experience it this area. I know that George is one of the resident WSH experts, so I'm sure you're in great hands with his assistance. Ed Rauh is also very knowledgeable about such matters - see this thread, for example: Finally, a way around Outlook/MAPI dialogs on sending email (Thread #655520).
>>
>>You might want to check out Google Groups. My search on the words sendkeys and modal came up with 442 hits, mostly in VB-related newsgroups. As far as I know (and I don't know much), VB's SendKeys is comparable to WSH's.
>>
>>It seems as though your problem comes down to one of two things. Either it's a timing/window activation issue (what I suspect), or WSH's SendKeys is unable to communicate with this particular modal dialog. I would suggest first running your application and manually bringing it to the point of the modal dialog. Then focus your testing on just this condition, without any surrounding script. You can write a simple VFP test PRG that activates the modal dialog and issues a WSH SendKeys command, without any doubt about the dialog's presence or its identity. (Spy++ may be helpful, at the very least to get the dialog's HWND.) First establish whether WSH's SendKeys can communicate with the modal dialog when it has clearly been activated. If not, you may need to investigate an entirely different approach using Windows messaging API functions. Good luck!
>>
>>Mike
>>
>>>Hi Mike,
>>>Thank you for the ref to SendKeys. That is exactly what I was looking for. But I have hit a snag and maybe I need something else. This is the poop:
>>>I am able to activte an application and send it key strokes via the script host however, if I want to drive the apllication into a mode that causes a modal dialog to popup, I am not able to sendkey successfully into the modal dialog. It seems as if my control of the app stops until that modal dialog is closed. I tried including the name of the modal dialog in the AppActivate method but that did not work. Perhaps the solution to this is as simple as some keyboard macro routine? I am at a loss and this is a real app breaker.
>>>
>>>please give it some thought,
>>>Thanx,
>>>Dr. G.(Neil)
>>>
>>>>Hi Neil,
>>>>
>>>>Check out Windows Script Host - SendKeys Method. You can also find lots more info about WSH by starting with a search here on UT.
>>>>
>>>>Mike
>>>>
>>>>>Hi ,
>>>>>
>>>>>Does anyone know how to force keyboard input to a running windows application. I have an cad cam program that can launch with a particular cad cam file open for viewing. I type in the RUN textbox: c:\CadCam\cadcam.exe file=c:\CadCam\BrooklynBridge.cad (BrooklynBride is the file that opens for display). If I then type:
>>>>>alt+f I G S alt+x , The cadcam program will save the displayed cad cam file as a jpg image.
>>>>>
>>>>>I would like to launch cadcam.exe from within VFP7. Wait 10 seconds (which allows the cad cam file to be displayed), then I would like to send the above characters to cadcam.exe so that the displayed image can be saved as a jpg automatically without me actually typing them in. I remember we used do things like this in DOS with the pipe command.
>>>>>
>>>>>I would like to do this from within VFP7
>>>>>
>>>>>Any thoughts?
>>>>>Dr. G. (Neil)
Montage

"Free at last..."
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform