468,740 Members | 2,094 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,740 developers. It's quick & easy.

WScript JavaScript library

Hi,

I'm thinking of making a WScript based JavaScript library, I can think
of some specific non-browser specific scripting examples that should
probably make it in, like Crockford's little JavaScripter, can anyone
think of anything else. Is anyone familiar with anything similar
already done.

Things that I am thinking that to provide are:

JavaScript helper functions to make WMI queries, manage returned WMI
enumerators.

JavaScript with such technologies as HTA.

Anything that people can think such a library should specifically
have?

Nov 15 '07 #1
12 8195
On Nov 15, 10:47 am, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
pantagruel wrote:
I'm thinking of making a WScript based JavaScript library,

That is antivalent. Apparently you don't know what the WScript object and
what JavaScript is.
Hoo boy. You are something, PointedEars . If I squint my
"grammatical eyes", I can just barely make out what you are talking
about when you call the OPs statement "antivalent". Of course, you're
completely wrong. The poster does know what the WScript host is and he
obviously knows what javascript is. Man, you really overreach just to
scratch an itch.

So, yes, pantagruel, if you were to write this library, I'd like to
see parameter typing, handling wildcards, recursing through
directories, a wrapper around Exec and handlers for all the possible
return codes. I am not an advanced WScripter and don't wish to be so
you may have to go over to the microsoft forums to get a better
answer.

Bob
Nov 15 '07 #2
On Nov 15, 4:47 pm, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
pantagruelwrote:
I'm thinking of making aWScriptbased JavaScript library,

That is antivalent. Apparently you don't know what theWScriptobject and
what JavaScript is.
I think I do. WScript is a environment for running different Microsoft
ActiveScripting languages, among which the Microsoft implementation of
JavaScript is one.
http://msdn2.microsoft.com/en-us/lib...ocs/JavaScript
I can think of some specific non-browser specific scripting examples
that should probably make it in, [...]

The Windows Script Host is somewhat browser-specific itself, as it supports
only Microsoft JScript as ECMAScript implementation (like IE). So there is
little point of excluding other code from it.
I meant specifically JavaScript code that runs in the browser and
JavaScript that runs in every JavaScript implementation. For a simple
example of browser specific javascript: alert(); is a native function
in the browser. It does not exist in WScript. The WScript version of
alert is WScript.Echo()
For a simple example of browser-agnostic JavaScript the simple looping
of an object function:

function alert(p){
WScript.Echo(p);
}
function loopobject(obj){
if(gettype(obj) == "object" && obj != null){
for (var i in obj) {
alert(i + ": " + obj[i]);
}
}
}

Of course maybe I should use a different term than browser agnostic
because it implies JavaScript that is agnostic about which browser it
runs in, in the common usage whereas I mean JavaScript that is
agnostic about whatever JavaScript environment it runs in.

Actually I am somewhat an odd case where JavaScript is concerned
because I really don't know it well in the browser. I used to use it a
very little bit but my website based work tends to be on the server
side, so I've used JavaScript in BSF some years ago, and in ASP and
ASP.NET, as well as quite a lot in WScript.

Best Regards
Nov 23 '07 #3
>
So, yes,pantagruel, if you were to write this library, I'd like to
see parameter typing, handling wildcards, recursing through
directories, a wrapper around Exec and handlers for all the possible
return codes. I am not an advanced WScripter and don't wish to be so
you may have to go over to the microsoft forums to get a better
answer.
Thanks for the suggestions. I was thinking:

1. some smarter command line handling, specify parsing of commandline
so that all files get put into a files object and then you can specify
run function x over all files on command line type stuff.

2. all major vbscript data type conversions supported (basically just
support this by having it in a WSF file with the vbscript functions to
return correct data types) good for handling stuff like WMI dates.

3. definitely filesystem recursing.

a question:

Do you think it would be useful to allow evaluation of JavaScript
code on the command line, i.e. run JavaScript in cscript.exe and allow
it to run as a shell?

Best Regards
Nov 23 '07 #4
On Nov 23, 10:19 am, pantagruel <rasmussen.br...@gmail.comwrote:
On Nov 15, 4:47 pm, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:pantagruelwrote:
I'm thinking of making aWScriptbased JavaScript library,
That is antivalent. Apparently you don't know what theWScriptobject and
what JavaScript is.

I think I do.WScriptis a environment for running different Microsoft
ActiveScripting languages, among which the Microsoft implementation of
JavaScript is one.
http://msdn2.microsoft.com/en-us/lib...ttp://develope...
I can think of some specific non-browser specific scripting examples
that should probably make it in, [...]
The Windows Script Host is somewhat browser-specific itself, as it supports
only Microsoft JScript as ECMAScript implementation (like IE). So there is
little point of excluding other code from it.

I meant specifically JavaScript code that runs in the browser and
JavaScript that runs in every JavaScript implementation. For a simple
example of browser specific javascript: alert(); is a native function
in the browser. It does not exist inWScript. TheWScriptversion of
alert isWScript.Echo()
For a simple example of browser-agnostic JavaScript the simple looping
of an object function:

function alert(p){WScript.Echo(p);

}

function loopobject(obj){
if(gettype(obj) == "object" && obj != null){
for (var i in obj) {
alert(i + ": " + obj[i]);

}
}
}

Of course maybe I should use a different term than browser agnostic
because it implies JavaScript that is agnostic about which browser it
runs in, in the common usage whereas I mean JavaScript that is
agnostic about whatever JavaScript environment it runs in.

Actually I am somewhat an odd case where JavaScript is concerned
because I really don't know it well in the browser. I used to use it a
very little bit but my website based work tends to be on the server
side, so I've used JavaScript in BSF some years ago, and in ASP and
ASP.NET, as well as quite a lot inWScript.

Best Regards
I should note that this is not truly JavaScript implementation
agnostic since of course I was using WScript.Echo(), but I just wanted
a quick example of code that worked on JavaScript as opposed to
working on the DOM as the kind of thing I meant.

Cheers,
Nov 23 '07 #5
pantagruel wrote:
[...] Thomas 'PointedEars' Lahn [...] wrote:
>pantagruelwrote:
>>I'm thinking of making aWScriptbased JavaScript library,
That is antivalent. Apparently you don't know what theWScriptobject and
what JavaScript is.

I think I do.
Yes, you *think* you do, but in fact you do not at all.
WScript is a environment for running different Microsoft ActiveScripting
languages,
That, at least, is true.
among which the Microsoft implementation of JavaScript is one.
Wrong. JScript is Microsoft's implementation of ECMAScript. JavaScript is
Netscape's/Mozilla.org's implementation of ECMAScript. Those are similar,
but different languages. Read the FAQ.
>http://msdn2.microsoft.com/en-us/lib...ocs/JavaScript
>>I can think of some specific non-browser specific scripting examples
that should probably make it in, [...]
The Windows Script Host is somewhat browser-specific itself, as it supports
only Microsoft JScript as ECMAScript implementation (like IE). So there is
little point of excluding other code from it.

I meant specifically JavaScript code that runs in the browser and
JavaScript that runs in every JavaScript implementation.
You have yet to understand that you are dealing with different programming
languages and different runtime environments here as indicated by my
previous comment.
For a simple example of browser specific javascript: alert(); is a native
function in the browser.
alert() is a method of a host object provided by the AOM of the HTML UA,
usually a Window object. It is not a feature of the programming language.
It does not exist in WScript.
As WScript provides another API than an HTML UA.
The WScript version of alert is WScript.Echo()
In a sense.
[more misconceptions]
Please learn to understand what you are doing before you can do further harm.
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Nov 23 '07 #6
Thomas 'PointedEars' Lahn said the following on 11/23/2007 10:15 AM:
pantagruel wrote:
>[...] Thomas 'PointedEars' Lahn [...] wrote:
>>pantagruelwrote:
I'm thinking of making aWScriptbased JavaScript library,
That is antivalent. Apparently you don't know what theWScriptobject and
what JavaScript is.
I think I do.

Yes, you *think* you do, but in fact you do not at all.
From the entire thread, I will give you 3-1 odds that pantagruel has a
better grasp on what the WScript Object is than you do.
>WScript is a environment for running different Microsoft ActiveScripting
languages,

That, at least, is true.
>among which the Microsoft implementation of JavaScript is one.

Wrong.
You are wrong.
JScript is Microsoft's implementation of ECMAScript.
If you are going to be pedantic, at least be completely pedantic.
JScript is Microsoft's implementation of a standard that attempted to
standardize what JScript already was. Not the other way around.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 24 '07 #7
Randy Webb wrote:
Thomas 'PointedEars' Lahn said the following on 11/23/2007 10:15 AM:
>JScript is Microsoft's implementation of ECMAScript.

If you are going to be pedantic, at least be completely pedantic.
JScript is Microsoft's implementation of a standard that attempted to
standardize what JScript already was. Not the other way around.
Not true. ECMAScript Edition 1 was based on what *both* JavaScript
(probably 1.1 and maybe even 1.2) and JScript (probably 2.0) supported at
the time.

,-[ECMA-262 Ed. 1, page 5]
|
| Brief History
|
| This ECMA Standard is based on several originating technologies, the most
| well known being JavaScript™ (Netscape Communications) and JScript™
| (Microsoft Corporation). The development of this Standard has started in
| November 1996.

Since then, it is not possible to determine what came first to introduce a
language feature -- the ECMAScript edition or the language implementation.

However, Microsoft itself says that JScript (and JScript .NET) is an
ECMAScript implementation, and rightly so:

,-<http://msdn2.microsoft.com/en-us/library/14cd3459.aspx>
|
| What Is JScript?
|
| JScript is the Microsoft implementation of the ECMA 262 language
| specification (ECMAScript Edition 3). With only a few minor exceptions (to
| maintain backwards compatibility), JScript is a full implementation of the
| ECMA standard.

,-<http://msdn2.microsoft.com/en-us/library/49zhkzs5(VS.71).aspx>
|
| Microsoft JScript Features - ECMA
|
| JScript .NET incorporates almost all of the features of the ECMAScript
| Edition 3 Language Specification. In addition, JScript .NET is being
| developed in conjunction with ECMAScript Edition 4 and incorporates
| many of the proposed features of that language as well. [...]

Needless to say that my statement also is in full accordance with this
newsgroup's FAQ:

,-<http://www.jibbering.com/faq/#FAQ2_7>
|
| 2.7 What is JScript?
|
| JScript is Microsoft's implementation of ECMAScript. [...]

Maybe you want to ask its maintainer why that statement was not changed if
it was deemed wrong. But wait -- isn't that you?
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Nov 24 '07 #8
among which the Microsoft implementation of JavaScript is one.

Wrong. JScript is Microsoft's implementation of ECMAScript. JavaScript is
Netscape's/Mozilla.org's implementation of ECMAScript. Those are similar,
but different languages. Read the FAQ.
Well, IIRC (not reading the faq again, many years since I last did and
am too lazy, but strangely not too lazy to post here) ECMAScript was
the standardisation of JavaScript, the earlier versions of JScript was
a reverse engineered JavaScript and the different name was not so much
because it was a different language but because of various legal
issues surrounding the name (I don't think this is mentioned in the
FAQ), the reverse engineering was done because MS was behind in the
browser war. When the ECMA standardization started MS tried to follow
and I thought that basically the version in IE 6+ (and thus in WScript
on a computer with IE 6+ installed) was ECMA-262 version 3 compatible.
My understanding that the main inconsistencies were in the
implementation of other standards with which the language interacts in
the browser, the DOM, CSS etc. I suppose there probably are going to
be some inconsistencies but I think those inconsistencies would
probably turn out to be things I would classify as pedantry, and
probably most people would agree. But hey, I could also be wrong.
>I can think of some specific non-browser specific scripting examples
that should probably make it in, [...]
The Windows Script Host is somewhat browser-specific itself, as it supports
only Microsoft JScript as ECMAScript implementation (like IE). So there is
little point of excluding other code from it.
I meant specifically JavaScript code that runs in the browser and
JavaScript that runs in every JavaScript implementation.

You have yet to understand that you are dealing with different programming
languages and different runtime environments here as indicated by my
previous comment.
Well I guess that's true, as I don't understand I am dealing with
different programming languages I understand rather that I am
discussing bringing the kind of library type functionality that one
sees in the main environment for JavaScript, the browser, to a
somewhat less well known environment, The Windows Scripting Host.

For a simple example of browser specific javascript: alert(); is a native
function in the browser.

alert() is a method of a host object provided by the AOM of the HTML UA,
usually a Window object. It is not a feature of the programming language.
I think you may be saying tomato and I may be saying tomatoe here.
When I said native function I meant something implemented in the
JavaScript environment as a function accessible by the language but
not a JavaScript function itself, although the type of alert in IE
only returns object which doesn't say much, while in FireFox you can
interact a bit more with alert than you can in IE:

Object.prototype.describe=function(){alert("Descri ption: " +
this);return this;}
alert.describe();
which gives

Description: function alert(){
[native code]
}

which is why I used the term native function to describe it. I'm sorry
if I should have avoided that term.

As WScript provides another API than an HTML UA.
The WScript version of alert is WScript.Echo()

In a sense.
yes, in a sense. perhaps I should have used the word analogue instead
of version.
[more misconceptions]
how where the following things misconceptions exactly:

1. the code that I provided works in WScript and apparently the way I
described. If I create an object then with this code I can loop over
its properties and make WScript.Echos of them, or as I called them in
my function alerts.

2. I suggested in the second paragraph that perhaps I had used the
wrong term for JavaScript that runs in different environments than the
browser when I used the term browser agnostic. IF this is a
misconception are you suggesting either that there is no such thing as
JavaScript that runs outside the browser or are you suggesting that
browser agnostic was a brilliant term and it is a misconception to
consider changing it. In which case, thanks!

3. The last paragraph I state I am somewhat an odd case because I have
spent very little time with JavaScript in the browser and that was
many years ago - basically with IE 5 and Netscape 4 as the main
browsers, although I have done quite a bit on the server in various
implementations - I realize that I mention some versions of the
language that you may describe as not different versions of the
language but different languages altogether (true about JScript.Net
dependent on .NET compatibility settings) was that the misconception?
Please learn to understand what you are doing before you can do further harm.
Well, I suppose that anything I did would not be of great harm,
because it would be limited to the Windows Scripting Host.

Thanks
Nov 25 '07 #9
Thomas 'PointedEars' Lahn said the following on 11/25/2007 7:35 PM:
pantagruel wrote:
<snip>
>>Please learn to understand what you are doing before you can do further harm.
Well, I suppose that anything I did would not be of great harm,
because it would be limited to the Windows Scripting Host.

Quite the contrary. Because you are dealing with script code here that does
not run in a sandbox, you have to make even more sure that you know what you
are doing than you would have to with scripting for and in HTML UAs. People
who use your library on their Windows system can suffer greatly from the
consequences of your incompetence up to the point of severe data loss otherwise.
It is amazing to me that anybody that displays the level of intelligence
that you display on a regular basis could survive in the real world for
more than a week.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 26 '07 #10
f3l
On Nov 25, 8:03 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
Thomas 'PointedEars' Lahn said the following on 11/25/2007 7:35 PM:
pantagruel wrote:

<snip>
>Please learn to understand what you are doing before you can do further harm.
Well, I suppose that anything I did would not be of great harm,
because it would be limited to the Windows Scripting Host.
Quite the contrary. Because you are dealing with script code here that does
not run in a sandbox, you have to make even more sure that you know what you
are doing than you would have to with scripting for and in HTML UAs. People
who use your library on their Windows system can suffer greatly from the
consequences of your incompetence up to the point of severe data loss otherwise.

It is amazing to me that anybody that displays the level of intelligence
that you display on a regular basis could survive in the real world for
more than a week.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/
the discussion here is completely off topic, and nobody cared to
answer the OP's question.
OP: have u used dmdscript?
Nov 26 '07 #11
>
the discussion here is completely off topic, and nobody cared to
answer the OP's question.
Well I did get some suggestions that were useful from beegee :)
OP: have u used dmdscript?
No, thanks, I saw that a long time ago but had totally forgot. This is
actually great for some of the work I have to do now. This makes the
whole thread worth it.

Cheers!
Nov 26 '07 #12
On Nov 26, 6:27 am, f3l <auditor...@gmail.comwrote:
On Nov 25, 8:03 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
Thomas 'PointedEars' Lahn said the following on 11/25/2007 7:35 PM:
pantagruel wrote:
<snip>
>>Please learn to understand what you are doing before you can do further harm.
>Well, I suppose that anything I did would not be of great harm,
>because it would be limited to the Windows Scripting Host.
Quite the contrary. Because you are dealing with script code here that does
not run in a sandbox, you have to make even more sure that you know what you
are doing than you would have to with scripting for and in HTML UAs. People
who use your library on their Windows system can suffer greatly from the
consequences of your incompetence up to the point of severe data loss otherwise.
It is amazing to me that anybody that displays the level of intelligence
that you display on a regular basis could survive in the real world for
more than a week.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/

the discussion here is completely off topic, and nobody cared to
answer the OP's question.

OP: have u used dmdscript?
oh and I will stop replying to the thread now to let it die. Thanks
again for dmdscript!
Nov 26 '07 #13

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Jason Davis | last post: by
1 post views Thread by Mike John | last post: by
2 posts views Thread by pantagruel | last post: by
2 posts views Thread by AbdulBaari | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.