WScript JavaScript library - Javascript

This is a discussion on WScript JavaScript library - Javascript ; 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 ...

+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 17

WScript JavaScript library

  1. Default 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?


  2. Default Re: WScript JavaScript library

    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.

    http://msdn2.microsoft.com/en-us/library/at5ydy31.aspx
    http://developer.mozilla.org/en/docs/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.


    PointedEars
    --
    Anyone who slaps a 'this page is best viewed with Browser X' label on
    a Web page appears to be yearning for the bad old days, before the Web,
    when you had very little chance of reading a document written on another
    computer, another word processor, or another network. -- Tim Berners-Lee

  3. Default Re: WScript JavaScript library

    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

  4. Default Re: WScript JavaScript library

    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

  5. Default Re: WScript JavaScript library


    >
    > 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

  6. Default Re: WScript JavaScript library

    On Nov 23, 10:19 am, pantagruel <rasmussen.br...@gmail.com> wrote:
    > 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,

  7. Default Re: WScript JavaScript library

    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

  8. Default Re: WScript JavaScript library

    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/

  9. Default Re: WScript JavaScript library

    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

  10. Default Re: WScript JavaScript library


    > > 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("Description: " +
    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 ****ogue 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

+ Reply to Thread
Page 1 of 2 1 2 LastLast

Similar Threads

  1. Javascript Library
    By Application Development in forum Javascript
    Replies: 119
    Last Post: 01-13-2008, 12:28 PM
  2. Re: Library not registered Javascript error
    By Application Development in forum Sharepoint
    Replies: 0
    Last Post: 10-09-2007, 02:24 AM
  3. Re: Library not registered Javascript error
    By Application Development in forum Sharepoint
    Replies: 0
    Last Post: 10-02-2007, 05:54 AM
  4. RE: Library not registered Javascript error
    By Application Development in forum Sharepoint
    Replies: 0
    Last Post: 06-25-2007, 09:24 AM
  5. Re: Library not registered Javascript error
    By Application Development in forum Sharepoint
    Replies: 0
    Last Post: 06-06-2007, 08:20 AM