Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Create a menu

Reply
 
Old 08-27-2008   #1 (permalink)
CBO


 
 

Create a menu

Hi all,

I would like to create a VBScript that when launched will show me a
menu, allowing me to run exe files from it. I.e. I run the script
which gives me a list of executables that I add point to within the
VBScript. Once I click a shortcut on the menu it launches the
executable.

Is this possible and if so how would I go about doing it.

Any help in this matter would be highly appreciated.

Thank you

My System SpecsSystem Spec
Old 08-27-2008   #2 (permalink)
mayayana


 
 

Re: Create a menu

You can write an HTA, which is a webpage
running in IE. In that you can create buttons
to call script. Do you know HTML at all?

You can also use IEMENU.OCX to create
a stand-alone system menu via the object
Internet.PopupMenu. you need iemenu.ocx
installed, though, and I'm not sure it's available
on XP. You might have to find a copy in
Win9x CABs.
Quote:

>
> I would like to create a VBScript that when launched will show me a
> menu, allowing me to run exe files from it. I.e. I run the script
> which gives me a list of executables that I add point to within the
> VBScript. Once I click a shortcut on the menu it launches the
> executable.
>
> Is this possible and if so how would I go about doing it.
>
> Any help in this matter would be highly appreciated.
>
> Thank you

My System SpecsSystem Spec
Old 08-27-2008   #3 (permalink)
mayayana


 
 

Re: Create a menu

Quote:
Quote:

> > You can write an HTA, which is a webpage
> > running in IE. ...
>
> A *.HTA is hosted by mshta.exe, not IE (iexplore.exe).
>
Yes, it's loaded by mshta.exe, but it's really just
IE with no security restrictions. If you look at the
window in Spy++ you'll see the top level window
is class "HTML Application Host Window Class", but
just under that is an "Internet Explorer_Server" class
window, which is the IE browser window. Likewise,
if I use a WebBrowser control in VB or .Net it's
not technically Internet Explorer, since there's no IE
"chrome", but in practice IE is exactly what it is.
An "Internet Explorer_Server" class window is an IE
browser.


My System SpecsSystem Spec
Old 08-27-2008   #4 (permalink)
mayayana


 
 

Re: Create a menu

Quote:
Quote:

> > A *.HTA is hosted by mshta.exe, not IE (iexplore.exe).
> >
>
> Yes, it's loaded by mshta.exe, but it's really just
> IE with no security restrictions. If you look at the
> window in Spy++ you'll see the top level window
> is class "HTML Application Host Window Class", but
> just under that is an "Internet Explorer_Server" class
> window, which is the IE browser window. Likewise,
> if I use a WebBrowser control in VB or .Net it's
> not technically Internet Explorer, since there's no IE
> "chrome", but in practice IE is exactly what it is.
> An "Internet Explorer_Server" class window is an IE
> browser.
>
I guess I should clarify, more to the point, that the display
and behavior are identical to IE, since the actual browser
window *is* IE. The DOM available, the CSS support
(or lack of it) will be in accord with the version of IE on the
PC where the HTA runs. (I generally work with IE5 and thus
have HTAs written for IE5. And just as with HTML files, I
need to also test my HTAs in IE6 if I distribute them because
HTML/CSS behavior between the two IE versions is
inconsistent.)



My System SpecsSystem Spec
Old 09-02-2008   #5 (permalink)
Hal


 
 

Re: Create a menu



"James Whitlow" wrote:

<snip>
Quote:

> As others have already mentioned, you will need to use some form of
> Internet Explorer unless you want to add 3rd party utilities. I created a
> small sample to get you started. See if the script below is inline with what
> you are wanting to do. It is quite basic, so don't expect too much.
>
<snip>

James,

I ran your script under IE7 and as is, it worked as expected.

Very interisting piece of work you did, I must say.

Regards,
My System SpecsSystem Spec
Old 09-02-2008   #6 (permalink)
Harvey Colwell


 
 

Re: Create a menu

"James Whitlow" <jwhitlow.60372693@xxxxxx> wrote in message
news:uzgWvARCJHA.2060@xxxxxx
Quote:

> "CBO" <christopher_board@xxxxxx> wrote in message
> news:b20ed7f9-1377-4169-bfee-35b4136596b6@xxxxxx
Quote:

>> Hi all,
>>
>> I would like to create a VBScript that when launched will show me a
>> menu, allowing me to run exe files from it. I.e. I run the script
>> which gives me a list of executables that I add point to within the
>> VBScript. Once I click a shortcut on the menu it launches the
>> executable.
>>
>> Is this possible and if so how would I go about doing it.
>>
>> Any help in this matter would be highly appreciated.

I have a non-IE menu that I've used in countless scripts. So many so, that I
created a template file for the script.


[--- Begin: E:\Temp\Menu Template.vbs ---]

001. ' Windows Script Host - VBScript
002. '-----------------------------------------------------------------
003. ' Name: Menu Template Script
004. ' By: Harvey Colwell
005. ' CopyRight: (c) Jul 2000, All Rights Reserved!
006. '
007. '*****************************************************************
008. Option Explicit
009.
010. Dim oFS, oWS, oWN
011.
012. Set oWS = WScript.CreateObject("WScript.Shell")
013. Set oWN = WScript.CreateObject("WScript.Network")
014. Set oFS = WScript.CreateObject("Scripting.FileSystemObject")
015.
016. '----------
017. ' Script SetUp
018. '----------
019.
020. '----------
021. ' Main
022. '----------
023. Select Case InputBox ( _
024. "Enter menu item number then Click Ok. . ." & vbCrlf &
vbCrlf & _
025. " [1] Item 1" & vbCrlf & _
026. " [2] Item 2" & vbCrlf & _
027. " [3] Item 3" & vbCrlf & _
028. " [4] Item 4", _
029. "Main Menu")
030.
031. Case "1"
032. Call sub1()
033. Case "2"
034. Call sub2()
035. Case "3"
036. Call sub3()
037. Case "4"
038. Call sub4()
039. Case Else
040. WScript.Echo "You entered an invalid menu choice!"
041.
042. End Select
043.
044. '----------
045. ' Clean Up
046. '----------
047.
048. Call CleanUp
049.
050. '-----------------------------------------------------------------
051. ' Subroutines
052. '*****************************************************************
053.
054. '---------------------
055. Sub CleanUp()
056. Set oWS = Nothing
057. Set oWN = Nothing
058. Set oFS = Nothing
059. WScript.Quit
060. End Sub
061.
062. '---------------------
063. Sub sub1()
064. WScript.Echo "You selected Menu Item 1"
065. End Sub
066.
067. '---------------------
068. Sub sub2()
069. WScript.Echo "You selected Menu Item 2"
070. End Sub
071.
072. '---------------------
073. Sub sub3()
074. WScript.Echo "You selected Menu Item 3"
075. End Sub
076.
077. '---------------------
078. Sub sub4()
079. WScript.Echo "You selected Menu Item 4"
080. End Sub
081.
082. '-----------------------------------------------------------------
083. ' Functions
084. '*****************************************************************
085. '---------------------
086.
087.
088.
089. '*****************************************************************

[--- End: E:\Temp\Menu Template.vbs ---]


My System SpecsSystem Spec
Old 09-02-2008   #7 (permalink)
James Whitlow


 
 

Re: Create a menu

"Hal" <Hal@xxxxxx> wrote in message
news:367542D5-D508-4B3C-B40A-338C885F4F04@xxxxxx
Quote:

>
>
> "James Whitlow" wrote:
>
> <snip>
Quote:

>> As others have already mentioned, you will need to use some form of
>> Internet Explorer unless you want to add 3rd party utilities. I created a
>> small sample to get you started. See if the script below is inline with
>> what
>> you are wanting to do. It is quite basic, so don't expect too much.
>>
> <snip>
>
> James,
>
> I ran your script under IE7 and as is, it worked as expected.
>
> Very interisting piece of work you did, I must say.
Thanks for the feedback!

I was a little worried about it working under IE7. My IE7 experience is
quit limited. I worked with it briefly under Windows Vista Premium SP0 and
had a problem with the 'OnQuit' event firing immediately upon instantiation
of the IE object. What version of Windows are you using?


My System SpecsSystem Spec
Old 09-08-2008   #8 (permalink)
mr_unreliable


 
 

Re: Create a menu

CBO wrote:
Quote:

> I would like to create a VBScript that when launched will show me a
> menu,
hi CBO,

For this sort of thing, I would recommend a (dhtml) "popup object".

If interested, take a look at the msdn page entitled: "Four
Exciting Uses of the Popup Object", found here:

http://samples.msdn.microsoft.com/wo...usingpopup.htm

There you will find several (er, well, four) context-type
menus, created by using the popup object. Note: you can
find the source code by looking at the page source.

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but, no guarantee
the answers will be applicable to the questions)


p.s., better get-and-save that page quick, before microsoft
reshuffles their url's yet again. And, don't get too
"excited" over the popup object code...
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
.vbs Script To Create Start / Programs Menu Item?? VB Script
How to create a Menu Strip Application .NET General
Create shortcut directly to Start Menu... Vista General
BUG: Can't create file on root from context menu Vista General
Create new folder option in context menu missing Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46