开发者

Include JS library in Windows

I need to create a simple utility to make my life a little easier. It creates a folder that gets name generated from the next Monday date with DateJS library. I am obviously to use this utility locally in Windows. What are the ways to include this DateJS libra开发者_Python百科ry to my utility JS file?


I assume you're using WSH – in other words, putting some script in a .js file and running it. Your options:

  • Simply copy the DateJS code from date.js and paste it to the bottom of your script. Easy, but messy and not maintainable.
  • Use the hacky method outlined in the "Importing External Script Code" section of this article. Basically, you read the external code in to a variable and eval() it. I would not recommend this method.
  • Save your script in the wsf format, a simple XML format which allows you to reference external scripts. This is probably your best route.

myscript.wsf:

<job id="myscript">
   <script language="JScript" src="date.js"/>
   <script language="JScript">
      // ...
   </script>
</job>


Couple of ways to do this:

  1. Go the hardcore route and write a C++ program that embeds V8
  2. Use something like Adobe Air, which is "basically" HTML and JavaScript in a standalone window
  3. Use Windows only .hta, but you need some J/VBScript stuff then in order to create the folder

If you want more specific answers, you should add more information to your question.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜