Mixing languages in .ws files - order matters 
Author Message
 Mixing languages in .ws files - order matters

<job>
<comment>
  Illustrates that order matters when mixing languages
  in a .ws file.

  With the VBScript block _after_ the JScript block,
  an "Object expected" error occurs on the line "vbsub();".

  In a comparable VBScript call into a JScript function
  in a JScript block physically located after the VBScript
  block, the error is "Type mismatch.

  In both cases, the error message certainly isn't helpful.

  If you reverse the order of the script blocks in this
  example, the problem goes away.
</comment>

<script language='JScript'>
  vbsub();
</script>

<script language='VBScript'>
  public sub vbsub()
    WScript.echo("hello")
  end sub
</script>

</job>

--
Michael Harris



Wed, 06 Feb 2002 03:00:00 GMT  
 Mixing languages in .ws files - order matters
It isn't just an issue of mixing languages.  You get the same problem even
if both script blocks are the same language...

So the behavior seems to be that when the </script> is encountered, any
accumulated "in-line" (not in a procedure) code is executed _before_ any
remaining <script> blocks are processed.

--
Michael Harris


| <job>
| <comment>
|   Illustrates that order matters when mixing languages
|   in a .ws file.
|
|   With the VBScript block _after_ the JScript block,
|   an "Object expected" error occurs on the line "vbsub();".
|
|   In a comparable VBScript call into a JScript function
|   in a JScript block physically located after the VBScript
|   block, the error is "Type mismatch.
|
|   In both cases, the error message certainly isn't helpful.
|
|   If you reverse the order of the script blocks in this
|   example, the problem goes away.
| </comment>
|
| <script language='JScript'>
|   vbsub();
| </script>
|
| <script language='VBScript'>
|   public sub vbsub()
|     WScript.echo("hello")
|   end sub
| </script>
|
| </job>
|
|
| --
| Michael Harris
|
|
|
|
|



Fri, 08 Feb 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Mixing languagess in .ws file - order matters

2. Mixing Script Languages

3. Mixing languages within script blocks

4. Personal WS vs Peer WS

5. how to include a script located in a .ws file in another .ws file?

6. dictionary objects: key in order = sequential out order?

7. not recognising .ws files

8. Cannot run .ws files

9. .ws files not run

10. System not recognizing .ws files

11. cannot run .ws file in WSH2.0

12. Encoding WS files

 

 
Powered by phpBB® Forum Software