Sign in to follow this  
Followers 0
RDSchaefer

menu style launcher

1 post in this topic

I like Windows 7 except for one MAJOR thing. It forces you to use the mouse for almost everything. So I wrote this little program to display an 98ish style menu. It's not perfect so I'd really like some suggestions on how to make it better. For example, I don't know how to keep the parent menu visible when popping up a sub-menu, or how to make the first item active.

;*===================================================================*
;* MyMenu -- Start Menu replacement
;*===================================================================*
;* Created  07/17/09  Ralph D. Schaefer
;* Updated  mm/dd/yy
;*===================================================================*
Const $VERSION = " v0.0.1"


Const $INI = @ScriptDir & "\MyMenu.INI"


Global $g_lDepth = 0


#include <array.au3>
#include <GuiMenu.au3>


Func Quit()
    Exit
EndFunc


Func Exec($sProgram)
    Local $iNdx
    
    Local $sPath = ""


    $iNdx = StringInStr($sProgram, "\", 0, -1)
    If $iNdx <> 0 then
        $sPath = StringLeft($sProgram, $iNdx - 1)
    EndIf

    ShellExecute($sProgram, "", $sPath)
EndFunc


Func CreateMenu($sMenu)
   Local $hWin
   Local $hMenu

   Local $iMenu

   Local $aMenu


    $g_lDepth += 1

    $aMenu = IniReadSection($INI, $sMenu)

    $hWin = GUICreate($sMenu, 10, 10, 0, @DesktopHeight)
        $hMenu = _GUICtrlMenu_CreatePopup(3)
        For $iMenu = $aMenu[0][0] to 1 Step -1
            _GUICtrlMenu_InsertMenuItem($hMenu, 0, $aMenu[$iMenu][0], $iMenu)
        Next

    GUISetState(@SW_SHOW)

    While 1
        $iMenu = _GUICtrlMenu_TrackPopupMenu($hMenu, $hWin, $g_lDepth * 10, @DesktopHeight - ($g_lDepth * 10), 1, 0, 2, 0)
        If $iMenu  = "" then
            _GUICtrlMenu_DestroyMenu($hMenu)
            $g_lDepth -= 1
            Return
        EndIf

        If StringRight($aMenu[$iMenu][0], 1) = "." then
            CreateMenu($aMenu[$iMenu][1])
        Else
            _GUICtrlMenu_DestroyMenu($hMenu)
            Exec($aMenu[$iMenu][1])
            Exit
        EndIf

    WEnd

    $g_lDepth =- 1
EndFunc


;*===================================================================*
Opt("MustDeclareVars", 1)

HotKeySet("^{F12}", "Quit")


If Not FileExists($INI) then
    MsgBox(16, $VERSION, "Configuration file 'MyMenu.INI' not found")
    Exit
EndIf

CreateMenu("MyMenu")
Exit

Here is part of the INI file

[MyMenu]
Apps...=Apps
Fun...=Fun
Graphics...=Graphics
Internet...=Internet
Mine...=Mine
NCC...=NCC
Programming...=Programming
Security...=Security
Utils...=Utils
Video-Audio...=Video-Audio
=
ConTEXT="E:\Program Files\ConTEXT\ConTEXT.exe"
Salamander="E:\Program Files\Altap Salamander\SALAMAND.exe"


[Apps]
Tiny Office...=TinyOffice
YBook...=YBook
=
1stPage="E:\Program Files\1st Page 2000\1stPage.exe"
AbcLit="E:\Program Files\abclit\abclit.exe"
Booky="E:\Program Files\Booky\Booky.exe"
DosBox="E:\Program Files\DOSBox\dosbox.exe"
ECM="E:\Program Files\ECM\ecm.exe"
ExamDiff="E:\Program Files\ExamDiff\ExamDiff.exe"
FBZip="E:\Program Files\FBZip\FBZip.exe"
FM3="E:\Program Files\FM3\FM3.EXE"
Fontmagic="E:\Program Files\FontMagic\FontMagic.exe"
NotepadSX="E:\Program Files\NotepadSX\NotepadSX.exe"
PDF Reader="E:\Program Files\Foxit\Foxit Reader.exe"
PFE32="E:\Program Files\PFE\PFE32.EXE"
PPF="E:\Program Files\PPF\Ppf.exe"
PTE="E:\Program Files\PTE\pte.exe"
SPF Pro="E:\Program Files\SPFPRO\Spfpro.exe"
Treepad="E:\Program Files\Treepad\Treepad.exe"
Write="E:\Program Files\Write\WRITE.EXE"
X-Fonter="E:\Program Files\X-Fonter\X-Fonter.exe"


[TinyOffice]
100 Zipper="E:\Program Files\TinyOffice\100zipper\100ziper.exe"
CSVed="E:\Program Files\TinyOffice\CSVed\CSVed.exe"
DsCrypt="E:\Program Files\TinyOffice\dscrypt\dscrypt.exe"
DsDel="E:\Program Files\TinyOffice\dsdel\dsdel.exe"
Eve="E:\Program Files\TinyOffice\Eve\eve.exe"
FTP Wanderer="E:\Program Files\TinyOffice\FTPWanderer\FTPWanderer.exe"
KPad="E:\Program Files\TinyOffice\kPad\kPad.exe"
MemPad="E:\Program Files\TinyOffice\mempad\Mempad.exe"
nPOPuk="E:\Program Files\TinyOffice\NPopUK\nPOPuk.exe"
PDF Producer="E:\Program Files\TinyOffice\PDFproducer\PDFproducer.exe"
PixaMSN="E:\Program Files\TinyOffice\PixaMSN\PixaMSN.exe"
Spread32="E:\Program Files\TinyOffice\Spread32\Spread32.exe"
TednPad="E:\Program Files\TinyOffice\TedNotepad\TedNPad.exe"

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0