home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 8,952 of 10,840   
   Hal Vaughan to mayayana   
   Re: Exec method won't work   
   06 Nov 04 08:58:54   
   
   From: hal@thresholddigital.com   
      
   mayayana wrote:   
      
   > This is a VB group, not VBScript. They're not   
   > the same thing. That's probably why you   
   > didn't get an answer.   
      
   Thank you.   
      
   To someone who does no work with these languages regularly, it is an easy   
   mistake to make.  If someone had passed that on to me and answered my   
   question with that when I posted it a week ago, it would have saved me a   
   week.   
      
   >   It sounds like you've got v. 5.1 of the Windows   
   > Script Host on the machine. I'm fairly certain   
   > that Exec is only in v. 5.6. You can fix it by updating   
   > the WSH to v. 5.6.   
   >   
   >   For WSH questions:   
   >    microsoft.public.scripting.wsh   
      
   Thanks.  I'll check which version I have (that's important -- I have to be   
   able to count on what is installed on the client's system, which means if a   
   copy of Win2k as recent as SP3 doesn't have it, I can't count on it being   
   on my clients' systems -- which means I'll either have to add something to   
   install 5.6 before installing my program, or not support Win2k.   
      
   Thank you!   
      
   Hal   
      
   > --   
   > _____________________________   
   >   
   > mayayXXana1a@mindYYspring.com   
   > For return email remove XX and YY.   
   > _____________________________   
   > Hal Vaughan  wrote in message   
   > news:k5SdnUhlPJJnnxncRVn-uw@comcast.com...   
   >> I have a script used to find and run Java on a Windows system. It worked   
   >> fine on original tests (on a Windows XP system). It's now running on a   
   >> Windows 2000 (sp3) system, and it won't work -- the problem is this line:   
   >>   
   >> set oCommand = WshShl.Exec(sCommand)   
   >>   
   >> (it's about halfway down) Is there a problem with the Exec method in some   
   >> versions of VBS? Is the problem Windows version I'm on, or is it   
   >> something more obvious that I'm just not seeing?   
   >>   
   >> The error is that the object doesn't support the Exec method. (I've also   
   >> substituted the string sCommand with "C:\WINNT\System32\sol.exe" just to   
   >> make a quick check, and it makes no difference (not that it should with   
   >> that error message, I just wanted to try a .exe I knew was there and   
   >> working).   
   >>   
   >> Thanks for any help!   
   >>   
   >> Hal   
   >>   
   >> '   
   >> 'Set up initial variables   
   >> '   
   >> qm = chr(34)   
   >> sqm = chr(39)   
   >> set WshShl = WScript.CreateObject("WScript.shell")   
   >>   
   >> sOut = "No Java Installed"   
   >> On Error Resume Next   
   >> sVersion = WshShl.RegRead("HKLM\SOFTWARE\JavaSoft\Java Runtime   
   >> Environment\CurrentVersion")   
   >> sJava = WshShl.RegRead("HKLM\SOFTWARE\JavaSoft\Java Runtime Environment\"   
   > &   
   >> sVersion & "\JavaHome")   
   >> On Error Goto 0   
   >>   
   >> sJava = sJava + "\bin\java.exe"   
   >> sCommand = sJava + " -version"   
   >> set oCommand = WshShl.Exec(sCommand)   
   >>   
   >> iCount = 10   
   >>   
   >> Do While oCommand.Status = 0   
   >> WScript.Sleep 100   
   >> Loop   
   >> 'WScript.Sleep 1000   
   >> 25   
   >> sOut = oCommand.StdErr.ReadAll   
   >>   
   >> WScript.StdOut.WriteLine("Command: ")   
   >> 'WScript.StdOut.WriteLine("Command: " & sJava)   
   >> 'WScript.StdOut.WriteLine(sOut)   
   >> WScript.StdOut.WriteLine(sVersion   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca