Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
API_AppRun vs. launch an app and wait
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00680456
Message ID:
00680596
Views:
178
>>>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?


Thanx,

Now I have it. thanx, Any suggestions on how to check if an app that you launched with all of this scripting is still running. That would be very helpful.

Neil
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform