Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Error

Reply
 
Old 11-22-2008   #1 (permalink)
PaulM


 
 

Error

Why do I get this error on line 5; Object required (WScript) - Arguments
But the script runs ok, no errors.
Only get this error when I debug with Web_Ed editor.

'This script will Enable User Account Control

Dim WshShell, ObjShell, Message

Line 5 here > If WScript.Arguments.length = 0 Then
Set ObjShell = CreateObject("Shell.Application")
ObjShell.ShellExecute "wscript.exe", """" & _
WScript.ScriptFullName & """" & " uac","", "runas", 1
Else
Message = "This script will Enable User Account Control." & vbCr & vbCr _
& "After you Run this script, you must Reboot for this to take effect." &
vbCr & vbCr _
& "Adding information can unintentionally change or delete values and cause
components to stop working correctly." _
& " If you do not trust the source of this information, do not add it to
the registry." & vbCr & vbCr _
& "Would you like to continue?"

Set WshShell = WScript.CreateObject("WScript.Shell")

M = MsgBox(Message, vbYesNo + vbInformation, "Tweaks")
If M = 6 Then

WshShell.RegWrite
"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA",
1, "REG_DWORD"

Message = "UAC is now ENABLED!" & vbCr & vbCr _
& "You must Reboot for this change to take effect."
MsgBox Message, 64, "Tweaks"
End If
End If


My System SpecsSystem Spec
Old 11-22-2008   #2 (permalink)
Pegasus \(MVP\)


 
 

Re: Error


"PaulM" <NONO@xxxxxx> wrote in message
news:%23Tkq2uLTJHA.5344@xxxxxx
Quote:

> Why do I get this error on line 5; Object required (WScript) - Arguments
> But the script runs ok, no errors.
> Only get this error when I debug with Web_Ed editor.
>
> 'This script will Enable User Account Control
>
> Dim WshShell, ObjShell, Message
>
> Line 5 here > If WScript.Arguments.length = 0 Then
> Set ObjShell = CreateObject("Shell.Application")
> ObjShell.ShellExecute "wscript.exe", """" & _
> WScript.ScriptFullName & """" & " uac","", "runas", 1
> Else
> Message = "This script will Enable User Account Control." & vbCr & vbCr _
> & "After you Run this script, you must Reboot for this to take effect." &
> vbCr & vbCr _
> & "Adding information can unintentionally change or delete values and
> cause components to stop working correctly." _
> & " If you do not trust the source of this information, do not add it to
> the registry." & vbCr & vbCr _
> & "Would you like to continue?"
>
> Set WshShell = WScript.CreateObject("WScript.Shell")
>
> M = MsgBox(Message, vbYesNo + vbInformation, "Tweaks")
> If M = 6 Then
>
> WshShell.RegWrite
> "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA",
> 1, "REG_DWORD"
>
> Message = "UAC is now ENABLED!" & vbCr & vbCr _
> & "You must Reboot for this change to take effect."
> MsgBox Message, 64, "Tweaks"
> End If
> End If
Can't tell - you need to post lines 1 to 4 too.


My System SpecsSystem Spec
Old 11-22-2008   #3 (permalink)
Richard Mueller [MVP]


 
 

Re: Error


"PaulM" <NONO@xxxxxx> wrote in message
news:%23Tkq2uLTJHA.5344@xxxxxx
Quote:

> Why do I get this error on line 5; Object required (WScript) - Arguments
> But the script runs ok, no errors.
> Only get this error when I debug with Web_Ed editor.
>
> 'This script will Enable User Account Control
>
> Dim WshShell, ObjShell, Message
>
> Line 5 here > If WScript.Arguments.length = 0 Then
> Set ObjShell = CreateObject("Shell.Application")
> ObjShell.ShellExecute "wscript.exe", """" & _
> WScript.ScriptFullName & """" & " uac","", "runas", 1
> Else
> Message = "This script will Enable User Account Control." & vbCr & vbCr _
> & "After you Run this script, you must Reboot for this to take effect." &
> vbCr & vbCr _
> & "Adding information can unintentionally change or delete values and
> cause components to stop working correctly." _
> & " If you do not trust the source of this information, do not add it to
> the registry." & vbCr & vbCr _
> & "Would you like to continue?"
>
> Set WshShell = WScript.CreateObject("WScript.Shell")
>
> M = MsgBox(Message, vbYesNo + vbInformation, "Tweaks")
> If M = 6 Then
>
> WshShell.RegWrite
> "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA",
> 1, "REG_DWORD"
>
> Message = "UAC is now ENABLED!" & vbCr & vbCr _
> & "You must Reboot for this change to take effect."
> MsgBox Message, 64, "Tweaks"
> End If
> End If
It seems we are not seeing the whole script. I don't see where you use
Wscript.Arguments. However, possibly the Wscript object is not available to
Web_Ed editor. This object is provided by the wscript (or cscript) host
program. The script must be launched by one of these host programs, or the
Wscript objects and methods are not available (like Wscript.Sleep for
example).

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


My System SpecsSystem Spec
Old 11-22-2008   #4 (permalink)
PaulM


 
 

Re: Error

Right here:

Line 1.> 'This script will Enable User Account Control
Line 2.>
Line 3.> Dim WshShell, ObjShell, Message
Line 4.>
Line 5 here > If WScript.Arguments.length = 0 Then
Line 6.>Set ObjShell = CreateObject("Shell.Application")
Line 7.> ObjShell.ShellExecute "wscript.exe", """" & _
Line 8.> WScript.ScriptFullName & """" & " uac","", "runas", 1
Line 9.> Else

And so on.


"Pegasus (MVP)" <I.can@xxxxxx> wrote in message
news:#tRsG4LTJHA.4680@xxxxxx
Quote:

>
> "PaulM" <NONO@xxxxxx> wrote in message
> news:%23Tkq2uLTJHA.5344@xxxxxx
Quote:

>> Why do I get this error on line 5; Object required (WScript) - Arguments
>> But the script runs ok, no errors.
>> Only get this error when I debug with Web_Ed editor.
>>
>> 'This script will Enable User Account Control
>>
>> Dim WshShell, ObjShell, Message
>>
>> Line 5 here > If WScript.Arguments.length = 0 Then
>> Set ObjShell = CreateObject("Shell.Application")
>> ObjShell.ShellExecute "wscript.exe", """" & _
>> WScript.ScriptFullName & """" & " uac","", "runas", 1
>> Else
>> Message = "This script will Enable User Account Control." & vbCr & vbCr _
>> & "After you Run this script, you must Reboot for this to take effect." &
>> vbCr & vbCr _
>> & "Adding information can unintentionally change or delete values and
>> cause components to stop working correctly." _
>> & " If you do not trust the source of this information, do not add it to
>> the registry." & vbCr & vbCr _
>> & "Would you like to continue?"
>>
>> Set WshShell = WScript.CreateObject("WScript.Shell")
>>
>> M = MsgBox(Message, vbYesNo + vbInformation, "Tweaks")
>> If M = 6 Then
>>
>> WshShell.RegWrite
>> "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA",
>> 1, "REG_DWORD"
>>
>> Message = "UAC is now ENABLED!" & vbCr & vbCr _
>> & "You must Reboot for this change to take effect."
>> MsgBox Message, 64, "Tweaks"
>> End If
>> End If
>
> Can't tell - you need to post lines 1 to 4 too.
>
My System SpecsSystem Spec
Old 11-22-2008   #5 (permalink)
Pegasus \(MVP\)


 
 

Re: Error

Check out Richard's reply - his suggestion about unavailable objects appears
to be spot on.

"PaulM" <NONO@xxxxxx> wrote in message
news:Ov3Tc9LTJHA.4680@xxxxxx
Quote:

> Right here:
>
> Line 1.> 'This script will Enable User Account Control
> Line 2.>
> Line 3.> Dim WshShell, ObjShell, Message
> Line 4.>
> Line 5 here > If WScript.Arguments.length = 0 Then
> Line 6.>Set ObjShell = CreateObject("Shell.Application")
> Line 7.> ObjShell.ShellExecute "wscript.exe", """" & _
> Line 8.> WScript.ScriptFullName & """" & " uac","", "runas", 1
> Line 9.> Else
>
> And so on.
>
>
> "Pegasus (MVP)" <I.can@xxxxxx> wrote in message
> news:#tRsG4LTJHA.4680@xxxxxx
Quote:

>>
>> "PaulM" <NONO@xxxxxx> wrote in message
>> news:%23Tkq2uLTJHA.5344@xxxxxx
Quote:

>>> Why do I get this error on line 5; Object required (WScript) - Arguments
>>> But the script runs ok, no errors.
>>> Only get this error when I debug with Web_Ed editor.
>>>
>>> 'This script will Enable User Account Control
>>>
>>> Dim WshShell, ObjShell, Message
>>>
>>> Line 5 here > If WScript.Arguments.length = 0 Then
>>> Set ObjShell = CreateObject("Shell.Application")
>>> ObjShell.ShellExecute "wscript.exe", """" & _
>>> WScript.ScriptFullName & """" & " uac","", "runas", 1
>>> Else
>>> Message = "This script will Enable User Account Control." & vbCr & vbCr
>>> _
>>> & "After you Run this script, you must Reboot for this to take effect."
>>> & vbCr & vbCr _
>>> & "Adding information can unintentionally change or delete values and
>>> cause components to stop working correctly." _
>>> & " If you do not trust the source of this information, do not add it
>>> to the registry." & vbCr & vbCr _
>>> & "Would you like to continue?"
>>>
>>> Set WshShell = WScript.CreateObject("WScript.Shell")
>>>
>>> M = MsgBox(Message, vbYesNo + vbInformation, "Tweaks")
>>> If M = 6 Then
>>>
>>> WshShell.RegWrite
>>> "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA",
>>> 1, "REG_DWORD"
>>>
>>> Message = "UAC is now ENABLED!" & vbCr & vbCr _
>>> & "You must Reboot for this change to take effect."
>>> MsgBox Message, 64, "Tweaks"
>>> End If
>>> End If
>>
>> Can't tell - you need to post lines 1 to 4 too.
>>

My System SpecsSystem Spec
Old 11-22-2008   #6 (permalink)
mayayana


 
 

Re: Error

> Line 5 here > If WScript.Arguments.length = 0 Then

WScript is only available when running scripts
with WScript. If your script is running in a webpage,
for instance, you can't use the WScript object.

Also, if you're using VBS I wonder if you want count
rather than length. According to the WSH help,
count returns the number of items in a dictionary
or collection. (Arguments is a collection.) That's also
true in VB.
Arguments.length shows up in the javascript
sample code, so maybe that's a JS-specific way to
handle collections.
On the other hand, I just tried running a script:

msgbox wscript.arguments.length

and it works fine, showing a msgbox containing "0".
Strange. It's odd that the WSH help doesn't seem to
specifically list the properties and methods of collection
objects.



My System SpecsSystem Spec
Old 11-22-2008   #7 (permalink)
mayayana


 
 

Re: Error

> It seems we are not seeing the whole script. I don't see where you use
Quote:

> Wscript.Arguments. However, possibly the Wscript object is not available
to
Quote:

> Web_Ed editor. This object is provided by the wscript (or cscript) host
> program. The script must be launched by one of these host programs, or the
> Wscript objects and methods are not available (like Wscript.Sleep for
> example).
>
WEB-ED is not an interpreter. It runs the script in WScript
(unless CScript has been selected). I'm guessing that the
script is running in a webpage, even though the code showing
doesn't look that way.


My System SpecsSystem Spec
Old 11-22-2008   #8 (permalink)
PaulM


 
 

Re: Error

Thanks for all the help, its just odd that I get that error, but the script
works fine.
No big deal.


"mayayana" <mayaXXyana@xxxxxx> wrote in message
news:eSTvqHMTJHA.1160@xxxxxx
Quote:
Quote:

>> Line 5 here > If WScript.Arguments.length = 0 Then
>
> WScript is only available when running scripts
> with WScript. If your script is running in a webpage,
> for instance, you can't use the WScript object.
>
> Also, if you're using VBS I wonder if you want count
> rather than length. According to the WSH help,
> count returns the number of items in a dictionary
> or collection. (Arguments is a collection.) That's also
> true in VB.
> Arguments.length shows up in the javascript
> sample code, so maybe that's a JS-specific way to
> handle collections.
> On the other hand, I just tried running a script:
>
> msgbox wscript.arguments.length
>
> and it works fine, showing a msgbox containing "0".
> Strange. It's odd that the WSH help doesn't seem to
> specifically list the properties and methods of collection
> objects.
>
>
>
My System SpecsSystem Spec
Old 11-24-2008   #9 (permalink)
Al Dunbar


 
 

Re: Error

When your script runs it may give you results that you feel are acceptable,
but they are only coincidentally correct. It is not good practice to include
code that fails to do what it is intended to accomplish.

/Al

"PaulM" <NONO@xxxxxx> wrote in message
news:uP1WcVMTJHA.3932@xxxxxx
Quote:

> Thanks for all the help, its just odd that I get that error, but the
> script works fine.
> No big deal.
>
>
> "mayayana" <mayaXXyana@xxxxxx> wrote in message
> news:eSTvqHMTJHA.1160@xxxxxx
Quote:
Quote:

>>> Line 5 here > If WScript.Arguments.length = 0 Then
>>
>> WScript is only available when running scripts
>> with WScript. If your script is running in a webpage,
>> for instance, you can't use the WScript object.
>>
>> Also, if you're using VBS I wonder if you want count
>> rather than length. According to the WSH help,
>> count returns the number of items in a dictionary
>> or collection. (Arguments is a collection.) That's also
>> true in VB.
>> Arguments.length shows up in the javascript
>> sample code, so maybe that's a JS-specific way to
>> handle collections.
>> On the other hand, I just tried running a script:
>>
>> msgbox wscript.arguments.length
>>
>> and it works fine, showing a msgbox containing "0".
>> Strange. It's odd that the WSH help doesn't seem to
>> specifically list the properties and methods of collection
>> objects.
>>
>>
>>

My System SpecsSystem Spec
Old 11-25-2008   #10 (permalink)
PaulM


 
 

Re: Error

I have about 50 scripts all for Vista and all get the same error in Web-Ed
and all the scripts work fine.
Maybe it is something in Web-Ed.


"Al Dunbar" <alandrub@xxxxxx> wrote in message
news:#ivP0TrTJHA.2468@xxxxxx
Quote:

> When your script runs it may give you results that you feel are
> acceptable, but they are only coincidentally correct. It is not good
> practice to include code that fails to do what it is intended to
> accomplish.
>
> /Al
>
> "PaulM" <NONO@xxxxxx> wrote in message
> news:uP1WcVMTJHA.3932@xxxxxx
Quote:

>> Thanks for all the help, its just odd that I get that error, but the
>> script works fine.
>> No big deal.
>>
>>
>> "mayayana" <mayaXXyana@xxxxxx> wrote in message
>> news:eSTvqHMTJHA.1160@xxxxxx
Quote:

>>>> Line 5 here > If WScript.Arguments.length = 0 Then
>>>
>>> WScript is only available when running scripts
>>> with WScript. If your script is running in a webpage,
>>> for instance, you can't use the WScript object.
>>>
>>> Also, if you're using VBS I wonder if you want count
>>> rather than length. According to the WSH help,
>>> count returns the number of items in a dictionary
>>> or collection. (Arguments is a collection.) That's also
>>> true in VB.
>>> Arguments.length shows up in the javascript
>>> sample code, so maybe that's a JS-specific way to
>>> handle collections.
>>> On the other hand, I just tried running a script:
>>>
>>> msgbox wscript.arguments.length
>>>
>>> and it works fine, showing a msgbox containing "0".
>>> Strange. It's odd that the WSH help doesn't seem to
>>> specifically list the properties and methods of collection
>>> objects.
>>>
>>>
>>>
>
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Help with windows vista mail, Socket Error: 10053, Error Number: 0x800CCC0F Vista mail
no,socket Error: 11003. Error Number: 0x800CC0D cant i send email name is correctly Vista mail
Canot post to newsgroups Socket Error: 10053, Error Number: 0x800CCC0F Vista mail
Canot post to newsgroups Socket Error: 10053, Error Number: 0x800CCC0F Vista General
windows live mail 2008 (Build 12.0.1606) error report error Windows Live


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46