Jump to content

Help with menu, want to make it fancy


bb01
 Share

Recommended Posts

I've got a little right click menu that i've created with help from guys from here, that works perfectly.. however doesnt have any fancy graphics.. and was trying to work out, if its possible to make this menu look fancy... ??

heres the code for the menu:-

#RequireAdmin
#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=1.ico
#AutoIt3Wrapper_outfile=PSIrightclick.exe
#AutoIt3Wrapper_Compression=4
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <array.au3>
#NoTrayIcon
Opt("TrayMenuMode", BitOR(1, 2)) ;Combined style 1 and 2 using BitOr
;Check if the file exists
If Not FileExists(@ScriptDir & "\links.ini") Then
    MsgBox(4096, "", "Error occurred, Make sure the links.ini is in the same folder as PSIrightclick.exe")
    Exit
EndIf
;read sections into 2D arrays.
$aProg = IniReadSection(@ScriptDir & "\links.ini", "Prog")
$aUserProg = IniReadSection(@ScriptDir & "\links.ini", "UserProg")
$aOfficeProg = IniReadSection(@ScriptDir & "\links.ini", "Office")
$aGhostProg = IniReadSection(@ScriptDir & "\links.ini", "Ghost")
$aPSIProg = IniReadSection(@ScriptDir & "\links.ini", "PSI")
$aWeb = IniReadSection(@ScriptDir & "\links.ini", "Web")
$aUserWeb = IniReadSection(@ScriptDir & "\links.ini", "UserWeb")
$aDrive = IniReadSection(@ScriptDir & "\links.ini", "Drive")
;uncomment the next lines to see the resulting arrays
;~ _ArrayDisplay($aProg,"$aProg")
;~ _ArrayDisplay($aUserProg,"$aUserProg")
;~ _ArrayDisplay($aWeb,"$aWeb")
;~ _ArrayDisplay($aUserWeb,"$aUserWeb")
;~ _ArrayDisplay($aDrive,"$aDrive")
;create items for entries in the ini
If IsArray($aProg) Then
    $Otheritem = TrayCreateMenu("Programs")
    For $i = 1 To $aProg[0][0]
        $aProg[$i][0] = TrayCreateItem($aProg[$i][0], $Otheritem) ;the name of the program is replaced by the ID of the control. The link stays in the array.
    Next
EndIf
If IsArray($aProg) Then
    $Otheritem3 = TrayCreateMenu("Office")
    For $i = 1 To $aOfficeProg[0][0]
        $aOfficeProg[$i][0] = TrayCreateItem($aOfficeProg[$i][0], $Otheritem3) ;the name of the program is replaced by the ID of the control. The link stays in the array.
    Next
EndIf
If IsArray($aProg) Then
    $Otheritem4 = TrayCreateMenu("Ghost")
    For $i = 1 To $aGhostProg[0][0]
        $aGhostProg[$i][0] = TrayCreateItem($aGhostProg[$i][0], $Otheritem4) ;the name of the program is replaced by the ID of the control. The link stays in the array.
    Next
EndIf
If IsArray($aUserProg) Then
    $Otheritem2 = TrayCreateMenu("User Programs")
    For $i = 1 To $aUserProg[0][0]
        $aUserProg[$i][0] = TrayCreateItem($aUserProg[$i][0], $Otheritem2)
    Next
EndIf
If IsArray($aPSIProg) Then
    $Otheritem5 = TrayCreateMenu("PSI Programs")
    For $i = 1 To $aPSIProg[0][0]
        $aPSIProg[$i][0] = TrayCreateItem($aPSIProg[$i][0], $Otheritem5) ;the name of the program is replaced by the ID of the control. The link stays in the array.
    Next
EndIf
If IsArray($aProg) Or IsArray($aUserProg) Then TrayCreateItem("") ;only create the dividing line if items are present
If IsArray($aWeb) Then
    $Webitem = TrayCreateMenu("Web Links")
    For $i = 1 To $aWeb[0][0]
        $aWeb[$i][0] = TrayCreateItem($aWeb[$i][0], $Webitem)
    Next
EndIf
If IsArray($aUserWeb) Then
    $Webitem2 = TrayCreateMenu("User Web Links")
    For $i = 1 To $aUserWeb[0][0]
        $aUserWeb[$i][0] = TrayCreateItem($aUserWeb[$i][0], $Webitem2)
    Next
EndIf
If IsArray($aWeb) Or IsArray($aUserWeb) Then TrayCreateItem("")
If IsArray($aDrive) Then
    $Driveitem = TrayCreateMenu("Drives")
    For $i = 1 To $aDrive[0][0]
        $aDrive[$i][0] = TrayCreateItem($aDrive[$i][0], $Driveitem)
    Next
    TrayCreateItem("")
EndIf
$aboutitem = TrayCreateItem("About")
TrayCreateItem("")
$exititem = TrayCreateItem("Exit")
TraySetState()
TraySetClick(16)
;uncomment the next lines to see the modified arrays. Now ith CtrlId's where the names used to be
;~ _ArrayDisplay($aProg,"$aProg")
;~ _ArrayDisplay($aUserProg,"$aUserProg")
;~ _ArrayDisplay($aWeb,"$aWeb")
;~ _ArrayDisplay($aUserWeb,"$aUserWeb")
;~ _ArrayDisplay($aDrive,"$aDrive")
While 1
    $msg = TrayGetMsg()
    Select
        Case $msg = 0
            ContinueLoop
        Case $msg = $aboutitem
            ShellExecute(@ScriptDir & "\graphic.exe")
        Case $msg = $exititem ;you only need one of these
            ExitLoop
        Case Else
            ;check if the control ID is present in an array,
            $iIndex = _ArraySearch($aProg, $msg, 1)
            If Not @error Then
                ShellExecute($aProg[$iIndex][1]) ;if so execute the link that goes with it
                ContinueLoop
            EndIf
            $iIndex = _ArraySearch($aUserProg, $msg, 1)
            If Not @error Then
                ShellExecute($aUserProg[$iIndex][1])
                ContinueLoop
            EndIf
            $iIndex = _ArraySearch($aOfficeProg, $msg, 1)
            If Not @error Then
                ShellExecute($aOfficeProg[$iIndex][1])
                ContinueLoop
            EndIf
            $iIndex = _ArraySearch($aGhostProg, $msg, 1)
            If Not @error Then
                ShellExecute($aGhostProg[$iIndex][1])
                ContinueLoop
            EndIf
            $iIndex = _ArraySearch($aPSIProg, $msg, 1)
            If Not @error Then
                ShellExecute($aPSIProg[$iIndex][1])
                ContinueLoop
            EndIf
            $iIndex = _ArraySearch($aWeb, $msg, 1)
            If Not @error Then
                ShellExecute($aWeb[$iIndex][1])
                ContinueLoop
            EndIf
            $iIndex = _ArraySearch($aUserWeb, $msg, 1)
            If Not @error Then
                ShellExecute($aUserWeb[$iIndex][1])
                ContinueLoop
            EndIf
            $iIndex = _ArraySearch($aDrive, $msg, 1)
            If Not @error Then
                ShellExecute($aDrive[$iIndex][1])
                ContinueLoop
            EndIf
    EndSelect
WEnd
Exit

heres the code from the links.ini (Just in case someone needs the ini to do a test with)

[Prog]
Auto Cleaner = AutoClean.exe
Bat To Exe Converter = Bat_To_Exe_Converter\Bat_To_Exe_Converter.exe
Calc = SpeedCrunch\speedcrunch.exe
Everest = Apps\EVEREST_portable\everest.exe
HWiNFO32 3.56.824 = Apps\HWiNFO32-3.56.824\HWiNFO32
Notepad++ = Notepad+\notepad++.exe
Media Player Classic = MPC\mpc-hc.exe
Unlocker = Apps\UnlockerPortable\UnlockerPortable.exe
Winamp = Winamp\winamp.exe
[UserProg]
Autoplay Media Studio = C:\Program Files\AutoPlay Media Studio 8\AutoPlayDesign.exe
AutoIt Wrapper = AutoIt3Wrapper.exe
CD/DVD Burner = Burner\StarBurn.exe
CDBurnerXP = Apps2\CDBurnerXP\cdbxpp.exe
Clear Memory CMD = clearmem.cmd
CMD Prompt = CMD.exe
Explorer = explorer.exe
Frontpage = C:\Program Files\Microsoft Office\OFFICE11\FRONTPG.EXE
H/D Disk Info = DiskInfo\DiskInfo.exe
Hex Editor = HexEdit\HexEdit.exe
IcoFX = Apps\IcoFXPortable\IcoFXPortable.exe
Image To PDF = Apps2\jpegtopdf_setup\JpegtoPDF,1.exe
Instant Shutdown = shutdown.exe
Keyfinder = Apps2\KeyFinder.exe
Messenger (To Un/Hide - Press CTRL+ALT+SPACE)= Apps2\LAN_Messanger\LANMessenger.exe
PrepSys v0.97 = Apps2\PrepSys v0.97\Prepsys.exe
Reshacker = ResHack\ResHacker.exe
System Spec's = Speccy\Speccy.exe
Tweakui = TweakUI.exe
UniExtract = X-UniExtract_1.6_rev3\X-UniExtract.exe
Winzip = C:\Program Files\WinZip\WINZIP32.EXE
XN Resource Editor = Apps2\XNResourceEditorPortable\XNResourceEditorPortable.exe
[Office]
Excel Password Unlocker = Apps2\Excel Password Unlocker.exe
MS Outlook = C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE
[Ghost]
Norton Ghost AI Builder = Apps2\Ghost\AIBuilder.exe
Norton Ghost = Apps2\Ghost\ghost32.exe
Norton Ghost Boot Wizard = Apps2\Ghost\Ghost Boot Wizard.exe
Norton Ghost Image Explorer = Apps2\Ghost\Ghostexp.exe
Norton Ghost Server = Apps2\Ghost\GhostSrv.exe
Norton Ghost SUM PackageE xplorer = Apps2\Ghost\SUMPackageExplorer.exe
[PSI]
PSI VMware ThinApp = Apps2\PSI VMware ThinApp\Setup Capture.exe
PSI Web Browser = Apps\PSI Browser\PSIBrowser.exe
Remote Desktop = 1.bat
[Web]
Google.com = http://www.google.com
Autoit Help Forums= [url="http://www.autoitscript.com/forum/index.php?act=idx"]http://www.autoitscript.com/forum/index.php?act=idx[/url]

[UserWeb]
Google.com = http://www.google.com
Autoit Help Forums= http://www.autoitscript.com/forum/index.php?act=idx
[Drive]
Map A Network Drive = map.exe
U Drive = U:\
Root Drive = C:\

And yes it uses a script for the about section that shows a simple graphic:-

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt('MustDeclareVars', 1)
Begingraphic1()

Func Begingraphic1()
Local $gui, $background, $pic, $basti_stay, $msg
Local $sFile = @ScriptDir & "\Backups\logo4.gif"
$gui = GUICreate("New Right Click Menu v1.2", 400, 100)
; background picture
$background = GUICtrlCreatePic(@ScriptDir & "\Backups\msoobe.jpg", 0, 0, 400, 100)
GUISetState(@SW_SHOW)
; transparent MDI child window
$pic = GUICreate("", 369, 68, 20, 20, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $gui)
; transparent pic
$basti_stay = GUICtrlCreatePic($sFile, 0, 0, 369, 68)
GUISetState(@SW_SHOW)
Do
  $msg = GUIGetMsg()
Until Sleep(900)
Exit
EndFunc

I've been using this for ages at work, however as our systems are finaly being updated to Win7, i'd like to be able to update the right click menu to look more fancy

Link to comment
Share on other sites

You might want to use the because you can use icons in the menu and works on 32 Bit / 64 Bit windows.

Edited by Guest
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...