aGorilla Posted April 28, 2008 Posted April 28, 2008 (edited) First, I'll add to the pile of thanks! This is a killer library, and it's going to make my little app look much more professional than I could have hoped for (especially considering my limited experience with AutoIt).I have a couple of questions, that I hope are fairly simple...I'm a bit confused by why things like _TrayCreateItem are tied to an icon. Not terribly important that I understand that, just curious. I was also confused by all of the '-1' references, so I decided to try replace them in one small section (I chose the 'Tools' tray menu in 'sampleGUIandTray-OnEvent.au3'). It seems to be working, but I'm hoping somebody more familiar with the library could just confirm that I've done it correctly. I've also rearranged the order a bit, and I'm wondering if that might cause problems in some cases.Here's my modification:$MenuTools = _TrayCreateMenu($nTrayIcon1, "Tools") $MenuIcon = _TrayItemSetIcon($MenuTools, "shell32.dll", -20) _TrayItemSetSelIcon($MenuTools, "shell32.dll", -44) $TrayCalc = _TrayCreateItem($MenuIcon, "Calculator", $MenuTools) $TrayCMD = _TrayCreateItem($MenuIcon, "CMD" , $MenuTools) $TrayNotepad = _TrayCreateItem($MenuIcon, "Notepad" , $MenuTools) $TrayRegedit = _TrayCreateItem($MenuIcon, "Regedit" , $MenuTools) GUICtrlSetState($TrayNotepad, $GUI_DISABLE) _TrayItemSetIcon($TrayCalc , "calc.exe" , 0) _TrayItemSetIcon($TrayCMD , "cmd.exe" , 0) _TrayItemSetIcon($TrayNotepad, "notepad.exe", 0) _TrayItemSetIcon($TrayRegedit, "regedit.exe", 0) _TrayCreateItem($nTrayIcon1, "") _TrayItemSetIcon($nTrayIcon1, "", 0)Thanks again for this excellent library! Edited April 28, 2008 by aGorilla Search AutoItScript.com via Google
Holger Posted April 28, 2008 Author Posted April 28, 2008 (edited) I'm a bit confused by why things like _TrayCreateItem are tied to an icon.Good 'question'...thanks I think there was a logical thinking problem to realize some things.Info: next version will be script breaking!I will add a new function _TrayCreateContexMenu(IconID) which will create a contextmenu for an icon.So both tray item createfunctions only will change ie. from _TrayCreateItem(TrayIconID, Text, TrayParentMenuID) to _TrayCreateItem(Text, TrayParentMenuID)which should also make script reading easier. Edited April 28, 2008 by Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView
aGorilla Posted April 28, 2008 Posted April 28, 2008 Looking forward to it, I think that will be much easier to follow (at least it would be for me). Just finished replacing all of the -1 in the tray code from 'sampleGUIandTray-OnEvent.au3', and it seems to be working, so I think I finally understand how to bring this into my own app. One more thought, if you're going to make the change, I'd prefer the id first, unless it's optional (text can vary in length much more than the id's will, and as you saw in my example above, 'I code in columns'). I'll leave it for others to chime in on their preferences, but I think this would be easier to read: $TrayCalc = _TrayCreateItem($MenuTools, "Calculator") $TrayCMD = _TrayCreateItem($MenuTools, "CMD" ) $TrayNotepad = _TrayCreateItem($MenuTools, "Notepad" ) $TrayRegedit = _TrayCreateItem($MenuTools, "Regedit" ) $TrayAdvanced = _TrayCreateItem($MenuMenu , "Modern" , -1, 1) $TraySimple = _TrayCreateItem($MenuMenu , "Classic", -1, 1) In the end, it's your call, and I will use it no matter how you do it I said it before, and I'll say it again, this really is a wonderful library. Thanks again. Search AutoItScript.com via Google
C2C Posted April 29, 2008 Posted April 29, 2008 @Holger - Thanks for the input I managed to solve my darned problem. My girl is thankful to you also for me not going completely bald. Kind regards, C2C ----------------------------------90% of teens today would die if Myspace,Bebo + FaceBook had a system failure and was completely destroyed. If you are one of the 10% that would be laughing, copy and paste this to your signature.----------------------------------Code to win, 'till you die, 'till the compiler dies from your linesCode to win, take it all, just keep coding till you fallDay by day, codin' all the way, I'm not cavin' inLet another App begin, code to win
aGorilla Posted May 3, 2008 Posted May 3, 2008 Minor bug: Some undeclared variables in ModernMenuRaw.au3 are throwing errors when using Opt('MustDeclareVars', 1). There may be others, but I've spotted these so far: $hIcon _AddMenuIcon _ReplaceMenuIcon $nResult GetCursorPos SetForegroundWindow $stMenuLogFont (should this be a global? It's being 'cleared (set to '0'), but doesn't get used.) WM_MEASUREITEM WM_DRAWITEM $stRect (not used elsewhere in this file) WM_DRAWITEM Quick question: How can I tie a non-menu event to the 'other' mouse button? For example, if I use _TrayIconSetClick($App('Tray_Icon'), 16), to show the menu when the icon is right-clicked, how can I make it launch a gui when left-clicked? Before I switched to ModernMenu, I was using: TraySetOnEvent($TRAY_EVENT_PRIMARYUP, 'TellMe') That doesn't seem to work now. I've also tried GUICtrlSetOnEvent with no luck. Any suggestions? Search AutoItScript.com via Google
Holger Posted May 3, 2008 Author Posted May 3, 2008 @aGorilla: thanks for info Will fix them - I think that these were older or test values.For using click message info - just use it as I described it here:http://www.autoitscript.com/forum/index.ph...st&p=513365 Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView
aGorilla Posted May 3, 2008 Posted May 3, 2008 For using click message info - just use it as I described it here:http://www.autoitscript.com/forum/index.ph...st&p=513365Thanks much, that did the trick. Funny part is, I read that a while back, but at the time, it meant absolutely nothing to me Search AutoItScript.com via Google
aGorilla Posted May 4, 2008 Posted May 4, 2008 (edited) Ok, another crazy question...When using _TrayCreateMenu, is there some way to add an extra action when the item is clicked? I've tried both GUICtrlSetOnEvent and TrayItemSetOnEvent, but neither worked (as expected). I imagine that ModerMenu is trapping actions, to show the submenu. Is there some form of callback that I can add, to do additional things?Edit: You can see what I'm trying to do with it here. Edited May 5, 2008 by aGorilla Search AutoItScript.com via Google
Holger Posted May 6, 2008 Author Posted May 6, 2008 (edited) Update 06.05.2008:!!! Warning: Script breaking !!!Please change the following commands to:_TrayCreateItem(Text, ...)_TrayCreateMenu(Text , ...)- Fixed: some old values (thanks to aGorilla)- Fixed: ..SetText() functions (thanks to MrCreatoR)- Added the following commands:_SetMenuIconBkGrdColor(Color)_SetTrayIconBkGrdColor(Color)New sidebar menu commands:_CreateSideMenu(MenuID) ; returns a SideMenuID/index_DeleteSideMenu(SideMenuID) ; delete a menu sidebar_SetSideMenuText(SideMenuID, Text) ; set a text for the sidebar_SetSideMenuColor(SideMenuID, Color) ; set text color_SetSideMenuBkColor(SideMenuID, Color) ; set text background color_SetSideMenuBkGradColor(SideMenuID, Color) ; set text background gradient color_SetSideMenuImage(SideMenuID, Bitmapfile [, Resourcename/number [, Expand/Compress Bitmap]])Just take a look into the samples how to use them!At the moment there are some known issues:- missing 64bit compatibility (already in progress, to fully work with "AutoIt3_x64.exe")- moving the mouse cursor on the sidebar menu image/text also changes the current menu item selection- for sidebar menu image only bitmaps are supported at the moment (min.8bpp) Edited May 6, 2008 by Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView
MrCreatoR Posted May 7, 2008 Posted May 7, 2008 @HolgerLet me say: Wow!!! This is unbelievable! Thank you for the update with new features P.SThis is one of those updates that pushes me to continue improving my scripts  Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1  AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ==================================================    AutoIt is simple, subtle, elegant. © AutoIt Team
Greenhorn Posted May 7, 2008 Posted May 7, 2008 (edited) Thanx for the Bitmap support, I tried it by myself and was purely frustrated, but now I'm very delighted !!! Thank you !!! GreetzGreenhorn Edited May 7, 2008 by Greenhorn
ProgAndy Posted May 23, 2008 Posted May 23, 2008 I have an extension for Balloons:_TrayShowBalloonTip($nTrayIcon3,"hio","gg",1) ; Show Balloon Sleep(3000) _TrayShowBalloonTip($nTrayIcon3,"") ; Hide BalloonCODEFunc MyTrayTipCallBack($nID, $nMsg) Switch $nID Case $nTrayIcon2 Switch $nMsg Case $NIN_BALLOONUSERCLICK, $NIN_BALLOONTIMEOUT _TrayIconSetState($nTrayIcon2, 8) ; Stop icon flashing If $nMsg = $NIN_BALLOONUSERCLICK Then MsgBox(64, "Information", "This could be your message.") _TrayIconSetState($nTrayIcon2, 2) ; Hide icon EndSwitch Case $nTrayIcon3 Switch $nMsg ;;; Case $WM_LBUTTONDOWN ; Put your stuff here ;;; case $WM_LBUTTONUP ; Put your stuff here ; One click and double click to put together is difficult case $WM_LBUTTONDBLCLK MsgBox(0, "Info", "You left double clicked on TrayIcon3.") GUISetState(@SW_RESTORE, $hMainGUI) ; Restore/put focus back to our main GUI ;;; case $WM_RBUTTONDOWN ; Put your stuff here case $WM_RBUTTONUP MsgBox(0, "Info", "You right clicked on TrayIcon3.") GUISetState(@SW_RESTORE, $hMainGUI) ; Restore/put focus back to our main GUI ;;; case $WM_RBUTTONDBLCLK ; Put your stuff here ;;; case $WM_MOUSEMOVE ; Put your stuff here ; BALLOON Functions Case $NIN_BALLOONUSERCLICK ToolTip("") MsgBox(0, '', "Balloon clicked") Case $NIN_BALLOONTIMEOUT ToolTip("") MsgBox(0, '', "Balloon timed out") Case $NIN_BALLOONSHOW ToolTip("Balloon show") Case $NIN_BALLOONHIDE ToolTip("") MsgBox(0, '', "Balloon Hide"); END BALLOON EndSwitch EndSwitchEndFunc; Author: Prog@ndy; according to http://www.vbaccelerator.com/home/VB/Code/...SysTray_frm.aspFunc _TrayShowBalloonTip( $nID , _ $sMessage , _ $sTitle = "", _ $eIcon = 0, _ $lTimeOutMs = 30000 _ );~ If $nState = 0 Then Return 1 ; No change If $nID = -1 Then $nID = $TRAYLASTID If $TRAYMSGWND = 0 Or $nID <= 0 Then Return 0 Local $i, $nResult = 0, $bFound = FALSE For $i = 1 To $TRAYNOTIFYIDS[0][0] If $nID = $TRAYNOTIFYIDS[$i][0] Then $bFound = TRUE ExitLoop EndIf Next If Not $bFound Then Return 0 If (@OSTYPE = "WIN32_NT" And Not (@OSVersion="WIN_NT4")) Then Local $stNID = DllStructCreate($sNOTIFYICONDATAW) DllStructSetData($stNID, 1, DllStructGetSize($stNID)) DllStructSetData($stNID, 2, $TRAYMSGWND) DllStructSetData($stNID, 3, $nID) DllStructSetData($stNID, 10, $sMessage) ;"szInfo" DllStructSetData($stNID, 12, $sTitle) ; "szInfoTitle" DllStructSetData($stNID, 11, $lTimeOutMs) ; "uTimeOutOrVersion" DllStructSetData($stNID, 13, $eIcon) ; "dwInfoFlags" DllStructSetData($stNID, 4, $NIF_INFO) ; "uFlags" Return Shell_NotifyIcon($NIM_MODIFY, DllStructGetPtr($stNID)) EndIf Return SetError(1,0,0)EndFuncYou can use it directly in sampleGUIandTray-OnEvent.au3. Replace MyTrayTipCallBack with the one above and add _TrayShowBalloonTip *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
Holger Posted May 23, 2008 Author Posted May 23, 2008 (edited) There is already a function included:_TrayTip(ID, Title, Text, TimeOut, InfoFlags)Also the notification is as example there - just take a look into the examples. Edited May 23, 2008 by Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView
ProgAndy Posted May 25, 2008 Posted May 25, 2008 Oops, I didn't see it , and i didn't find it in examples. *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
Sheri Posted May 25, 2008 Posted May 25, 2008 Sorry if this is a dumb question -- I'm new and just downloaded the samples. Is the tools menu in the samples just for show, or when I click one should the app (e.g., calculator) be getting launched? Looks like they should launch, but nothing is happening. Thanks, Sheri
Holger Posted May 25, 2008 Author Posted May 25, 2008 @Sheri: no, the "exe-file" in the commands (_GUICtrlCreateODMenuItem) are just only to get the right icon of the "exe". At the moment there is no command to start the program. You can add it after the "GUIGetMsg()" for instance. Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView
magician13134 Posted May 26, 2008 Posted May 26, 2008 Great work, I love this! In Vista, menus have a gradient on the highlight part as well as the icon region, is this something we could expect to be possible with ModernMenu any time soon? Visit Magic Soft Inc. for some of my software
Holger Posted May 26, 2008 Author Posted May 26, 2008 (edited) Yes....but not really as you do expect. I have additional created a just "basic"/"simple" version of the "ModernMenu" which is/will be 18-25 KB - so much smaller and support directly using Vista menus with icons (after reading some articles). I just have to add again the tray stuff for testing then it will be published maybe on sunday. Edit: forgot to say that I will seperate the menu and tray stuff (sometimes you want additional tray stuff but don't need menu icons...) Edited May 26, 2008 by Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView
GEOSoft Posted May 26, 2008 Posted May 26, 2008 Yes....but not really as you do expect.I have additional created a just "basic"/"simple" version of the "ModernMenu" which is/will be 18-25 KB - so much smaller and support directly using Vista menus with icons (after reading some articles).I just have to add again the tray stuff for testing then it will be published maybe on sunday.Edit: forgot to say that I will seperate the menu and tray stuff (sometimes you want additional tray stuff but don't need menu icons...)Sounds great Holger. I'll be waiting for it. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
magician13134 Posted May 26, 2008 Posted May 26, 2008 Oh, cool. Keep up the great work, as always, I look forward to any updates! Visit Magic Soft Inc. for some of my software
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