merged tag ooo/OOO330_m14
[LibreOffice.git] / extensions / test / ole / JScriptNewStyle.htm
blob016119d1908b66bcdf883b2fee280a750072f7f6
1 <HTML>
2 <HEAD>
3 <META NAME="GENERATOR" Content="Microsoft Developer Studio">
4 <META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
5 <TITLE>Document Title</TITLE>
6 </HEAD>
7 <BODY id=theBody>
9 <script language="JScript">
10 function callOleTest( id)
12 var factory= new ActiveXObject("com.sun.star.ServiceManager");
13 var oletest= factory.createInstance("oletest.OleTest");
14 // alert(oletest);
16 var arr= new Array( 1, 2, 3, 4, 0);
17 var arrDouble= new Array( 1.2345, 12.345, 123,45, 1234.5, 12345);
18 var arrBool= new Array( 1, 0, 2, 0, 3);
19 var arrChar= new Array( '1', 'A', "1", "A", ' ', 55, 56);
20 var arrString= new Array("hamburger","cheeseburger", "chicken nuggets", "chicken wings" , "pizza");
21 var arrAny= new Array( 100, 100.1235,"hallo");
22 var arrSeq= new Array( arr, arr, arr);
23 var arrSeq2= new Array( arrSeq, arrSeq, arrSeq)
25 // var ob= new Object();
26 // ob.value= "A JScript object";
27 // var arrObject= new Array( ob, ob, ob);
30 var arrout1= new Array();
31 var arrout2= new Array();
32 var arrout3= new Array();
34 var ret, i;
35 var sfarray, sfarray1, sfarray2, sfarray3;
36 var value= oletest._GetValueObject();
37 var outValue= oletest._GetValueObject();
38 outValue.InitOutParam();
39 var outValue2= oletest._GetValueObject();
40 outValue2.InitOutParam();
41 var outValue3= oletest._GetValueObject();
42 outValue3.InitOutParam();
44 var inoutValue= oletest._GetValueObject();
45 // inoutValue.InitInOutParam();
47 switch( id)
49 // Array in-params
50 case 1:
51 value.Set("[]byte", arr)
52 ret= oletest.methodByte( value);
53 sfarray= new VBArray( ret);
54 document.writeln( "Param: " + arr.toString() + "<br>");
55 document.writeln( "Returns a Sequence&lt BYTE &gt <br>" + sfarray.toArray()) ; break;
57 case 2:
58 value.Set("[]double", arrDouble)
59 ret= oletest.methodDouble( value);
60 sfarray= new VBArray( ret);
61 document.writeln( "Param: " + arrDouble.toString() +"<br>");
62 document.writeln( "Returns a Sequence&lt double &gt <br>" + sfarray.toArray()) ; break;
64 case 3:
65 value.Set("[]boolean", arrBool)
66 ret= oletest.methodBool( value);
67 sfarray= new VBArray( ret);
68 document.writeln( "Param: " + arrBool.toString() +"<br>");
69 document.writeln( "Returns a Sequence&lt BOOL &gt <br>" + sfarray.toArray()) ; break;
71 case 4:
72 value.Set("[]short", arr)
73 ret= oletest.methodShort( value);
74 sfarray= new VBArray( ret);
75 document.writeln( "Param: " + arr.toString() +"<br>");
76 document.writeln( "Returns a Sequence&lt SHORT &gt <br>" + sfarray.toArray()) ; break;
78 case 5:
79 value.Set("[]unsigned short", arr)
80 ret= oletest.methodUShort( value);
81 sfarray= new VBArray( ret);
82 document.writeln( "Param: " + arr.toString() +"<br>");
83 document.writeln( "Returns a Sequence&lt unsigned SHORT &gt <br>" + sfarray.toArray()) ; break;
85 case 6:
86 value.Set("[]long", arr)
87 ret= oletest.methodLong( value);
88 sfarray= new VBArray( ret);
89 document.writeln( "Param: " + arr.toString() +"<br>");
90 document.writeln( "Returns a Sequence&lt LONG &gt <br>" + sfarray.toArray()) ; break;
92 case 7:
93 value.Set("[]unsigned long", arr)
94 ret= oletest.methodULong( value);
95 sfarray= new VBArray( ret);
96 document.writeln( "Param: " + arr.toString() +"<br>");
97 document.writeln( "Returns a Sequence&lt unsigned LONG &gt <br>" + sfarray.toArray()) ; break;
99 case 8:
100 value.Set("[]char", arrChar)
101 ret= oletest.methodChar( value);
102 sfarray= new VBArray( ret);
103 document.writeln( "Param: " + arrChar.toString() +"<br>");
104 document.writeln( "Returns a Sequence&lt wchar_t &gt <br>" + sfarray.toArray()) ; break;
106 case 9:
107 value.Set("[]string", arrString)
108 ret= oletest.methodString( value);
109 sfarray= new VBArray( ret);
110 document.writeln( "Param: " + arrString.toString() +"<br>");
111 document.writeln( "Returns a Sequence&lt UString &gt <br>" + sfarray.toArray()) ; break;
113 case 10:
114 value.Set("[]any", arrAny)
115 ret= oletest.methodAny( value);
116 sfarray= new VBArray( ret);
117 document.writeln( "Param: " + arrAny.toString() +"<br>");
118 document.writeln( "Returns a Sequence&lt UsrAny &gt <br>" + sfarray.toArray() ) ; break;
120 case 11:
121 var allArray= new Array();
122 for(var i= 0; i <3; i++)
124 var value1= oletest._GetValueObject();
125 value1.Set("[]long", arr);
126 allArray[i]= value1;
129 value.Set("[][]long", allArray);
131 ret= oletest.methodSequence( value);
132 sfarray= new VBArray( ret);
133 document.writeln( "Param: " + arrSeq.toString() +"<br>");
134 document.writeln("Returns a Sequence&lt Sequence &lt long &gt&gt <br>") ;
135 var arr1= new Array();
136 arr1= sfarray.toArray();
137 for( i=0; i < arr1.length; i++)
139 sfarray2= new VBArray( arr1[i]);
140 var arr2= new Array();
141 arr2= sfarray2.toArray();
142 document.writeln( arr2.toString() + "<br>" );
144 break;
146 case 12:
147 var array1= new Array();
148 for(var i= 0; i <3; i++)
150 var array2 = new Array();
151 for( var j= 0; j < 3; j++)
153 var value2= oletest._GetValueObject();
154 value2.Set("[]long", arr);
155 array2[j]= value2;
158 var value1= oletest._GetValueObject();
159 value1.Set("[][]long", array2)
160 array1[i]= value1;
162 var valueAll= oletest._GetValueObject();
163 valueAll.Set("[][][]long",array1);
165 ret= oletest.methodSequence2( valueAll);
166 document.writeln( "Param: " + arrSeq2.toString() +"<br>");
167 sfarray1= new VBArray( ret);
168 arr1= sfarray1.toArray();
169 for( i=0; i < arr1.length; i++)
171 sfarray2= new VBArray( arr1[i]);
172 arr2= sfarray2.toArray();
174 for ( j=0; j < arr2.length; j++)
176 sfarray3= new VBArray( arr2[j]);
177 arr3= sfarray3.toArray();
178 document.write( i+ " ");
179 document.writeln(j + ": "+ arr3.toString() + "<br>" );
183 break;
185 case 13:
187 var ar= new Array();
188 for( i=0; i< 3; i++)
190 var ob= new Object();
191 var valueObject= oletest._GetValueObject();
192 ob.value= "A JScript object!";
193 valueObject.Set("com.sun.star.uno.XInterface", ob);
194 // valueObject.Set("long", 5);
195 ar[i]= valueObject;
197 value.Set("[]com.sun.star.uno.XInterface", ar);
198 // value.Set("[]long", ar);
200 ret = oletest.methodXInterface( value);
201 sfarray= new VBArray( ret);
202 var arRet= sfarray.toArray();
204 document.writeln( "Params : Array containing objects ")
205 for( index in ar)
207 document.writeln( "object " + index + ": " + ar[index].Get().value +" ");
209 document.writeln( "<br>" ) ;
210 document.writeln("Return: <br>");
211 for( index in arRet)
213 document.writeln( "object " + index + ": " + arRet[index].value + " ");
215 break;
220 // Properties: setting and getting values
221 case 200:
222 value.Set("[]byte", arr)
223 oletest.AttrByte = value;
224 ret= oletest.AttrByte;
225 sfarray= new VBArray( ret);
226 document.writeln("Setting AttrByte: " + arr.toString() + "<p>");
227 document.writeln("Getting AttrByte: " + sfarray.toArray()); break;
229 case 201:
230 value.Set("[]double", arrDouble)
231 oletest.AttrDouble= value;
232 ret= oletest.AttrDouble;
233 sfarray= new VBArray( ret);
234 document.writeln("Setting AttrDouble: " + arrDouble.toString() + "<p>");
235 document.writeln("Getting AttrDouble: " + sfarray.toArray()); break;
237 case 202:
238 value.Set("[]boolean", arrBool)
239 oletest.AttrBool= value;
240 ret= oletest.AttrBool;
241 sfarray= new VBArray( ret);
242 document.writeln("Setting AttrBool: " + arrBool.toString() + "<p>");
243 document.writeln("Getting AttrBool: " + sfarray.toArray()); break;
245 case 203:
246 value.Set("[]short", arr)
247 oletest.AttrShort= value;
248 ret= oletest.AttrShort;
249 sfarray= new VBArray( ret);
250 document.writeln("Setting AttrShort: " + arr.toString() + "<p>");
251 document.writeln("Getting AttrShort: " + sfarray.toArray()); break;
253 case 204:
254 value.Set("[]unsigned short", arr)
255 oletest.AttrUShort= value;
256 ret= oletest.AttrUShort;
257 sfarray= new VBArray( ret);
258 document.writeln("Setting AttrUShort: " + arr.toString() + "<p>");
259 document.writeln("Getting AttrUShort: " + sfarray.toArray()); break;
261 case 205:
262 value.Set("[]long", arr)
263 oletest.AttrLong= value;
264 ret= oletest.AttrLong;
265 sfarray= new VBArray( ret);
266 document.writeln("Setting AttrLong: " + arr.toString() + "<p>");
267 document.writeln("Getting AttrLong: " + sfarray.toArray()); break;
269 case 206:
270 value.Set("[]unsigned long", arr)
271 oletest.AttrULong= value;
272 ret= oletest.AttrULong;
273 sfarray= new VBArray( ret);
274 document.writeln("Setting AttrULong: " + arr.toString() + "<p>");
275 document.writeln("Getting AttrULong: " + sfarray.toArray()); break;
277 case 207:
278 value.Set("[]char", arrChar)
279 oletest.AttrChar= value;
280 ret= oletest.AttrChar;
281 sfarray= new VBArray( ret);
282 document.writeln("Setting AttrChar: " + arrChar.toString() + "<p>");
283 document.writeln("Getting AttrChar: " + sfarray.toArray()); break;
285 case 208:
286 value.Set("[]string", arrString)
287 oletest.AttrString= value;
288 ret= oletest.AttrString;
289 sfarray= new VBArray( ret);
290 document.writeln("Setting AttrString: " + arrString.toString() + "<p>");
291 document.writeln("Getting AttrString: " + sfarray.toArray()); break;
293 case 209:
294 value.Set("[]any", arrAny)
295 oletest.AttrAny= value;
296 ret= oletest.AttrAny;
297 sfarray= new VBArray( ret);
298 document.writeln("Setting AttrAny: " + arrAny.toString() + "<p>");
299 document.writeln("Getting AttrAny: " + sfarray.toArray()); break;
301 case 210:
302 var allArray= new Array();
303 for(var i= 0; i <3; i++)
305 var value1= oletest._GetValueObject();
306 value1.Set("[]long", arr);
307 allArray[i]= value1;
310 value.Set("[][]long", allArray);
312 oletest.AttrSequence= value;
313 ret= oletest.AttrSequence;
314 sfarray= new VBArray( ret);
316 document.writeln( "Param: " + arrSeq.toString() +"<br>");
317 document.writeln("Returns a Sequence&lt Sequence &lt long &gt&gt <br>") ;
318 var arr1= new Array();
319 arr1= sfarray.toArray();
320 for( i=0; i < arr1.length; i++)
322 sfarray2= new VBArray( arr1[i]);
323 var arr2= new Array();
324 arr2= sfarray2.toArray();
325 document.writeln( arr2.toString() + "<br>" );
327 break;
329 case 211:
330 var array1= new Array();
331 for(var i= 0; i <3; i++)
333 var array2 = new Array();
334 for( var j= 0; j < 3; j++)
336 var value2= oletest._GetValueObject();
337 value2.Set("[]long", arr);
338 array2[j]= value2;
341 var value1= oletest._GetValueObject();
342 value1.Set("[][]long", array2)
343 array1[i]= value1;
345 var valueAll= oletest._GetValueObject();
346 valueAll.Set("[][][]long",array1);
348 oletest.AttrSequence2= valueAll;
349 ret= oletest.AttrSequence2;
350 sfarray1= new VBArray( ret);
351 arr1= sfarray1.toArray();
352 for( i=0; i < arr1.length; i++)
354 sfarray2= new VBArray( arr1[i]);
355 arr2= sfarray2.toArray();
357 for ( j=0; j < arr2.length; j++)
359 sfarray3= new VBArray( arr2[j]);
360 arr3= sfarray3.toArray();
361 document.write( i+ " ");
362 document.writeln(j + ": "+ arr3.toString() + "<br>" );
366 break;
368 case 212:
369 var ar= new Array();
370 for( i=0; i< 3; i++)
372 var ob= new Object();
373 var valueObject= oletest._GetValueObject();
374 ob.value= "A JScript object!";
375 valueObject.Set("com.sun.star.uno.XInterface", ob);
376 ar[i]= valueObject;
378 value.Set("[]com.sun.star.uno.XInterface", ar);
380 oletest.AttrXInterface= value;
381 ret= oletest.AttrXInterface;
382 sfarray= new VBArray( ret);
383 var arRet= sfarray.toArray();
385 document.writeln( "Params : Array containing objects ")
386 for( index in ar)
388 document.writeln( "object " + index + ": " + ar[index].Get().value +" ");
390 document.writeln( "<br>" ) ;
391 document.writeln("Return: <br>");
392 for( index in arRet)
394 document.writeln( "object " + index + ": " + arRet[index].value + " ");
397 break;
399 // Out-parameter ------------------------------------------------------------
400 case (2000):
402 oletest.testout_methodByte( outValue );
403 alert("byte: " + outValue.Get() ); break;
404 case (2001):
405 oletest.testout_methodDouble( outValue );
406 alert( "double: " + outValue.Get() ); break;
407 case (2002):
408 oletest.testout_methodBool( outValue );
409 alert( "boolean: " + outValue.Get() ); break;
410 case (2003):
411 oletest.testout_methodShort( outValue );
412 alert( "short: " + outValue.Get() ); break;
413 case (2004):
414 oletest.testout_methodUShort( outValue );
415 alert( "unsigned short: " + outValue.Get() ); break;
416 case (2005):
417 oletest.testout_methodLong( outValue );
418 alert( "long: " + outValue.Get() ); break;
419 case (2006):
420 oletest.testout_methodULong( outValue );
421 alert( "unsigned long: " + outValue.Get() ); break;
422 case (2007):
423 oletest.testout_methodChar( outValue );
424 alert( "char: " + outValue.Get() ); break;
425 case (2008):
426 oletest.testout_methodString( outValue );
427 alert( "string: " + outValue.Get()); break;
428 case (2009):
429 oletest.testout_methodAny( outValue );
430 alert( "any: " + outValue.Get() ); break;
431 case (2010):
432 oletest.testout_methodSequence( outValue );
433 var sfarray= new VBArray( outValue.Get());
434 arr= sfarray.toArray();
435 document.writeln("use the browser's back arrow to go to the previous page <p>");
436 document.writeln( arr.toString());
437 break;
438 case (2011):
439 oletest.testout_methodSequence2( outValue );
440 var sfarray= new VBArray( outValue.Get());
441 arr= sfarray.toArray();
442 var i;
443 for( i=0; i < arr.length; i++)
445 var sfarray= new VBArray( arr[i]);
446 var arr2= new Array();
447 arr2= sfarray.toArray();
448 document.writeln( arr2.toString() + "<br>" );
450 break;
451 case (2012):
452 oletest.testout_methodMulParams1( outValue, outValue2 );
453 document.writeln( "int : " + outValue.Get() + " int :" + outValue2.Get()); break;
454 case (2013):
455 oletest.testout_methodMulParams2( outValue, outValue2, outValue3 );
456 document.writeln( "int: " + outValue.Get() + " int: " + outValue2.Get() + " string: " + outValue3.Get() ); break;
457 case (2014):
458 oletest.testout_methodMulParams3( "hallo", outValue );
459 document.writeln( "string: " + outValue.Get() ); break;
460 case (2015):
461 oletest.testout_methodXInterface( outValue );
462 var out= outValue.Get();
463 document.writeln( "string: " + out.AttrAny2); break;
465 // INOUT - Parameter -------------------------------------------------------------------------------
466 // The in value has to be placed on index 0 of the passed in array
467 case (500):
468 inoutValue.InitInOutParam("byte", 100);
469 oletest.testinout_methodByte( inoutValue );
470 alert("byte: " + inoutValue.Get() ); break;
471 case (501):
472 inoutValue.InitInOutParam("double", 3.14);
473 oletest.testinout_methodDouble( inoutValue );
474 alert( "double: " + inoutValue.Get() ); break;
475 case (502):
476 inoutValue.InitInOutParam("boolean", false);
477 oletest.testinout_methodBool( inoutValue );
478 alert( "boolean: " + inoutValue.Get() ); break;
479 case (503):
480 inoutValue.InitInOutParam( "short", 200);
481 oletest.testinout_methodShort( inoutValue );
482 alert( "short: " + inoutValue.Get() ); break;
483 case (504):
484 inoutValue.InitInOutParam("unsigned short", 300);
485 oletest.testinout_methodUShort( inoutValue );
486 alert( "unsigned short: " + inoutValue.Get() ); break;
487 case (505):
488 inoutValue.InitInOutParam("long", 400);
489 oletest.testinout_methodLong( inoutValue );
490 alert( "long: " + inoutValue.Get() ); break;
491 case (506):
492 inoutValue.InitInOutParam( "unsigned long", 500);
493 oletest.testinout_methodULong( inoutValue );
494 alert( "unsigned long: " + inoutValue.Get() ); break;
495 case (507):
496 inoutValue.InitInOutParam( "char", "A");
497 oletest.testinout_methodChar( inoutValue );
498 alert( "char: " + inoutValue.Get() ); break;
499 case (508):
500 inoutValue.InitInOutParam("string", "I am a string");
501 oletest.testinout_methodString( inoutValue );
502 alert( "string: " + inoutValue.Get() ); break;
503 case (509):
504 inoutValue.InitInOutParam("[]long", arr);
505 oletest.testinout_methodAny( inoutValue ); // the method simply returns the argument
506 sfarray= new VBArray( inoutValue.Get());
507 arr= sfarray.toArray();
508 alert( "any: " + arr.toString() ); break;
509 case (510):
510 inoutValue.InitInOutParam("[]long", arr);
511 oletest.testinout_methodSequence( inoutValue );
512 var sfarray= new VBArray( inoutValue.Get());
513 arr= sfarray.toArray();
514 document.writeln("use the browser's back arrow to go to the previous page <p>");
515 document.writeln( arr.toString());
516 break;
517 case (511):
518 inoutValue.InitInOutParam( "[][]long", arrSeq);
519 oletest.testinout_methodSequence2( inoutValue );
520 var sfarray= new VBArray( inoutValue.Get());
521 arr= sfarray.toArray();
522 var i;
523 for( i=0; i < arr.length; i++)
525 var sfarray= new VBArray( arr[i]);
526 var arr2= new Array();
527 arr2= sfarray.toArray();
528 document.writeln( arr2.toString() + "<br>" );
530 break;
531 case 512:
532 var ob= new Object();
533 ob.value= "this is a string";
534 inoutValue.InitInOutParam( "com.sun.star.script.XInvocation", ob);
535 oletest.testinout_methodXInterface( inoutValue);
536 document.write("Out value: " + inoutValue.Get().value );
537 break;
543 // Test ANY
544 // Methods
545 case 1000:
546 i= 100;
547 ret= oletest.methodAnyTest1( i);
548 document.writeln( "in: " + i + " ret: " + ret);
549 break;
550 case 1001:
551 i= 3.14;
552 ret= oletest.methodAnyTest1( i);
553 document.writeln( "in: " + i + " ret: " + ret);
554 break;
555 case 1002:
556 i= "Hallo"
557 ret= oletest.methodAnyTest1( i);
558 document.writeln( "in: " + i + " ret: " + ret);
559 break;
560 case 1003:
561 i= arr;
562 ret= oletest.methodAnyTest1( i);
563 sfarray= new VBArray( ret);
564 document.writeln( "in: " + i + " ret: " + sfarray.toArray());
565 break;
566 case 1004:
567 var obj= new Object();
568 obj[1]= "This is index 0";
569 ret= oletest.methodAnyTest1( obj);
570 document.writeln( "in: " + obj + " ret: " + ret);
571 break;
574 // Test ANY property
575 case 1010:
576 i= 100;
577 oletest.AttrAny2= i;
578 ret= oletest.AttrAny2;
579 document.writeln( "set: " + i + " get: " + ret);
580 break;
581 case 1011:
582 i= 3.14;
583 oletest.AttrAny2= i;
584 ret= oletest.AttrAny2;
585 document.writeln( "set: " + i + " get: " + ret);
586 break;
587 case 1012:
588 i= "Hallo"
589 oletest.AttrAny2= i;
590 ret= oletest.AttrAny2;
591 document.writeln( "set: " + i + " get: " + ret);
592 break;
593 case 1013:
594 i= arr;
595 oletest.AttrAny2= i;
596 ret= oletest.AttrAny2;
597 sfarray= new VBArray( ret);
598 document.writeln( "set: " + i + " get: " + sfarray.toArray());
599 break;
600 case 1014:
601 var obj= new Object();
602 obj[1]= "This is index 0";
603 oletest.AttrAny2= obj;
604 ret= oletest.AttrAny2;
605 document.writeln( "set: " + obj + " get: " + ret);
606 break;
609 case 2100:
610 alert("2100");
611 var ret= oletest.retMethodByte();
612 var sfarray= VBArray( ret);
613 document.writeln( sfarray.toArray() );
614 break;
617 // case 5000:
618 // oletest.other_methodAnyIn("hallo");
626 function funcOut( out)
628 out["du"]= 0xffff;
631 </script>
633 <script language="VBScript">
635 sub callBasic(id)
637 Dim factory
638 Set factory= GetObject("", "com.sun.star.ServiceManager")
640 Set oletest= factory.createInstance("oletest.OleTest")
643 arrInt= Array(1,2,3,4,5)
644 arrInt2= Array( -1, -2, 127, 128, 0)
645 arrDouble= Array(1.1, 2.2, 3.3, 4.4, 5.5)
646 arrBool= Array(0,1,0,2,0)
647 arrLong= Array( &Hff, &Hffff, &Hffffff, &Hffffffff)
648 arrString= Array("Chicken Wings", "Cheeseburger", "Hamburger")
649 arrChar= Array("a",65, "M")
650 arrAny= Array("Mickey", 3.14, 100, "A")
652 Dim arrDim2Int(1,1)
653 For i= 0 To 1
654 For j= 0 To 1
655 arrDim2Int(i,j) = i*2 + j
656 Next
657 Next
659 Dim arrDim3Int(1,1,1)
660 For i= 0 To 1
661 For j= 0 To 1
662 For k=0 To 1
663 arrDim3Int(i,j,k) = i*2 + j*2 + k
664 Next
665 Next
666 Next
669 set outValue= factory.Bridge_GetValueObject()
670 outValue.InitOutParam
671 set value= factory.Bridge_GetValueObject()
672 select case id
673 case 0
674 value.Set "[]byte", arrInt
675 ret= oletest.methodByte(value)
676 document.writeln "<br> return value: "
677 printArray ret
678 case 1
679 document.writeln "param: "
680 printArray arrDouble
681 ret= oletest.methodDouble(arrDouble)
682 document.writeln "<br> return value: "
683 printArray ret
684 case 2
685 document.writeln "param: "
686 printArray arrBool
687 ret= oletest.methodBool(arrBool)
688 document.writeln "<br> return value: "
689 printArray ret
690 case 3
691 document.writeln "param: "
692 printArray arrInt2
693 ret= oletest.methodShort(arrInt2)
694 document.writeln "<br> return value: "
695 printArray ret
696 case 4
697 document.writeln "param: "
698 printArray arrInt
699 ret= oletest.methodUShort(arrInt)
700 document.writeln "<br> return value: "
701 printArray ret
702 case 5
703 document.writeln "param: "
704 printArray arrLong
705 ret= oletest.methodLong(arrLong)
706 document.writeln "<br> return value: "
707 printArray ret
708 case 6
709 document.writeln "param: "
710 printArray arrInt
711 ret= oletest.methodULong(arrInt)
712 document.writeln "<br> return value: "
713 printArray ret
714 case 7
715 document.writeln "param: "
716 printArray arrString
717 ret= oletest.methodString(arrString)
718 document.writeln "<br> return value: "
719 printArray ret
720 case 8
721 document.writeln "param: "
722 printArray arrChar
723 ret= oletest.methodChar(arrChar)
724 document.writeln "<br> return value: "
725 printArray ret
726 case 9
727 document.writeln "param: "
728 printArray arrAny
729 ret= oletest.methodAny(arrAny)
730 document.writeln "<br> return value: "
731 printArray ret
732 case 10
733 document.writeln "param: "
734 printArray2 arrDim2Int
735 ret= oletest.methodSequence(arrDim2Int)
736 document.writeln "<br> return value: "
737 for each val in ret
738 document.write "<br> array: "
739 for each val2 in val
740 document.write val2
741 next
742 next
744 // In Out Parameter --------------------------------------------------
745 case 100
746 a= 100
747 document.write "param: " & CStr( a) & "<br>"
748 oletest.testinout_methodByte a
749 document.write a
750 case 101
751 a= 1.11
752 document.write "param: " & CStr( a) & "<br>"
753 oletest.testinout_methodDouble a
754 document.write a
755 case 102
756 a= 5
757 document.write "param: "& CStr( a) & "<br>"
758 oletest.testinout_methodBool a
759 document.write a
760 case 103
761 a= -10
762 document.write "param: "& CStr( a) & "<br>"
763 oletest.testinout_methodShort a
764 document.write a
765 case 104
766 a= 128
767 document.write "param: "& CStr( a) & "<br>"
768 oletest.testinout_methodUShort a
769 document.write a
770 case 105
771 a= 65556
772 document.write "param: "& CStr( a) & "<br>"
773 oletest.testinout_methodLong a
774 document.write a
775 case 106
776 a= 65556
777 document.write "param: "& CStr( a) & "<br>"
778 oletest.testinout_methodULong a
779 document.write a
780 case 107
781 a= "ein test string"
782 document.write "param: "& CStr( a) & "<br>"
783 oletest.testinout_methodString a
784 document.write a
785 case 108
786 a= "W"
787 document.write "param: "& CStr( a) & "<br>"
788 oletest.testinout_methodChar a
789 document.write a
790 case 109
791 a= "Ein String im Any"
792 document.write "param: "& CStr( a) & "<br>"
793 oletest.other_methodAnyIn a
794 document.write a
795 // Attributes -----------------------------------------------------------------
796 case 200
797 document.write "set: "
798 printArray arrInt
799 oletest.AttrByte= arrInt
800 b= oletest.AttrByte
801 call printArrayEx( "<br> get: ", "<br>", b)
802 case 201
803 document.write "set: "
804 printArray arrDouble
805 oletest.AttrDouble= arrDouble
806 b= oletest.AttrDouble
807 call printArrayEx( "<br> get: ", "<br>", b)
808 case 202
809 document.write "set: "
810 printArray arrBool :
811 oletest.AttrBool= arrBool
812 b= oletest.AttrBool
813 call printArrayEx( "<br> get: ", "<br>", b)
814 case 203
815 document.write "set: "
816 printArray arrInt2 :
817 oletest.AttrShort= arrInt2
818 b= oletest.AttrShort
819 call printArrayEx( "<br> get: ", "<br>", b)
820 case 204
821 document.write "set: "
822 printArray arrInt
823 oletest.AttrUShort= arrInt
824 b= oletest.AttrUShort
825 call printArrayEx( "<br> get: ", "<br>", b)
826 case 205
827 document.write "set: "
828 printArray arrInt2
829 oletest.AttrLong= arrInt2
830 b= oletest.AttrLong
831 call printArrayEx( "<br> get: ", "<br>", b)
832 case 206
833 document.write "set: "
834 printArray arrInt
835 oletest.AttrULong= arrInt
836 b= oletest.AttrULong
837 call printArrayEx( "<br> get: ", "<br>", b)
838 case 207
839 document.write "set: "
840 printArray arrString
841 oletest.AttrString= arrString
842 b= oletest.AttrString
843 call printArrayEx( "<br> get: ", "<br>", b)
844 case 208
845 document.write "set: "
846 printArray arrChar
847 oletest.AttrChar= arrChar
848 b= oletest.AttrChar
849 call printArrayEx( "<br> get: ", "<br>", b)
850 case 209
851 document.write "set: "
852 printArray arrAny
853 oletest.AttrAny= arrAny
854 b= oletest.AttrAny
855 call printArrayEx( "<br> get: ", "<br>", b)
857 case 210
858 document.write "set: <br>"
859 printArray2 arrDim2Int :
860 oletest.AttrSequence= arrDim2Int
861 ret= oletest.AttrSequence
862 document.write "get: "
863 for each val in ret
864 document.write "<br> array: "
865 for each val2 in val
866 document.write val2
867 next
868 next
870 // out params
871 case 300
872 oletest.testout_methodByte( outValue )
873 alert("byte: " & outValue.Get() )
876 end select
877 end sub
878 sub printArray( arr)
879 document.write "array: "
880 For Each val In arr
881 document.write CStr(val) & " "
882 Next
883 end sub
885 // print a 2 dimensional Array
887 sub printArray2( arr)
888 elements1= UBound( arr, 1) - LBound( arr, 1) +1
889 elements2= UBound( arr, 2) - LBound( arr, 2) +1
891 For i=0 To elements1 -1
892 document.write( "array " & CStr( i) & ": " )
893 For j=0 To elements2 -1
894 document.write CStr( arr(i,j))
895 Next
896 document.write( "<br>")
897 Next
898 end sub
900 sub printArrayEx( pre, post, array)
901 document.write pre
902 printArray array
903 document.write post
904 end sub
905 </script>
907 <div id=out> </div>
909 <!-- Insert HTML here -->
911 <h2> JScript with _GetValueObject </h2>
912 Tests Array/Sequence conversion.<br>
913 All methods receive a Sequence as Parameter. The element type of the Sequence is written on the buttons.
914 <br>
915 <button onclick='callOleTest( 1)'>byte</Button>
916 <button onclick='callOleTest( 2)'>double</Button>
917 <button onclick='callOleTest( 3)'>boolean</Button>
918 <button onclick='callOleTest( 4)'>short</Button>
919 <button onclick='callOleTest( 5)'>unsigned short</Button>
920 <button onclick='callOleTest( 6)'>long</Button>
921 <button onclick='callOleTest( 7)'>unsigned long</Button>
922 <button onclick='callOleTest( 8)'>char</Button>
923 <button onclick='callOleTest( 10)'>any</Button>
924 <button onclick='callOleTest( 11)'>sequence&ltlong&gt </Button>
925 <button onclick='callOleTest( 12)'>sequence&ltsequence&ltlong&gt &gt </Button>
926 <button onclick='callOleTest( 13)'>XInterface</Button>
930 Out Parameter <br>
931 <button onclick='callOleTest( 2000)'>byte </Button>
932 <button onclick='callOleTest( 2001)'>double</Button>
933 <button onclick='callOleTest( 2002)'>boolean</Button>
934 <button onclick='callOleTest( 2003)'>short</Button>
935 <button onclick='callOleTest( 2004)'>unsigned short</Button>
936 <button onclick='callOleTest( 2005)'>long</Button>
937 <button onclick='callOleTest( 2006)'>unsigned long</Button>
938 <button onclick='callOleTest( 2007)'>char</Button>
939 <button onclick='callOleTest( 2008)'>string</Button>
940 <button onclick='callOleTest( 2009)'>any</Button>
941 <button onclick='callOleTest( 2010)'>sequence&ltlong&gt </Button>
942 <button onclick='callOleTest( 2011)'>sequence&ltsequence&ltlong&gt &gt </Button>
943 <button onclick='callOleTest( 2012)'>2 out </Button>
944 <button onclick='callOleTest( 2013)'>3 out </Button>
945 <button onclick='callOleTest( 2014)'>1 in & 1 out </Button>
946 <button onclick='callOleTest( 2015)'>XInterface </Button>
949 In Out Parameter <br>
950 <button onclick='callOleTest( 500)'>byte </Button>
951 <button onclick='callOleTest( 501)'>double</Button>
952 <button onclick='callOleTest( 502)'>boolean</Button>
953 <button onclick='callOleTest( 503)'>short</Button>
954 <button onclick='callOleTest( 504)'>unsigned short</Button>
955 <button onclick='callOleTest( 505)'>long</Button>
956 <button onclick='callOleTest( 506)'>unsigned long</Button>
957 <button onclick='callOleTest( 507)'>char</Button>
958 <button onclick='callOleTest( 508)'>string</Button>
959 <button onclick='callOleTest( 509)'>any</Button>
960 <button onclick='callOleTest( 510)'>sequence&ltlong&gt </Button>
961 <button onclick='callOleTest( 511)'>sequence&ltsequence&ltlong&gt &gt </Button>
962 <button onclick='callOleTest( 512)'>XInterface </Button>
965 Tests Array/Sequence conversion with Attributes. All params are of type Sequence and
966 the element type of the Sequence is written on the buttons. <br>
967 <button onclick='callOleTest( 200)'>byte </Button>
968 <button onclick='callOleTest( 201)'>double</Button>
969 <button onclick='callOleTest( 202)'>boolean</Button>
970 <button onclick='callOleTest( 203)'>short</Button>
971 <button onclick='callOleTest( 204)'>unsigned short</Button>
972 <button onclick='callOleTest( 205)'>long</Button>
973 <button onclick='callOleTest( 206)'>unsigned long</Button>
974 <button onclick='callOleTest( 207)'>char</Button>
975 <button onclick='callOleTest( 208)'>string</Button>
976 <button onclick='callOleTest( 209)'>any</Button>
977 <button onclick='callOleTest( 210)'>sequence&ltlong&gt </Button>
978 <button onclick='callOleTest( 211)'>sequence&ltsequence&ltlong&gt &gt </Button>
979 <button onclick='callOleTest( 212)'>XInterface </Button>
982 <!--
983 Test of Any parameter in a method. Any contains:<br>
984 <button onclick='callOleTest( 1000)'>integer </Button>
985 <button onclick='callOleTest( 1001)'>double </Button>
986 <button onclick='callOleTest( 1002)'>string</Button>
987 <button onclick='callOleTest( 1003)'>array</Button>
988 <button onclick='callOleTest( 1004)'>object</Button>
990 Test of Any parameter in a property. Any contains:<br>
991 <button onclick='callOleTest( 1010)'>integer </Button>
992 <button onclick='callOleTest( 1011)'>double </Button>
993 <button onclick='callOleTest( 1012)'>string</Button>
994 <button onclick='callOleTest( 1013)'>array</Button>
995 <button onclick='callOleTest( 1014)'>object</Button>
1000 <h2> Visual Basic Tests </h2>
1001 Test array /Sequence conversion and return value<br>
1002 Template: <b> Sequence &lt type &gt method( Sequence&lt type &gt ) </b>
1003 <p>
1006 <button onclick='callBasic(0)'>byte</button>
1007 <!--
1008 <button onclick='callBasic(1)'>double</button>
1009 <button onclick='callBasic(2)'>boolean</button>
1010 <button onclick='callBasic(3)'>short</button>
1011 <button onclick='callBasic(4)'>u short</button>
1012 <button onclick='callBasic(5)'>long</button>
1013 <button onclick='callBasic(6)'>u long</button>
1014 <button onclick='callBasic(7)'>string</button>
1015 <button onclick='callBasic(8)'>char</button>
1016 <button onclick='callBasic(9)'>any</button> <br>
1017 <button onclick='callBasic(10)'>Seq &lt int &gt</button>
1022 Out parameter <br>
1023 Template: <b> void method( Sequence &lt type &gt ) </b> <br>
1024 <button onclick='callBasic(300)'>byte</button>
1025 <!--
1026 <button onclick='callBasic(101)'>double</button>
1027 <button onclick='callBasic(102)'>boolean</button>
1028 <button onclick='callBasic(103)'>short</button>
1029 <button onclick='callBasic(104)'>u short</button>
1030 <button onclick='callBasic(105)'>long</button>
1031 <button onclick='callBasic(106)'>u long</button>
1032 <button onclick='callBasic(107)'>string</button>
1033 <button onclick='callBasic(108)'>char</button>
1034 <button onclick='callBasic(109)'>any</button> <br>
1037 <!--
1038 Tests Array/Sequence conversion with <b>Attributes</b>. All params are of type Sequence and
1039 the element type of the Sequence is written on the buttons. <br>
1040 <button onclick='callBasic( 200)'>byte </Button>
1041 <button onclick='callBasic( 201)'>double</Button>
1042 <button onclick='callBasic( 202)'>boolean</Button>
1043 <button onclick='callBasic( 203)'>short</Button>
1044 <button onclick='callBasic( 204)'>unsigned short</Button>
1045 <button onclick='callBasic( 205)'>long</Button>
1046 <button onclick='callBasic( 206)'>unsigned long</Button>
1047 <button onclick='callBasic( 207)'>string</Button>
1048 <button onclick='callBasic( 208)'>char</Button>
1049 <button onclick='callBasic( 209)'>any</Button>
1050 <button onclick='callBasic( 210)'>sequence&ltlong&gt </Button>