Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

retrieving the path of a running HTA

1,710 views
Skip to first unread message

Jon Paskett

unread,
Oct 26, 2003, 7:55:57 PM10/26/03
to
I have an HTA file located on a network share and I need to retrieve its
path for use within the HTA. I have tried the standard
Path = Left(WScript.ScriptFullName, InStrRev(WScript.ScriptFullName, "\"))
but the HTA returns an error: Object Required 'WScript"
Any help in a work around will be greatly appreciated.

TIA

Jon


Michael Harris (MVP)

unread,
Oct 26, 2003, 8:09:01 PM10/26/03
to


<html>
<script language="vbscript">
moveto 75,75
resizeto 640,480
</script>
<head>
<title>test hta</title>
<hta:application
id="ohta" applicationname="testhta"
singleinstance="yes" windowstate="normal"
caption="yes" showintaskbar="yes"
sysmenu="yes" scroll="yes"
/>
<script language="vbscript">
sub dotest()
msgbox "document.location.pathname=" _
& document.location.pathname
msgbox "window.location.pathname=" _
& window.location.pathname
msgbox "top.location.pathname=" _
& top.location.pathname
end sub
</script>
</head>
<body>
<input type="button" value="do test"
onclick="vbscript:call dotest()">
<pre id=output></pre>
</body>
</html>

--
Michael Harris
Microsoft.MVP.Scripting

Windows 2000 Scripting Guide
Microsoft® Windows®2000 Scripting Guide
http://www.microsoft.com/technet/scriptcenter/scrguide/sagsas_overview.asp

TechNet Script Center Sample Scripts
http://www.microsoft.com/downloads/release.asp?ReleaseID=38942

WSH 5.6 documentation download
http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en

Jon Paskett

unread,
Oct 26, 2003, 11:12:24 PM10/26/03
to
Thank you Michael., you pull through for me again!

Jon


"Michael Harris (MVP)" <mik...@mvps.org> wrote in message
news:u5KOgbCn...@tk2msftngp13.phx.gbl...

Michael Harris (MVP)

unread,
Oct 27, 2003, 11:18:02 AM10/27/03
to
Jon Paskett wrote:
> Thank you Michael., you pull through for me again!

See also:

HTA:APPLICATION
commandLine Property (HTA:APPLICATION) (Internet Explorer)
http://msdn.microsoft.com/workshop/author/hta/reference/properties/commandline.asp

--
Michael Harris
Microsoft.MVP.Scripting

name

unread,
Oct 29, 2003, 2:22:51 AM10/29/03
to
Depending protocol and arguments you will see
 
quoted AND unquoted hta.commandLine(s).
 
 function getCommandLine() { 
 
  if(typeof oHta != "object") return
  if(!oHta.commandLine) return

  var e
  
  e = oHta.commandLine
  e = e.replace(/" "| "|"$|^"/ig,"|").split('|')
 
  if(e[e.length-1] == "") e.pop()
  if(e[0] == "") e.shift()
 
    return e
 }
 
I usually quote for the event of white spaced folder/file names.
Can't recall above explaination, but should works from Wscript,
Run box, registry commands, and Default.
 
 
 
 
 
"Michael Harris (MVP)" <mik...@mvps.org> wrote in message news:u5KOgbCn...@tk2msftngp13.phx.gbl...
0 new messages