Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
API_AppRun vs. launch an app and wait
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00680456
Message ID:
00680550
Vues:
179
>>Neil,
>>
>>Use the VBScript to send the key strokes. Use the Run() method within it without the wait for return parameter. When you run the script from within VFP with the Run method, pass the wait for return parameter so that VFP waits for the script to finish executing.
>>
>>>And once again, thank you. don't you ever rest?
>>>
>>
>>< g >Well, certainly not between 8:00 and 5:00 Monday through Friday when there are no holidays. When I'm away from work, I don't spend a lot of time on the computer.:-)
>
>I am sorry, I am not following you. How about some code.

Neil,

Not terribly hard. Consider the following VBScript
' SKDemo.vbs
' Demonstration of sending keystroke to an 
' application.

Option Explicit
' lcfile should be initialized to
' the file name the application should
' run. lctitle should be initialized to
' the application's title text.
Dim oShell, lcfile, lctitle
Set oShell = CreateObject("WScript.Shell")
' Run in a normal window
oShell.Run lcfile, 5
oShell.AppActivate lctitle
' Wait one second
WScript.Sleep 1000
' Send the key strokes.
oShell.SendKeys "This was sent by the script file.~"
WScript.Sleep 1000
' Save the infomation
oShell.SendKeys "%S"
WScript.Sleep 1000
' Close the application
oShell.SendKeys "%FX"
' Clean up
Set oShell = Nothing
From within VFP
oShell = CREATEOBJECT("WScript.Shell")
oShell.Run('skdemo.vbs', 0, .T.)
That make sense?
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform