Sergei Basharov
Sergei Basharov

Reputation: 53850

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 library to my utility JS file?

Upvotes: 2

Views: 753

Answers (2)

josh3736
josh3736

Reputation: 144912

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>

Upvotes: 6

Ivo Wetzel
Ivo Wetzel

Reputation: 46745

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.

Upvotes: -2

Related Questions