How to call VBScript function fro applet?

Posted on 2000-04-07
Medium Priority
Last Modified: 2012-05-04
I know how to call javascript. Now please tell me how to do the same with VBScript!
Question by:abb1
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4

Expert Comment

ID: 2692804
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:

<title>vbscript from javascript</title>

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

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

      foo(); // call it...



Author Comment

ID: 2694128
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)!

Expert Comment

ID: 2694384
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 :) )

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..
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 2695584
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?

Expert Comment

ID: 2695692
So r u going to give me points?

Author Comment

ID: 2695971
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!).

Accepted Solution

azawawi earned 400 total points
ID: 2696044
What im saying here is direct Applet-VBScript communication is NOT possible,  ( I have searched the whole MSDN but to no avail). So if Microsoft doesnt want Java in its way, how do u expect that it will support such communication. However, notice that it supports it the other way around. So that VBScript CAN control applets but not vice-versa. It has also to do with the Java Specification not supporting this feature - communication with external scripting...

Indirect communication can be done however. and i have shown you how it can be done. Ofcourse, it is complex (MS doesnt want it to be simple). You can however generalize their solution and make it better, but a bad implementation is a bad implementation.

Regarding the points, im very sorry for being blunt in my last comment. It is your choice to give me points or not. I just wanted the Master-Level T-Shirt badly :)

Author Comment

ID: 2696218
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.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Suggested Courses
Course of the Month14 days, 5 hours left to enroll

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question