Solved

How to call VBScript function fro applet?

Posted on 2000-04-07
8
616 Views
Last Modified: 2012-05-04
I know how to call javascript. Now please tell me how to do the same with VBScript!
0
Comment
Question by:abb1
  • 4
  • 4
8 Comments
 
LVL 2

Expert Comment

by:azawawi
Comment Utility
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>
0
 
LVL 3

Author Comment

by:abb1
Comment Utility
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)!
0
 
LVL 2

Expert Comment

by:azawawi
Comment Utility
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..
0
 
LVL 3

Author Comment

by:abb1
Comment Utility
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?
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 2

Expert Comment

by:azawawi
Comment Utility
So r u going to give me points?
:)
0
 
LVL 3

Author Comment

by:abb1
Comment Utility
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!).
 
0
 
LVL 2

Accepted Solution

by:
azawawi earned 100 total points
Comment Utility
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 :)
0
 
LVL 3

Author Comment

by:abb1
Comment Utility
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.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Increment alphanumeric sequence 6 78
mapBully challenge 6 86
mapAB Challlenge 35 83
for i loop in grovy 1 32
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now