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

Get ScriptFullNameand ScriptName using VBScript in an HTA

1,360 views
Skip to first unread message

Tolli Lowell-Forker

unread,
Sep 17, 2002, 4:55:25 PM9/17/02
to
In my vbscripts I use:

g_sScriptPath = Wscript.ScriptFullName
g_sScriptName = Wscript.ScriptName
g_sScriptFolder = Left(g_sScriptPath, Len(g_sScriptPath) -
Len(g_sScriptName))

to find out where the script is running from.

I am writing an HTA that has VBScript, but it will not work with
ScriptFullName or ScriptName. Is there some other way I can find out what
folder the HTA is being run from?

Thanks,

Tolli


Joe Earnest

unread,
Sep 17, 2002, 5:15:01 PM9/17/02
to
There are a whole host of ways to get the currently active folder, but there
is always some danger that the active folder may have changed after the
script was started. The simplest way for me is:

fldrActive= oFSO.GetAbsolutePathName(".\")

This seems to work on all versions. If you need to, you can easily verify
the existence of the script file in that folder to be sure that it is
program folder.

Regards,
Joe Earnest


"Tolli Lowell-Forker" <tlfork...@hotmail.com> wrote in message
news:#MBYnxoXCHA.2556@tkmsftngp12...

MikeB

unread,
Sep 17, 2002, 9:01:20 PM9/17/02
to
oHTA.document.Script.location.pathname

(where oHTA is the APPLICATION id)seems to do the same, but includes the
name of the file, so I still had to use fso.GetParentFolderName to parse the
path without using a brute force method from the string.


"Tolli Lowell-Forker" <tlfork...@hotmail.com> wrote in message

news:euxnAJqXCHA.2452@tkmsftngp11...
> Thanks, that worked from inside the HTA.
>
> Tolli
>
> "Joe Earnest" <joeea...@qwest.net> wrote in message
> news:#GvdC7oXCHA.2656@tkmsftngp11...

Joe Earnest

unread,
Sep 18, 2002, 12:38:39 PM9/18/02
to
Mike,

Thanks. That can prove useful.

Regards,
Joe Earnest

"MikeB" <m.takemeo...@verizont.net> wrote in message
news:##RM66qXCHA.1652@tkmsftngp08...

Tolli Lowell-Forker

unread,
Sep 18, 2002, 6:59:18 PM9/18/02
to
That seems to work, but I need to use "window.document.location.pathname" -
I tried using the ApplicationID, but WINDOW.DOCUMENT seemed to work.
ApplicationID works, but in the MDE2002, the ApplicationID.document. won't
autocomplete, when window.document. will autocomplete - strange...

One thing with this though, is that in the value that it returns, all spaces
are converted into "%" characters...

Could someone suggest a quick way to replace all the % characters with space
characters?

Thanks,

Tolli

"MikeB" <m.takemeo...@verizont.net> wrote in message
news:##RM66qXCHA.1652@tkmsftngp08...

Tolli Lowell-Forker

unread,
Sep 18, 2002, 7:03:46 PM9/18/02
to
Figured it out:

replace(window.document.location.pathname,"%20"," ")

Thanks

"Tolli Lowell-Forker" <tlfork...@hotmail.com> wrote in message

news:u0pufb2XCHA.4080@tkmsftngp08...

Tolli Lowell-Forker

unread,
Sep 18, 2002, 7:12:25 PM9/18/02
to
Here's the final code from the HTA:

g_sScriptPath = replace(window.document.location.pathname,"%20"," ")

g_sScriptFolder = g_oFSO.GetAbsolutePathName(".\")

g_sScriptName = Right(g_sScriptPath, Len(g_sScriptPath) -
(Len(g_sScriptFolder)+1))


This gets me the Path, the Folder, and the File Name.


"Tolli Lowell-Forker" <tlfork...@hotmail.com> wrote in message

news:#Gbs$d2XCHA.2328@tkmsftngp09...

0 new messages