root/branches/experimental/jsolait/jsolait.wsf

Revision 82, 3.5 kB (checked in by Jan-Klaas Kollhof, 2 years ago)

updates

  • Property svn:keywords set to LastChangedBy LastChangedDate Date Revision Rev
Line 
1 <?xml version="1.0" standalone="yes" ?>
2 <job id="jsolait">
3     <?job error="true" debug="false"?>
4     <description>
5         JavaScript O Lait for WSH.
6        
7        Copyright (c) 2005-2006 Jan-Klaas Kollhof
8        
9        This file is part of jsolait
10      
11        jsolait is free software; you can redistribute it and/or modify
12        it under the terms of the GNU Lesser General Public License as published by
13        the Free Software Foundation; either version 2.1 of the License, or
14        (at your option) any later version.
15      
16        This software is distributed in the hope that it will be useful,
17        but WITHOUT ANY WARRANTY; without even the implied warranty of
18        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19        GNU Lesser General Public License for more details.
20      
21        You should have received a copy of the GNU Lesser General Public License
22        along with this software; if not, write to the Free Software
23        Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA     
24     </description>
25
26     <runtime>
27         <unnamed name="filename" helpstring="The scriptfiles to run." many="false" required="1" />
28         <named name="script-args" helpstring="Specifies arguments to pass to the module/script being run. This may be text or a JSON encoded object" many="false" required="0" />
29     </runtime>
30    
31     <script language="JavaScript" src="./jsolait.js" />
32     <script language="JavaScript" src="./packages/packages.pth" />
33
34    
35     <script language="JavaScript"> <![CDATA[
36         var fs= new ActiveXObject("Scripting.FileSystemObject");
37
38         jsolait.__sourceURI__ = 'file://' + WScript.scriptFullName.slice(0,-3) + "js";
39         jsolait.baseURI = 'file://' + fs.getParentFolderName(WScript.scriptFullName);
40         jsolait.moduleSearchURIs = ["%(baseURI)s/lib"].concat(ModuleSearchPaths);
41        
42        
43         setTimeout=function(fn){
44             fn();
45         };
46
47
48         print = function(m){
49             var s=[];
50             for(var i=0;i<arguments.length;i++){
51                 s.push(''+arguments[i]);
52             }
53            
54             WScript.echo(s.join(" "));
55         }
56        
57         pprint= function(m, indent){
58             var m = m.split("\n");
59            
60             indent =(indent === undefined) ? 0 : indent;
61            
62             if(indent<0){
63                 pprint.indent+=indent;
64             }
65            
66             var s=[];
67             for(var i=0;i<pprint.indent;i++){
68                 s.push(' ');
69             }
70             s=s.join('');
71             for(var i=0;i<m.length;i++){
72                 print(s + m[i]);
73             }
74            
75             if(indent>0){
76                 pprint.indent += indent;
77             }
78         }
79         pprint.indent=0;
80
81         Error.prototype.toString=function(){
82             s=""
83             for(var key in this){
84                 s+='\n' + key+':' + this[key]
85             }
86             return   s;
87         }
88
89         __wsFinished__=false;
90         try{   
91             jsolait.loadModule("wscript", function(jsolaitws,err){
92                 jsolaitws.run( function(err){
93                     __wsFinished__=true;
94                     if(err){
95                         print(''+err);
96                         throw err;
97                     }
98                
99                 });
100             });
101         }catch(e){
102             throw e;
103         }
104        
105         while(!__wsFinished__){
106             WScript.sleep(0);
107         }
108            
109     ]]>
110     </script>
111    
112 </job>
Note: See TracBrowser for help on using the browser.