when trying to run this code in an hta file I keep getting the error :

--- object required "Wscript" ---

what's causing this error ??

====== code ======
<html>
<head>
<title>HTA Tools</title>

<HTA:APPLICATION
ID="objHTATools"
APPLICATIONNAME="Tools"
SCROLL="yes"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"
>

</head>
<SCRIPT Language="VBScript">

Set WshShell = CreateObject("WScript.Shell")
Set Args = WScript.Arguments '<== error on this line
If Args.Count >= 1 Then
vPath = Args(Args.Count-1)
End if

......

Re: object required 'Wscript" by Navaja

Navaja
Thu Aug 18 13:02:19 CDT 2005

What arguments are you trying to get? wscript.exe is not running this
script so there is nothing for it to get. At least I think this is
true. I don't think you can wscript methods in HTA's. I could be
wrong.


Re: object required 'Wscript" by Al

Al
Thu Aug 18 21:15:43 CDT 2005


"Jon Paal" <Jon nospam Paal @ everywhere dot com> wrote in message
news:O2hnnp7oFHA.2976@TK2MSFTNGP12.phx.gbl...
> when trying to run this code in an hta file I keep getting the error :
>
> --- object required "Wscript" ---
>
> what's causing this error ??
>
> ====== code ======
> <html>
> <head>
> <title>HTA Tools</title>
>
> <HTA:APPLICATION
> ID="objHTATools"
> APPLICATIONNAME="Tools"
> SCROLL="yes"
> SINGLEINSTANCE="yes"
> WINDOWSTATE="normal"
> >
>
> </head>
> <SCRIPT Language="VBScript">
>
> Set WshShell = CreateObject("WScript.Shell")
> Set Args = WScript.Arguments '<== error on this line
> If Args.Count >= 1 Then
> vPath = Args(Args.Count-1)
> End if
>
> ......

The problem is not with trying to access WSH-arguments passed to an HTA
script, but with trying to access an object (WScript.) that is predefined in
WSH but non-existent in HTA.

The scripting guys show how to use the facilities available to an HTA to
access command line arguments:

http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr05/hey0420.mspx

/Al



Re: object required 'Wscript" by Michael

Michael
Thu Aug 18 21:32:55 CDT 2005

Jon Paal wrote:
> when trying to run this code in an hta file I keep getting the error :
>
> --- object required "Wscript" ---
>
> what's causing this error ??

As Navaja norted, the WScript object is provided when wscript/cscript.exe is
the host.

For an HTA...

hta commandline parse group:*.scripting author:"Michael Harris" - Google
Groups
http://groups.google.com/groups?q=hta%20commandline%20parse%20group:*.scripting%20author:"Michael%20Harris"

--
Michael Harris
Microsoft MVP Scripting