Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Translating WSH sample
Message
 
 
To
27/07/2001 09:35:22
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00536302
Message ID:
00536385
Views:
8
In addition to the resource George gave you, here is a link to the MSDN documentation on the WScript object.

http://msdn.microsoft.com/library/en-us/script56/html/wsobjWScript.asp

>Where do I find this?
>
>Hilmar.
>
>>The WScript object is an internal object cerated when you run a script. It is created by the WScript.Exe utility. I don't think you can instantiate it directly. I recommend using Alexander's WinAPI call instead.
>>
>>HTH.
>>
>>>Your code fails on the very first line: Object WScript not found. Issuing CreateObject() alone, without an object reference, works:
>>>
>>>
>>>WshShell = CreateObject("WScript.Shell")
>>>
>>>
>>>but I don't know how to code the third line.
>>>
>>>>Hi!
>>>>I think it will be:
>>>>
>>>>WshShell = WScript.CreateObject("WScript.Shell")
>>>>WshShell.Run("calc")
>>>>WScript.Sleep(100)
>>>>WshShell.AppActivate("Calculator")
>>>>WScript.Sleep(100)
>>>>WshShell.SendKeys("1{+}")
>>>>WScript.Sleep(500)
>>>>
>>>>>Can somebody help me translate a sample script from Windows Scripting Host? I am just starting to learn this.
>>>>>
>>>>>In the documentation, the sample (which you can find under "SendKeys") is as follows:
>>>>>
>>>>>
>>>>>...
>>>>>   set WshShell = WScript.CreateObject("WScript.Shell")
>>>>>   WshShell.Run "calc"
>>>>>   WScript.Sleep 100
>>>>>   WshShell.AppActivate "Calculator"
>>>>>   WScript.Sleep 100
>>>>>   WshShell.SendKeys "1{+}"
>>>>>   WScript.Sleep 500
>>>>>...
>>>>>
>>>>>
>>>>>I successfully translated the first two lines as follows:
>>>>>
>>>>>
>>>>>WshShell = CreateObject("WScript.Shell")
>>>>>WshShell.Run("calc")
>>>>>
>>>>>
>>>>>But then, I don't know how to translate the third line. Do I need another CreateObject() before I can access WScript, or what?
>>>>>
>>>>>TIA, Hilmar.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Reply
Map
View

Click here to load this message in the networking platform