Using the menu system with an HTA and VBScript - [SOLVED]

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
Ginolard
Advanced
Advanced
Posts: 24
Joined: Wed Nov 09, 2005 11:13 am

Using the menu system with an HTA and VBScript - [SOLVED]

Post by Ginolard »

Hi all,

I've written an HTA that emulates a tabbed browsing interface. What I'd like to do, if possible, is replace that with this wonderful menu system. So, what I need to know is how to call my VBscript Subs/Functions from the menu items. I've seen one answer that says the menu item should just say aI("text=doFunction;url=javascript:myfunction();");

However, all this does is open an IE page that tries to go to the page javascript:myfunction(), it doesn't run the Vbscript code in the HTA.

For example, I have one function that reboots a remote machine (let's called it RemReboot). What do I need to specify in the menu_data.js file to make it call the RemReboot Vbscript function in the HTA?
Ginolard
Advanced
Advanced
Posts: 24
Joined: Wed Nov 09, 2005 11:13 am

Post by Ginolard »

never mind, I found it in another post. For any others that want to know you do this

aI("text=Vbscript Menu Test;clickfunction=TestMsg();")

The TestMsg Sub/Function needs to be in your HTA
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

Thanks so much for posting the solution. We appreciate it. :)

Ruth
Ginolard
Advanced
Advanced
Posts: 24
Joined: Wed Nov 09, 2005 11:13 am

Post by Ginolard »

No problem. Now all I need to find out is how to make entries in the menu dynamic.

My HTA is used to get info on remote PCs and one of the things it retrieves is a list of shares available on the machine. Currently those shares are added to an HTML listbox from which the user selects which share to browse/manage. It would be nice to have a menu entry that is dynamically created with the various shares. I think that might be a little beyond my very limited JSscript skills though ;)
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Well, it is way beyond mine :lol: But, I know there is a php menu which retrieves things from a data base, and there is also a asp, and something about mysql, so I'm sure it's possible.

Ruth
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

Hi,

There is a menu editing API at http://milonic.com/mm_menueditapi.js that will allow you to dynamically change menus and menu items.

-- Andy
Ginolard
Advanced
Advanced
Posts: 24
Joined: Wed Nov 09, 2005 11:13 am

Post by Ginolard »

Excuse my newbie ignorance but how do you incoporate this into a simple HTA? For example, here's a test one I have.

<HTA:APPLICATION
SCROLL="yes"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal">
</head>


<Body>
<script type="text/javascript" src="milonic_src.js"></script>
<div class=milonic><a href="http://milonic.com/">JavaScript Menu, DHTML Menu Powered By Milonic</a></div>
<script type="text/javascript">
if(ns4)_d.write("<scr"+"ipt type=text/javascript src=mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt type=text/javascript src=mmenudom.js><\/scr"+"ipt>"); </script>
<script type="text/javascript" src="menu_data2.js"></script>

</body>

<script language="VBScript">

Sub HELLOWORLD
MsgBox "HELLO WORLD"
End Sub
</script>

</html>

Let's say I have another Sub that goes off and gets all the open shares on a machine. How can I have the API add a menu item for each share?

I hope I've explained that correctly.
Post Reply