GoogleDude Posted March 28, 2008 Share Posted March 28, 2008 Hi again Holger.I was wondering, is that would be possible to make two more functions:1) _SetTraySideImage($sImage) -> It will set an image for the tray menu, like this one have (here the DAEMON Tools Pro is the side image):Can this be done? I would love to see this as an option in future versions of this UDF!My .02 centsGoogleDude Link to comment Share on other sites More sharing options...
MrCreatoR Posted April 6, 2008 Share Posted April 6, 2008 There is a bug in _GUICtrlODMenuItemSetText() and _TrayItemSetText()... It's just removes all(?) states from the items Example: #include <GUIConstants.au3> #include "ModernMenu.au3" #NoTrayIcon $hMainGUI = GUICreate("Sample Menu") $Menu = GUICtrlCreateMenu("Menu") $Item = _GUICtrlCreateODMenuItem("Menu Item", $Menu) GUICtrlSetState(-1, BitOR($GUI_CHECKED, $GUI_DISABLE)) ;Uncomment next line, and you will see that the item is no more disabled and it's not checked ;_GUICtrlODMenuItemSetText($Item, "New Item Text") GUISetState() $TrayIcon = _TrayIconCreate("Test", "shell32.dll", 130) $TrayItem = _TrayCreateItem(-1, "Tray Item", 0, -1, 1) GUICtrlSetState(-1, BitOR($GUI_CHECKED, $GUI_DISABLE)) ;Uncomment next line, and you will see that the item is no more disabled and it's not checked ;_TrayItemSetText(-1, "New Tray Item Text") While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE _TrayIconDelete($TrayIcon) Exit EndSwitch WEnd 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 Link to comment Share on other sites More sharing options...
MrCreatoR Posted April 6, 2008 Share Posted April 6, 2008 Ok, Here is a fix: expandcollapse popup;******************************************************************** ; Set the text of an menu item ;******************************************************************** Func _TrayItemSetText($nMenuID, $sText) If $nMenuID = -1 Then $nMenuID = $MENULASTITEM If $nMenuID <= 0 Then Return 0 Local $i, $nItem_State For $i = 1 To $arMenuItems[0][0] If $arMenuItems[$i][0] = $nMenuID Then $arMenuItems[$i][1] = $sText $nItem_State = GUICtrlRead($nMenuID) _SetOwnerDrawn($arMenuItems[$i][3], $nMenuID, $sText, FALSE) GUICtrlSetData($nMenuID, $sText) _SetOwnerDrawn($arMenuItems[$i][3], $nMenuID, $sText) GUICtrlSetState($nMenuID, $nItem_State) Return 1 EndIf Next Return 0 EndFunc ;******************************************************************** ; Set the text of an menu item ;******************************************************************** Func _GUICtrlODMenuItemSetText($nMenuID, $sText) If $nMenuID = -1 Then $nMenuID = $MENULASTITEM If $nMenuID <= 0 Then Return 0 Local $i, $nItem_State For $i = 1 To $arMenuItems[0][0] If $arMenuItems[$i][0] = $nMenuID Then $arMenuItems[$i][1] = $sText $nItem_State = GUICtrlRead($nMenuID) _SetOwnerDrawn($arMenuItems[$i][3], $nMenuID, $sText, FALSE) GUICtrlSetData($nMenuID, $sText) _SetOwnerDrawn($arMenuItems[$i][3], $nMenuID, $sText) GUICtrlSetState($nMenuID, $nItem_State) Return 1 EndIf Next EndFunc I think/hope that the fix is correct 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 Link to comment Share on other sites More sharing options...
OnTheFly Posted April 7, 2008 Share Posted April 7, 2008 Thanks a LOT! This is just what i've been looking for. Great job! Link to comment Share on other sites More sharing options...
Synapse Posted April 10, 2008 Share Posted April 10, 2008 Is there a way to add a sub item to the context menu ??? And how.. Thx in advance Link to comment Share on other sites More sharing options...
C2C Posted April 20, 2008 Share Posted April 20, 2008 Hi again Holger.1) _SetTraySideImage($sImage) -> It will set an image for the tray menu, like this one have (here the DAEMON Tools Pro is the side image):Any news on this function?Thanks in advance ----------------------------------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 Link to comment Share on other sites More sharing options...
wind Posted April 21, 2008 Share Posted April 21, 2008 Great! It's Very beautiful!! I'll take time in it,thanks a lot Link to comment Share on other sites More sharing options...
Wooltown Posted April 21, 2008 Share Posted April 21, 2008 Will it be included in the standard UDFs ? Link to comment Share on other sites More sharing options...
GEOSoft Posted April 21, 2008 Share Posted April 21, 2008 Will it be included in the standard UDFs ?It hasn't been in the 2+ years that it's been around so don't hold your breath while you're waiting. 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!" Link to comment Share on other sites More sharing options...
OnTheFly Posted April 24, 2008 Share Posted April 24, 2008 Hi, I need some help to open the tray meny with the keyboard. (HotKeySet). How can i do it? Link to comment Share on other sites More sharing options...
Greenhorn Posted April 25, 2008 Share Posted April 25, 2008 Hi, Maybe try this ... expandcollapse popup; CTRL+ALT+M HotKeySet('+!m', 'MenuOnHotKey') $nTrayIcon = _TrayIconCreate('My TrayIcon') _TrayIconSetClick(-1, 16) ; etc, etc ... Func MenuOnHotKey() _SysTray_ClickItem('My TrayIcon', "right", 1) EndFunc ;==================================================================================== ; ;Function Name: _SysTray_ClickItem() ;Description: Click on item in Windows system tray by any substring in the title ;Parameters: $iTitle - The title of the item in Windows system tray (you can see the title of the item when mouse cursor hovered on item). ; $iButton - [optional] The button to click, "left" or "right". Default is the left button. ; $iClick - [optional] The number of times to click the mouse. Default is 2 ; ;Return Value(s): None ;Requirement(s): AutoIt 3.2.10.0 ; ; ;Autor(s): R.Gilman (a.k.a rasim); Siao (Thanks for idea smile.gif) ; ;==================================================================================== Func _SysTray_ClickItem($iTitle, $iButton = "left", $iClick = 2) Local $hToolbar, $iButCount, $aRect, $i If Not $iTitle Then MsgBox(16, "Error", "Please indicate title") Return 0 EndIf $hToolbar = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]') If @error Then MsgBox(16, "Error", "System tray not found") Return 0 EndIf $iButCount = _GUICtrlToolbar_ButtonCount($hToolbar) If $iButCount = 0 Then MsgBox(16, "Error", "Not found item in system tray") Return EndIf For $i = 0 To $iButCount - 1 $cID = _GUICtrlToolbar_IndexToCommand($hToolBar, $i) If StringInStr(_GUICtrlToolbar_GetButtonText($hToolBar, $i), $iTitle) Then $aRect = _GUICtrlToolbar_GetButtonRect($hToolBar, $i) ControlClick("[Class:Shell_TrayWnd]", "", "ToolbarWindow321", $iButton, $iClick, $aRect[0], 5) $aRect = 0 Return 1 EndIf Next MsgBox(48, "Fail", "Required item not found") EndFunc Greetz Greenhorn Link to comment Share on other sites More sharing options...
C2C Posted April 27, 2008 Share Posted April 27, 2008 How can i make something extra happen when the tray is open ok ill rephrase that how do i know if this tray is opened by the corresponding button set by _TrayIconSetClick Bottom line how can i check or induce tray menu showing ----------------------------------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 Link to comment Share on other sites More sharing options...
C2C Posted April 28, 2008 Share Posted April 28, 2008 I need a way to detect if the tray menu created with modernmenu library is open because it creates a separate tray icon and not the original one so i need a way to be absolutely sured when this exact one menu that was created by the library is open ----------------------------------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 Link to comment Share on other sites More sharing options...
C2C Posted April 28, 2008 Share Posted April 28, 2008 Ok lost a few hairs and still going strong. if somebody can plz for the sake of me not spending cash on demoxinyl. which value goes true or false or 1 or 0 or whatever when the blasted tray menu is on or off ----------------------------------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 Link to comment Share on other sites More sharing options...
C2C Posted April 28, 2008 Share Posted April 28, 2008 i dont know im getting really frustrated either im dead stupid and im not seeing something thats in front of my eyes or im asking a hard @ss question ----------------------------------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 Link to comment Share on other sites More sharing options...
C2C Posted April 28, 2008 Share Posted April 28, 2008 anybody? {scooby voice} reeeeelp {/scooby voice} ----------------------------------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 Link to comment Share on other sites More sharing options...
Holger Posted April 28, 2008 Author Share Posted April 28, 2008 Please stop asking if you want to get an answer! Will take a look later - at the moment this ist not implemented. 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 Link to comment Share on other sites More sharing options...
C2C Posted April 28, 2008 Share Posted April 28, 2008 (edited) I cant believe that nobody can help me with this problem. Is it possible that nobody uses this library? Ill try to explain my situation. Ok so when the menu opens i want something to happen I tried the wingetpos-ish approach using the class 32768 (but all trays are that class) so i need something to narrow it down. If I could be directed to a var or array function or anything that either gives me the handle of the menu (note that every time you open the menu its handle changes slightly) or it gives me a value of the new trays state (opened state) thanks in advance EDIT: Excuse me Holger I didnt notice that you have posted. Please excuse me for my impulsive behaviour but this is really getting to my nerve ive been probing your script and i didnt find anything that could lead me to my answer or even near it. If you could point me to the function that actually opens the tray when the button set with _TrayIconSetClick I would be very grateful. PM'd Edited April 28, 2008 by 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 Link to comment Share on other sites More sharing options...
GEOSoft Posted April 28, 2008 Share Posted April 28, 2008 EDIT: Excuse me Holger I didnt notice that you have posted. Please excuse me for my impulsive behaviour but this is really getting to my nerve ive been probing your script and i didnt find anything that could lead me to my answer or even near it. If you could point me to the function that actually opens the tray when the button set with _TrayIconSetClick I would be very grateful. PM'dYou have your answer from Holger (who wrote those functions) so you will have to do some further searching.BTW; many people, including me, seldom reply to PM's from people who want private assistance. Don't be surprised if it takes a while to get a reply. 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!" Link to comment Share on other sites More sharing options...
Holger Posted April 28, 2008 Author Share Posted April 28, 2008 (edited) Just for info: there is something already implemented (I just forgot). If you 'create' one tray icon just use the additional option which is also shown in the sample files and in the 'commands.txt' in the ZIP: _TrayIconCreate(Tooltip, IconFile, IconID, CallBack-function)oÝ÷ Ùú+{-jw)¶¬jëh×6$TrayIcon1 = _TrayIconCreate("My tooltip", "shell32.dll", -14, "MyTrayCallBack") ... Func MyTrayCallback($nID, $nMsg) Switch $nID Case $nTrayIcon1 If $nMsg = $WM_RBUTTONUP Then ...do your stuff here EndSwitch EndFunc But you just also have to notice that if you are moving your mouse while 'doing your stuff here' then the tray context menu maybe will be shown on another posistion! Holger 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 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