Link to home
Start Free TrialLog in
Avatar of abb1
abb1

asked on

How to call VBScript function fro applet?

I know how to call javascript. Now please tell me how to do the same with VBScript!
Avatar of azawawi
azawawi

Wrap it up in a JavaScript function as the following suggest. You should be able to run the VBScript using the wrapper JavaScript function in an applet :)

Plus, try calling the VBScript directly... because it seems like IE doesnt differentiate between functions in VB/JavaScript (ie. they all can be called). For more information see http://www.asptoday.com/articles/19990420.htm

Working Example:

<html>
<head>
<title>vbscript from javascript</title>
</head>
<body>

<script language="vbscript">
      sub vb_foo()
            MsgBox "Hi from vb_foo()"
      end sub
</script>

<script language="javascript">
      // wrap it up with a JavaScript wrapper function
      // You should be now to run any VBScript...
      function foo() {
            vb_foo();
      }

      foo(); // call it...
</script>

</body>

</html>
Avatar of abb1

ASKER

Hmmm, _Such_ answer I could suggest not more then for 3 seconds!
I'd like to know how to call VBScript _directly_ from java applet!
Is there something like JSObject?
some VBObject, or the like?
And if yes, please provide me with an example (both HTML and java pieces)!
No, i dont think a similar object exists... (otherwise it should be in the documentation)

However you could simulate that by firing events to scripts from an applet.

The twist is fire a message (request to activate function) to a script (which handles it and triggers the appropriate function. (like an OS :) )

See:
HOWTO: Fire 'Events' from a Java Applet on a Web Page @ http://support.microsoft.com/support/kb/articles/Q178/9/94.ASP

Hope this helps...
Please keep me posted on this..
Avatar of abb1

ASKER

I've read that article... That is very complicated method. All I need is to call some function which could make some actions on the page. But that article describes vice versa action - the script function periodicaly reviews an applet and checks some value inside it. This is completely unusefull for me.
If there is no JSObject analog in VBScript then I'll simply use JavaScript
to do that. (At least I'll try...)
So, can I close this question?
So r u going to give me points?
:)
Avatar of abb1

ASKER

Well if you can say what for!

At present I've solved that problem by using JavaScript: my applet calls Javascript function that does all I need. The only disadvantage is that my page must contain both VBScript and Javascript. But my question was "How to call VBScript function from applet _directly_". And you've told me that it is undocumented. In other words, you never told that it is impossible but only that you don't know how.

Well, if you can say now what those points are for - take them (I have them quite enough!).
 
ASKER CERTIFIED SOLUTION
Avatar of azawawi
azawawi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of abb1

ASKER

In other words, all your answer is "No, this is impossible!"? Because your "indirect communication" is well-known and obvious. And it has no relation to VBScript at all.