Re: Extracting data from an XML to put into a constant




"Paul Randall" <paulr901@xxxxxxxxxxxx> wrote in message
news:uuFxTasjIHA.5724@xxxxxxxxxxxxxxxxxxxxxxx

"Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx> wrote in message
news:Op%23rPHrjIHA.1168@xxxxxxxxxxxxxxxxxxxxxxx
Paul Randall wrote:
"Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx> wrote in message
news:%23Uwu$tpjIHA.248@xxxxxxxxxxxxxxxxxxxxxxx
mr_unreliable wrote:
Bob Barrows [MVP] wrote:
Well, you cannot set a contant's value at runtime: constants
can
only be set at compile time,

If one is willing to use the "wsf" construct, then one may
access the constants in an object's typelib by using the
"reference tag".

Here is an example:

--- <code> ---
<job>
<reference object="Excel.***.8" />
<script language="VBScript">
MsgBox("test XL ref. xlTextFormat = " & CStr(xlTextFormat))
</script>
</job>
--- </code> ---

Copy out the code into a file, and name it "testXLConstant.wsf".

Interesting, but I don't understand the relevance. You don't seem
to
be
talking about setting a constant's value at runtime.

If it is not 'runtime', what time context is the <reference
object=
...> construct running in?

I don't know, I've never seen this before. You tell me.


I suspect that behind the scenes, it is doing something similar
what I
do in the DefineConstants routine I posted last year, but maybe
not in
the same time context.

Ok, so you don't know either. Why don't you suspect this type
library
isn't being accessed at the script's compile time? Similar to what
occurs when setting a reference to a type library in VB?

You are correct -- I don't know. I don't have a reference that
discusses the process of 'running' a .vbs or .wsf file. I'm trying
to create a model in my mind that seems to be consistent with what I
see. I appreciate your input.

In the following example
<job>
<script language="VBScript">
MsgBox("test XL ref. TristateUseDefault = " &
CStr(TristateUseDefault))
</script>
<reference object="wscript.shell" />
</job>

the value of TristateUseDefault is known to the script which
indicates some prescan mechanism is occurring. Having played with
multiple <script > ... </script> blocks in HTAs, I think that each
block has its own prescan, but perhaps the <job>...</job> block has
a prescan too.

Sorry - bad example. This is better:
<job>
<script language="VBScript">
MsgBox("test adodb ref. adAffectAllChapters = " &
CStr(adAffectAllChapters))
</script>
//<reference object="ADODB.Stream" />
</job>


.