Google Answers Logo
View Question
 
Q: Invoke JavaScript running in an HTA ( No Answer,   0 Comments )
Question  
Subject: Invoke JavaScript running in an HTA
Category: Computers > Programming
Asked by: n4te-ga
List Price: $15.00
Posted: 23 Sep 2004 00:26 PDT
Expires: 26 Sep 2004 18:22 PDT
Question ID: 405172
I need to get a string from Girder into some Javascript that is
running inside an HTA (HTML Application). You may not need to know
anything about Girder to answer this question. Girder is an automation
app mostly aimed at controlling software in response to events
generated by a USB IR receiver. Website:

http://www.promixis.com/products.php?section=girder

Girder allows us to use Lua script. Here is a list of Lua Windows
functions we have available:

http://www.girderplugins.com/files32/LuaWindowsFunctions.pdf

We can use the FindWindow function to get the HWND to the HTA. I do
not know if it is possible to trigger an event in the JavaScript
running inside the HTA from only the HWND.

If we can somehow set the URL of the HTA, we may be able to set it to
"javascript:invokeEvent('payload')" to invoke the JS.

I had another thought to approach this problem. We have access to COM
objects in both Lua and JavaScript. Maybe we can create a simple COM
object that invokes a JS event when a string is passed to it from Lua.
I know we can write a string to a COM object from Lua and then read
that value from the same COM object in JS. However, polling the COM
object in JS is not acceptable.

I do not have VB, but I would accept a COM object in Microsoft VC++ 6.0.

Clarification of Question by n4te-ga on 25 Sep 2004 00:12 PDT
No responses? :(

I've been reading and it seems that COM has an event mechanism. So
what I need is a COM object whose class factory always returns the
same instance. I can instantiate the object in Javascript and attach
an event. Then in Lua instantiate the object and trigger the event.

I would prefer to be able to compile it with MS VC6. If not, you can
write it in whatever language and give to to me compiled.

Thanks! This is my first Answers question. :)

Clarification of Question by n4te-ga on 25 Sep 2004 01:11 PDT
I've done so much research, I've reduced the question price by $10. :(

http://homepage.eircom.net/~codexpert/sink/
Example COM object (non-ATL) that shows how COM events work.

http://tinyurl.com/685m3
Tells how to assign a JavaScript function to a COM object property and
then invoke that function from within the object.

http://www.codeproject.com/com/jscalls.asp
Shows how to invoke JavaScript within a browser using C++.

I used the example COM object (non-ATL) and it compiled. I
instantiated it with JS but I can't sink the event. I used this code:

<script>
window.onload = function () {
	obj.NeedEvent();
}
</script>
<object id="obj" classid="clsid:C2381F81-6F59-4A40-A761-E306B3A48380"></object>
<script for="obj" event="OnNeededEvent()">
	alert( "Event fired!" );
</script>

The event is never fired.

Clarification of Question by n4te-ga on 26 Sep 2004 16:45 PDT
Maybe it has something to do with this?

http://support.microsoft.com/default.aspx?scid=kb;en-us;183023

Hello? Is anyone reading my question? Or is it that the researchers
don't have a lot of COM experience? Maybe my question turn-around
expectations were wrong? Or maybe I have the wrong idea entirely and
Answers isn't a good place to post programming questions?

Clarification of Question by n4te-ga on 26 Sep 2004 18:22 PDT
I figured it out. What did it was the previous link I posted, plus this one:

http://tinyurl.com/5hsk6

Thanks for all your help though. Maybe I can have my 50 cents back?
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy