Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

JScript, VBScript, TCC code in one .BTM file

Aug
1,929
71
Attached is a file called AllInOne.zip, which contains AllInOne.btm

AllInOne.btm
demonstrates having JScript, VBScript, TCC code in one .BTM file

Windows Scripting Host seems to only care about the package section of a file, and ignores everything else.

This .BTM can also be used as an .INI file.

Thus, the first part of this .BTM is TCC code,
the second part is VBScript/JScript code,
and the third part is an .INI file.

I'm posting this mainly for my future reference, but others may be interested also.

I tried to post the code for the .BTM in the forum, but it would not allow me to post it, saying that I had been blocked.

As the .BTM also contains WSF code (XML code), I'm thinking that is why I was not allowed to post it.

Joe
 

Attachments

  • AllInOne.zip
    1.4 KB · Views: 365
Thanks, Joe. That's pretty cool.

But I can't get it to work in a TCC library function. It seems to depend on more than the "package" section.

My library file is D:\data\tcclibrary\sv.btm. Since %0 doesn't make sense, I hard-code the file name into the cscript call, like this.

Code:
cscript //nologo //job:SVJOB "d:\data\tcclibrary\sv.btm?.wsf"

The tail of the library file looks like this (in VIEW).

1589126581104.png


When I execute the library function, I get

Code:
d:\data\tcclibrary\sv.btm?.wsf(103, 2) Windows Script Host: Unterminated entity reference - matching ';' not found

Any ideas?
 
Hey @vefatica,
This is in my file vb.library;
1589128067209.png

Note that I have other functions/code in my file vb.library.

From the folder where the vb.library file is located;
Code:
c:\program files\jpsoft\tcmd26\library>cscript //nologo vb.library?.wsf
Test

I then went and added COMMENT ENDCOMMENT, then;
Code:
c:\program files\jpsoft\tcmd26\library>library /r vb.library /u

c:\program files\jpsoft\tcmd26\library>cscript //nologo vb.library?.wsf
Test
and still did as it was supposed to.

Joe
 
OK ... got it working.

My library file had a few lines like this one.

Code:
    set name=%s[%i] & set /a i+=1

I don't know why but they screwed things up. All was OK when I changed them to the likes of

Code:
    set name=%s[%i]
    set /a i+=1

So what's up with the '&'?
 
The ampersand (&) is a reserved character in XML.

For example, if I make a library function, thus;
Code:
vbtest {
@setlocal
@echo off
set a=1
::&
}
...the XML Parser sees the ampersand (&) in the TCC code, and thinks that it is part of the XML code.

Joe
 
I also tried %+ in place of & (maybe for the first time in 25 years!). That worked too.
 
Back
Top