WScript JavaScript库 [英] WScript JavaScript library

查看:69
本文介绍了WScript JavaScript库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我正在考虑制作一个基于WScript的JavaScript库,我可以想一下某些特定的非浏览器特定脚本示例的
这应该是可以实现的,就像Crockford的小JavaScripter一样,任何人都可以想到其他任何事情。是否有人熟悉任何类似的

已经完成。


我想提供的东西是:


JavaScript辅助函数用于进行WMI查询,管理返回的WMI

枚举器。


使用HTA等技术的JavaScript。


人们可以认为这样一个图书馆应该具体的

有什么?

解决方案

11月15,上午10:47,托马斯''PointedEars''Lahn< PointedE ... @ web.de>

写道:


pantagruel写道:


我正在考虑制作一个基于WScript的JavaScript库,



那个是反正的。显然你不知道什么是WScript对象和

JavaScript是什么。



Hoo boy。你是PointedEars。如果我眯着眼睛看我的语言眼睛,我几乎可以说出你在说什么,或者说b $ b,当你打电话给OPs语句antivalent时。当然,你完全错了。海报确实知道WScript主机是什么,而且他/ b $ b显然知道javascript是什么。男人,你真的只是为了夸大其事而花了很多时间。


所以,是的,pantagruel,如果你要写这个库,我会喜欢

参见参数输入,处理通配符,通过

目录递归,包含Exec的包装器以及所有可能的

返回码的处理程序。我不是一个高级的WScripter而且不希望如此。

你可能不得不去微软论坛以获得更好的答案。

答案。


Bob


11月15日下午4:47,Thomas''PointedEars''Lahn< PointedE ... @ web。 de>

写道:


pantagruelwrote:


I'm想要制作一个基于WScript的JavaScript库,



这是非常有用的。显然你不知道什么是JavaScript脚本和

什么是JavaScript。



我想我做的。 WScript是一个运行不同Microsoft

ActiveScripting语言的环境,其中微软实现

JavaScript是一个。

< a rel =nofollowhref =http://msdn2.microsoft.com/en-us/library/at5ydy31.aspxhttp://developer.mozilla.org/en/docs/JavaScript\"target =_ blank> http ://msdn2.microsoft.com/en-us/lib...ocs/JavaScript


我可以想到一些特定的非浏览器特定的脚本示例

应该可以使用,[...]



Windows脚本宿主本身就是浏览器特定的,如它支持

只有Microsoft JScript作为ECMAScript实现(如IE)。所以从它中排除其他代码就没有什么意义了。



我的意思是在浏览器中运行的JavaScript代码,以及在每个JavaScript实现中运行的
JavaScript。对于一个简单的

浏览器特定的javascript示例 :alert();是浏览器中的本机函数

。它在WScript中不存在。 WScript版本的

alert是WScript.Echo()

对于一个与浏览器无关的JavaScript的简单示例,一个对象的简单循环

功能:


功能提醒(p){

WScript.Echo(p);

}

function loopobject(obj){

if(gettype(obj)==" object"&& obj!= null){

for(var i in obj){

alert(i +":" + obj [i]);

}

}

}


当然也许我应该使用不同于浏览器不可知的术语

因为它意味着JavaScript不知道哪个浏览器它是什么? />
在常用用法中运行,而我的意思是对于它运行的任何JavaScript环境而言,它都是无关的。


实际上我我有点奇怪的情况是关于JavaScript

因为我在浏览器中真的不太了解它。我过去常常使用它,但是我的网站工作往往在服务器上

,所以我几年前在BSF中使用过JavaScript ,以及ASP和

ASP.NET,以及WScript中的相当多。


最好的问候



>

所以,是的,pantagruel,如果你要写这个库,我想

参见参数输入,处理通配符,通过

目录递归,包含Exec的包装器以及所有可能的

返回码的处理程序。我不是一个高级的WScripter而且不希望如此。

你可能不得不去微软论坛以获得更好的答案。

答案。



感谢您的建议。我在想:


1.更智能的命令行处理,指定解析命令行

以便所有文件都放入文件对象然后就可以了指定

在命令行类型的东西上运行函数x。


2.支持所有主要的vbscript数据类型转换(基本上只是

支持这一点,将它放在一个带有vbscript函数的WSF文件中,以便

返回正确的数据类型)这对于处理像WMI日期这样的东西很有用。


3.肯定是文件系统递归。


a问题:


您认为允许评估JavaScript是否有用
$ b命令行上的$ b代码,即在cscript.exe中运行JavaScript并允许

它作为shell运行?


最好的问候


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?

解决方案

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


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


>
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


这篇关于WScript JavaScript库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆