| Sponsored Links |
| | #1 | |
![]() Join Date: Jun 2005
Posts: 1,433
Thanks: 0
Thanked 7 Times in 7 Posts
Rep Power: 12 | I was to specify a file from the command prompt at run time. I want the file that I specify from WScript.Argument to be read using objFSO.OpenTextFile. When I do it, i get the error: C:\stewart7.vbs(50, 3) Microsoft VBScript runtime error: Object doesn't support this property or method: 'WScript.Argument'. The whole of the function that I'm trying to create is this Quote:
Any ideas? | |
| |
| | #2 |
![]() Join Date: Feb 2006
Posts: 1,194
Thanks: 0
Thanked 1 Time in 1 Post
Rep Power: 0 | It's Wscript.Arguments (as in the plural of argument In any case Wscript.Arguments is a collection and you are using it in the context of a text string. |
| |
| | #3 |
![]() Join Date: Jun 2005
Posts: 1,433
Thanks: 0
Thanked 7 Times in 7 Posts
Rep Power: 12 | I understand why it's not working, what I can't figure is how to get it working |
| |
| | #4 |
![]() Join Date: Feb 2006
Posts: 1,194
Thanks: 0
Thanked 1 Time in 1 Post
Rep Power: 0 | Assuming that the file name is the first argument then you could do this Code: strReadFile = WScript.Arguments(1) set objFile = objFSO.OpenTextFile(strReadFile, 1) |
| |
| | #5 |
![]() Join Date: Jun 2005
Posts: 1,433
Thanks: 0
Thanked 7 Times in 7 Posts
Rep Power: 12 | I think I've got it, I changed it to an inputbox to get the filename! |
| |
| | #6 |
![]() Join Date: Feb 2006
Posts: 1,194
Thanks: 0
Thanked 1 Time in 1 Post
Rep Power: 0 | Ok and before anyone says it, yes I know the subscript should be 0 and not 1 for wscript.arguments |
| |
| |
| | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| VBScript Error | sqdge | Scripts | 20 | 13-09-2007 03:34 PM |
| VBScript / SQL Server | Gatt | Scripts | 5 | 23-05-2007 02:12 PM |
| another VBScript question! | StewartKnight | Coding | 4 | 03-05-2007 05:41 PM |
| vbscript arguements ? | mac_shinobi | Scripts | 1 | 20-02-2007 11:29 PM |
| Printer vbscript ? | mac_shinobi | Scripts | 1 | 14-09-2005 08:21 AM |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search Thread |
|
|





