Krikov Posted February 2, 2008 Share Posted February 2, 2008 Hi This is My First Published Script KQM = Krikov Quick Menu Tray Menu Smart And Clean Thanks to Jos For Some Help The Tray Menu expandcollapse popup#NoTrayIcon #include <Constants.au3> #include <Array.Au3> #include <Process.au3> $INIFile = @ScriptDir & "\Menu.ini" If FileExists($INIFile) <> 1 Then MsgBox(0, "KQM Error", "Unable to find MENU.INI File") Exit EndIf Opt("TrayMenuMode", 1); Default tray menu items (Script Paused/Exit) will not be shown. $FirstClass = IniReadSectionNames($INIFile) if IsArray($FirstClass) Then Dim $Menu[$FirstClass[0]+1] Dim $MenuItems[200] For $X = 1 To $FirstClass[0] $Menu[$X] = TrayCreateMenu($FirstClass[$X]) $SecundCalss = IniReadSection($INIFile, $FirstClass[$X]) IF IsArray($SecundCalss) Then For $Y = 1 To $SecundCalss[0][0] $MenuItems[TrayCreateItem($SecundCalss[$Y][0], $Menu[$X])] = $SecundCalss[$Y][1] Next EndIf Next TrayCreateItem("") $Config = TrayCreateItem("Config") $About = TrayCreateItem("About") $exititem = TrayCreateItem("Exit") TraySetState() TrayTip ( "KQM", "The Quick Menu is Running Just Click on Me",3,1) Else Run(@ScriptDir & "\KQMConfig.EXE") Exit EndIf While 1 $msg = TrayGetMsg() Select Case $msg < 1 ContinueLoop Case $msg = $exititem ExitLoop Case $msg = $About MsgBox(0,"KQM About","This Is Krikov Quick Menu"&@CRLF&"Created By Krikov AutoMan 2008") Case $msg = $Config Run("KQMConfig.EXE") Case Else $Command = $MenuItems[$msg] IF StringInStr($Command,".exe") or StringInStr($Command,".com") or StringInStr($Command,".bat") Then if FileExists($Command) = 1 Then Run($Command) EndIf Else if FileExists($Command) = 1 Then ShellExecute($Command) Else PathCheck() EndIf EndIf EndSelect WEnd Func PathCheck() if StringLen($Command) < 1 Then Else TrayTip("KQM Error","The File :"&@CRLF&$Command&@CRLF&" Renamed or Removed",5,3) EndIf EndFunc The Menu Configurator expandcollapse popup#include <GUIConstants.au3> #Include <GuiListBox.au3> #include <Array.au3> Opt("OnExitFunc", "endscript") $Form1_1 = GUICreate("Krikov Quick Menu Creator", 633, 346, 193, 124) $Label1 = GUICtrlCreateLabel("Add Root Menu", 48, 32, 79, 17) $RootInput = GUICtrlCreateInput("", 16, 56, 137, 21) $SubList = GUICtrlCreateList("", 160, 136, 145, 149) $RootMenuAdd = GUICtrlCreateButton("Add", 16, 80, 139, 25, 0) $RootList = GUICtrlCreateList("", 16, 136, 137, 149) $CMDInput = GUICtrlCreateInput("", 16, 288, 609, 21) $Browse = GUICtrlCreateButton("Browse...", 16, 312, 75, 25, 0) $Apply = GUICtrlCreateButton("Apply", 96, 312, 75, 25, 0) $SubInput = GUICtrlCreateInput("", 160, 56, 145, 21) $SubMenuAdd = GUICtrlCreateButton("Add", 160, 80, 147, 25, 0) $Label2 = GUICtrlCreateLabel("Add SubMenu", 192, 32, 72, 17) $DelRoot = GUICtrlCreateButton("Delete", 16, 109, 139, 25, 0) $DelSub = GUICtrlCreateButton("Delete", 160, 109, 147, 25, 0) $Pic1 = GUICtrlCreatePic("Logo.Jpg", 320, 64, 289, 193, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) GUICtrlSetState($Apply,$GUI_DISABLE) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $INI = @ScriptDir&"\Menu.ini" $RootMenu = IniReadSectionNames($INI) RootRefresh() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $RootList; Get Content of SubMenu By Select a Root Menu CleanInput() SubRefresh() Case $SubList; Get The Command Value By Select A Sub List CleanInput() $CommandValue = IniRead($INI,GUICtrlRead($RootList),GUICtrlRead($SubList)," ") GUICtrlSetData($CMDInput,$CommandValue,"") Case $RootMenuAdd; Add a Section to Root List FileWriteLine($INI,"["&GUICtrlRead($RootInput)&"]") RootRefresh() CleanInput() Case $SubMenuAdd; Add a Key for Submenu IniWrite($INI,GUICtrlRead($RootList),GUICtrlRead($SubInput),GUICtrlRead($CMDInput)) SubRefresh() CleanInput() Case $Browse; Browse For Files $CMD = FileOpenDialog("Please Select File Or Folder",GUICtrlRead($CMDInput),"All (*.*)") IF $CMD <> "" Then GUICtrlSetData($CMDInput,$CMD) GUICtrlSetState($Apply,$GUI_ENABLE) EndIf Case $Apply; Commit The Command to a Sub Key IniWrite($INI,GUICtrlRead($RootList),GUICtrlRead($SubList),GUICtrlRead($CMDInput)) GUICtrlSetState($Apply,$GUI_DISABLE) MsgBox(0,"KQM","Data Commited to Menu") Case $DelSub; Delete One Sub Key IniDelete($INI,GUICtrlRead($RootList),GUICtrlRead($SubList)) GUICtrlSetData($CMDInput,"") SubRefresh() Case $DelRoot; Delete Root Menu If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(292,"KQM","Continue To Delete "&GUICtrlRead($RootList)&" Menu ???") CleanInput() Select Case $iMsgBoxAnswer = 6;Yes IniDelete($INI,GUICtrlRead($RootList)) _GUICtrlListBox_ResetContent($SubList) RootRefresh() Case $iMsgBoxAnswer = 7;No EndSelect EndSwitch WEnd Func RootRefresh() _GUICtrlListBox_ResetContent($RootList) $RootMenu = IniReadSectionNames($INI) if IsArray($RootMenu) Then For $X = 1 to $RootMenu[0] GUICtrlSetData($RootList,$RootMenu[$X]) Next EndIf EndFunc Func SubRefresh() _GUICtrlListBox_ResetContent($SubList) $SubMenu = IniReadSection($INI,GUICtrlRead($RootList)) IF IsArray($SubMenu) Then For $Y = 1 to $SubMenu[0][0] GUICtrlSetData($SubList,$SubMenu[$Y][0]) Next EndIf EndFunc Func CleanInput() GUICtrlSetData($RootInput,"") GUICtrlSetData($SubInput,"") GUICtrlSetData($CMDInput,"") EndFunc Func endscript() If ProcessExists("KQM.EXE") Then ProcessClose("KQM.EXE") EndIf if FileExists($INI) Then Run("KQM.EXE") EndIf EndFunc Krikov The AutoMAN [topic="63488"][font="Arial"]Krikov Tray Quick Menu[/font][/topic] Link to comment Share on other sites More sharing options...
NomadRJ Posted February 22, 2008 Share Posted February 22, 2008 Nice! I was just thinking in something like that. Gonna use your script as a base. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now