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:
00680534
Vues:
140
>>>>Why not use WHS to run script?
oShell = CREATEOBJECT("WScript.Shell")
>>>>oShell.Run("myscript.vbs", 0, .T.)
>>>>
>>>>>Hi,
>>>>>
>>>>>I have been using API_AppRun to lauch applications from vfp. I like the LaunchAppAndwait() method because it does just what it's name implies. VFP waits around until the launched app closes. Does anyone know how to get launchAppAndWait() to run a .wsf file. I want to run this script and have vfp wait until the script is completed. Or..... is there a way not to use API_AppRun and use a different technique to launch a wsf from within vfp and have vfp wait until the script is done?
>>>>>
>>>>>Thanx,
>>>>>Dr.G. (Neil)
>>>
>>>Let me show you an example of what I am doing:
>>>
>>>wait window "before the code runs.."
>>>WshShell=createobj("WScript.Shell")
>>>WshShell.run("myapp.exe")
>>>WshShell.sendKeys("IOY")
>>>WSHShell.sendkeys("%X")
>>>wait window "we are done"
>>>
>>>You see... I don't want wait window "we are done" to run until myapp.exe closes. How do you do that.
>>
>>Include, the .T. in the run command as in Sergey's example. Only difference is the window style parameter.
>
>I see that .t. will pause additional script to run until myapp.exe is closes. However, I have an additional problem. I want to launch to exe, send lots of sendkeys to myapp and then continue with vfp code after myapp.exe closes. If I pass the WshShell.run a .t., how will I be able to send sendkeys before the exe close? I need to senkeys transmitted before the myapp.exe closes.

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.:-)
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