Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WSH Version - Help with syntax
Message
 
 
To
15/12/2002 13:44:09
Donald Lowrey
Data Technology Corporation
Las Vegas, Nevada, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00733176
Message ID:
00733194
Views:
20
It doesn't work because Version is property of WScript object which is only accessible from inside the script. Here's a function I just put together that would return WSH version.
FUNCTION WSHVersion
LOCAL lcWHSVersion, lcResultName, lcScriptName
lcScriptName = Addbs(Sys(2023)) + Sys(2015) + ".vbs"
lcResultName = Addbs(Sys(2023)) + Sys(2015) + ".tmp"
* Create VB script that'll write WSH version to a file
TEXT TO lcScript TEXTMERGE NOSHOW
Dim fso, MyFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile= fso.CreateTextFile("<<lcResultName>>", True)
MyFile.WriteLine(WScript.Version)
MyFile.Close
ENDTEXT
Strtofile(lcScript, lcScriptName)
* Run script we created
oShell = CREATEOBJECT('WScript.Shell')
oShell.Run(lcScriptName, 0, .T.)
* Read WSH version from the file
lcWHSVersion = Filetostr(lcResultName)
* Delete temp. files we created
ERASE (lcScriptName)
ERASE (lcResultName)
RETURN lcWHSVersion
Keep in mind, that version returned for WSH 2.0 is 5.1.

>Hi All
>
>I have started to work a little with WSH and want to return the version number of the WSH installed on a client machine. Unfortunately, the below code doesn't do the trick. I think the problem is that I am calling the wrong method (shell); but I havn't been able to find anything in MS WSH reference.
>
>WshShell = CreateObject("WScript.shell")
>lcVer = WshShell.Version
>
>Any help would be appreciated.
>
>Thanks in Advance
>
>- Don Lowrey
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform