WSH 5.6 on NT 4.0 SP4 - GetObject trouble 
Author Message
 WSH 5.6 on NT 4.0 SP4 - GetObject trouble

  Just started using WSH as of yesterday so bear with me.

  I am trying to open up a .TXT file using notepad.

  I copy and pasted the following VBS code from the WSH 5.6
  help documentation under GetObject Method:

Dim MyObject As Object
Set MyObject = GetObject("C:\DRAWINGS\SAMPLE.DRW", "FIGMENT.DRAWING")

  I changed the path and omitted the "FIGMENT.DRAWING".
  I keep getting an error pointing to the 14th character on line 1. So I
dropped the "As Object". And now get Line 2
Char: 1 "File name or class name not found durin Automation operation:
"GetObject" Code 800A01B0

why is this so difficult? I know it's beta documentation but shouldn't
this work?

greg

*** Sent via Developersdex http://www.*-*-*.com/ ***
Don't just participate in USENET...get rewarded for it!



Mon, 05 Jul 2004 01:13:21 GMT  
 WSH 5.6 on NT 4.0 SP4 - GetObject trouble
There is no automation model for TXT files supported by Notepad or any other program/component (excluding the Scripting.FileSystemObject).

What exactly is the problem/task at hand?

--
Michael Harris
Microsoft.MVP.Scripting
--

Quote:

>   Just started using WSH as of yesterday so bear with me.

>   I am trying to open up a .TXT file using notepad.

>   I copy and pasted the following VBS code from the WSH 5.6
>   help documentation under GetObject Method:

> Dim MyObject As Object
> Set MyObject = GetObject("C:\DRAWINGS\SAMPLE.DRW", "FIGMENT.DRAWING")

>   I changed the path and omitted the "FIGMENT.DRAWING".
>   I keep getting an error pointing to the 14th character on line 1. So I
> dropped the "As Object". And now get Line 2
> Char: 1 "File name or class name not found durin Automation operation:
> "GetObject" Code 800A01B0

> why is this so difficult? I know it's beta documentation but shouldn't
> this work?

> greg

> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



Mon, 05 Jul 2004 03:21:28 GMT  
 WSH 5.6 on NT 4.0 SP4 - GetObject trouble

  I have my script results redirected to a .txt file.
  I would like to have notepad open up the TXT file after the script
finishes redirecting output to the TXT file.
  Considering the example(s) given in "WSH.CHM" (the WSH 5.6 help file)
under GetObject Method it seemed possible.
  I was trying to do this using VBS.

  any suggestions?

greg

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Mon, 05 Jul 2004 03:37:21 GMT  
 WSH 5.6 on NT 4.0 SP4 - GetObject trouble
set WshShell = CreateObject("WScript.Shell")
WshShell.Run "notepad.exe ""c:\my path\my file.txt"""
or
WshShell.Run """c:\my path\my file.txt"""

--
Michael Harris
Microsoft.MVP.Scripting
--

Quote:

>   I have my script results redirected to a .txt file.
>   I would like to have notepad open up the TXT file after the script
> finishes redirecting output to the TXT file.
>   Considering the example(s) given in "WSH.CHM" (the WSH 5.6 help file)
> under GetObject Method it seemed possible.
>   I was trying to do this using VBS.

>   any suggestions?

> greg

> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



Mon, 05 Jul 2004 04:09:37 GMT  
 WSH 5.6 on NT 4.0 SP4 - GetObject trouble

nevermind...the newbie figured it out.

Set WshShell = WScript.CreateObject("WScript.shell")
WshShell.Run "notepad e:\script_output.txt"

i started at "A" in the Methods helpfile and made it to "G" (GetObject)
when i first posted my question...obviously i've now made it to "R"
...i'm so green

greg

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Mon, 05 Jul 2004 04:21:23 GMT  
 WSH 5.6 on NT 4.0 SP4 - GetObject trouble

didn't see your previous response, thank you for your time Michael!

greg

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Mon, 05 Jul 2004 04:25:17 GMT  
 WSH 5.6 on NT 4.0 SP4 - GetObject trouble
Try this:

  Dim Shell : Set Shell = Wscript.CreateObject("WScript.Shell")
  Shell.Run("NotePad MyFile.txt")
' or simply
  Shell.Run("MyFile.txt")


Quote:
> I have my script results redirected to a .txt file.
>   I would like to have notepad open up the TXT file after the script
> finishes redirecting output to the TXT file.



Mon, 05 Jul 2004 08:52:47 GMT  
 WSH 5.6 on NT 4.0 SP4 - GetObject trouble

thanks Ingo...i like it shorter like that.

if i use "Shell" without the "Wsh" prefix like you do, does this change
the way the code is interpreted or is it just an abbreviation?

greg

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Mon, 05 Jul 2004 20:33:15 GMT  
 WSH 5.6 on NT 4.0 SP4 - GetObject trouble
It's just a variable name...

  Dim foobar: Set foobar = Wscript.CreateObject("WScript.Shell")
  foobar.Run("NotePad MyFile.txt")
' or simply
  foobar.Run("MyFile.txt")

works just as well ;-)...

--
Michael Harris
Microsoft.MVP.Scripting
--

Quote:

> thanks Ingo...i like it shorter like that.

> if i use "Shell" without the "Wsh" prefix like you do, does this change
> the way the code is interpreted or is it just an abbreviation?

> greg

> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



Tue, 06 Jul 2004 01:59:08 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. wsh 5.6 type attribute trouble with wshom.ocx (COM)

2. WSH on NT 4.0 Server without IE 4.0 (5.0)

3. Using GetObject under NT 4.0

4. WSH 5.6 Beta for NT missing files?

5. deploying WSH 5.6 with NT logon script

6. Ghostscript on NT 4.0 + Epson Stylus Pro XL trouble

7. Trouble With Beta 5.6 and WshController

8. BUG in WSH 5.6 install if Wscript.exe is running while updating WSH

9. BUG in WSH 5.6 install if Wscript.exe is running while updating WSH

10. WSH bug status (pre-WSH 5.6 beta)

11. BUG in WSH 5.6 install if Wscript.exe is running while updating WSH

12. NT 4.0 does not understand WSH

 

 
Powered by phpBB® Forum Software