qwertylol Posted April 27, 2007 Share Posted April 27, 2007 I am trying to have the tray menu contents change corresponding to the environment for instance, if there are 4 notepads open it should show 4 radio buttons to choose from, and then each of which will bring the selected notepad to front. what is oneventmode in this setting? I think it's when the script attempt to figure out how many notepads there are only when the traymenu is brought up, because this saves resources. Link to comment Share on other sites More sharing options...
BrettF Posted April 27, 2007 Share Posted April 27, 2007 I am trying to have the tray menu contents change corresponding to the environmentfor instance, if there are 4 notepads open it should show 4 radio buttons to choose from, and then each of which will bring the selected notepad to front.what is oneventmode in this setting? I think it's when the script attempt to figure out how many notepads there are only when the traymenu is brought up, because this saves resources.Would you care to show your script?? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
smashly Posted April 28, 2007 Share Posted April 28, 2007 (edited) What is this continuing on from this thread you started qwertylol?Did you actually try anything yourself? .... or should all the members of the board write the script for you? lolDoing as bert suggested and you'd probly get a better chance of ppl posting help. (no promises though)Good Luck&Cheers Edited April 28, 2007 by smashly Link to comment Share on other sites More sharing options...
qwertylol Posted April 28, 2007 Author Share Posted April 28, 2007 Func live_check () Local $account_currently_being_checked = 0 Local $live_array = WinList ( "notepad" ) Local $loop = 1 Local $how_many_account_there_are = IniRead ( "local_record.ini", "0", "number_of_local_account", "error" ) Do $account_currently_being_checked = $account_currently_being_checked + 1 $handle = IniRead ( "local_record.ini", $account_currently_being_checked, "handle", "error" ) Do If $handle == $live_array[$loop][1] Then IniWrite ( "local_record.ini", $account_currently_being_checked, "is_it_live", "1" ) ExitLoop ElseIf IniWrite ( "local_record.ini", $account_currently_being_checked, "is_it_live", "0" ) EndIf $loop = $loop + 1 Until $loop == $live_array[0][0] Until EndFunc Link to comment Share on other sites More sharing options...
qwertylol Posted April 28, 2007 Author Share Posted April 28, 2007 the above tries to find out if the live notepads handle match that on the record. it's it finds out it's not a the record, or a handle from the record has cease to exist, then it will make appropriate actions. All is the same, though, I am not sure how I can trigger the updating of things when the traymenu is tackled. Link to comment Share on other sites More sharing options...
BrettF Posted April 28, 2007 Share Posted April 28, 2007 the above tries to find out if the live notepads handle match that on the record.it's it finds out it's not a the record, or a handle from the record has cease to exist, then it will make appropriate actions.All is the same, though, I am not sure how I can trigger the updating of things when the traymenu is tackled.What do you mean by the updating of things? Do you mean what happens when you click it?? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
smashly Posted April 28, 2007 Share Posted April 28, 2007 (edited) Here's my ruff example of tray on event mode.Upto 20 notepad windows open will show in the tray, click on the coresponding tray item and the associated notepad window will become active.Refreshes the tray menu when a mouse right click down on the tray icon, tray menu shows when mouse right click is up.expandcollapse popup#Include <Constants.au3> Opt("TrayOnEventMode",1) Opt("TrayMenuMode",1) Opt("WinTitleMatchMode", 2) ; Your only using part of a window title name to find the notepad window , then mode 2 Global $Check[21][8], $Warning[1] ;; $Check[0][0] Is how many tray menu items there are for Notepad windows ;; $Check[n][0] Is the main tray menu for a Notepad window ;; $Check[n][1] Is the Notepad Window Title ;; $Check[n][2] Is the Notepad window Handle ;; $Check[n][3] Is the tray menu item Activate ;; $Check[n][4] Is the tray menu item Minimize ;; $Check[n][5] Is the tray menu item Maximize ;; $Check[n][6] Is the tray menu item Restore ;; $Check[n][7] Is the tray menu item Close ;; n is a number from 1 to 20 (representing each notepad window listed) ;; $Warning[0] Is 0 or 1 , 0 meaning to give a warning when max notepad windows is reached , 1 being the warning has been given. TrayCreateItem("", -1, 11) $exit = TrayCreateItem("Exit", -1, 12) TrayItemSetOnEvent(-1, "Close") ; Close function it called when tray menu item Exit is clicked TraySetOnEvent($TRAY_EVENT_SECONDARYDOWN, 'check') ; Check function is called when tray icon is right clicked down TraySetState() TraySetClick(16) ; Set the tray menu to display when the the right click is released While 1 Sleep(10) WEnd Func check() $var = WinList ("Notepad") If $var[0][0] > 20 Then ; Put a warning if the notepad windows are over 20 then return If $Warning[0] = 0 Then MsgBox(0,'More then 20 Notepad windows Open!', _ 'This example only supports 20 Notepad windows to be loaded into the tray!' _ & @LF & 'Any further Notepad windows that are opened will not be added to the tray!') $Warning[0] = 1 ; Set the warning it only displays once when the tray icon is clicked EndIf Return ; escape the function cause we've reached 20 notepad windows ElseIf $var[0][0] <= 20 Then ; If the notepad windows get back to 20 or less then reset the warning $Warning[0] = 0 ; Warning set back to 0 so it'll trip again if the limit goes over 20 EndIf If $var[0][0] = $Check[0][0] Then ; If win list has the same anount of notepad windows as already listed the escape the function Return ; escape the function Else For $d = 1 To $Check[0][0] ; It seemed easier to just delete all traymenu items and reload the refreshed updated data. TrayItemDelete($Check[$d][0]) ; Delete all the traymenu items $Check[$d][0] = '' ; Clear all the main notepad window tray menus from the array For $e = 0 To 7 $Check[$d][$e] = '' ; Clear all notepad window tray menu items, wintitles and handles from the array Next Next $Check[0][0] = 0 ; Reset how many notepad window tray menus to 0 EndIf For $i = 1 to $var[0][0] ; Add new notepad window tray menus and items to array and the tray. If $var[$i][0] <> "" Then $Check[0][0] = $Check[0][0] + 1 $Check[$i][1] = $var[$i][0] ;Set $check array with notepad window WinTitle $Check[$i][2] = $var[$i][1] ;Set $check array with notepad window handle $Check[$i][0] = TrayCreateMenu($i & ': ' & $Check[$i][1], -1, $i - 1) ; Create a main tray menu with the notepad window WinTitle $Check[$i][3] = TrayCreateItem('Activate', $Check[$i][0], 0) ; Create a sub tray menu item for Activate TrayItemSetOnEvent($Check[$i][3], "Activate") ; Set the Activate menu item to call the activate function when clicked $Check[$i][4] = TrayCreateItem('Minimize', $Check[$i][0], 1) ; Create a sub tray menu item for Minimize TrayItemSetOnEvent($Check[$i][4], "Activate") ; Set the Minimize menu item to call the activate function when clicked $Check[$i][5] = TrayCreateItem('Maximize', $Check[$i][0], 2) ; Create a sub tray menu item for Maximize TrayItemSetOnEvent($Check[$i][5], "Activate") ; Set the Maximize menu item to call the activate function when clicked $Check[$i][6] = TrayCreateItem('Restore', $Check[$i][0], 3) ; Create a sub tray menu item for Restore TrayItemSetOnEvent($Check[$i][6], "Activate") ; Set the Restore menu item to call the activate function when clicked $Check[$i][7] = TrayCreateItem('Close', $Check[$i][0], 4) ; Create a sub tray menu item for Close TrayItemSetOnEvent($Check[$i][7], "Activate") ; Set the Close menu item to call the activate function when clicked EndIf Next EndFunc Func Activate() ; When a sub tray menu item is clicked it call this For $x = 1 To $Check[0][0] Select Case @TRAY_ID = $Check[$x][3] ; Activate is clicked WinActivate($Check[$x][2]) ; Activate notepad window by handle Case @TRAY_ID = $Check[$x][4] ; Minimize is clicked WinSetState($Check[$x][2],'', @SW_MINIMIZE) ;Minimize notepad window by handle Case @TRAY_ID = $Check[$x][5] ; Maximised it clicked WinSetState($Check[$x][2],'', @SW_MAXIMIZE) ;Maximise notepad window by handle Case @TRAY_ID = $Check[$x][6] ; Restore is clicked WinSetState($Check[$x][2],'', @SW_RESTORE) ;Restore notepad window by handle Case @TRAY_ID = $Check[$x][7] ; Close is clicked WinClose($Check[$x][2]) ;Close notepad window by handle EndSelect Next EndFunc Func Close() ;Eit the tray all together Exit EndFuncCheersEdit: Added sub tray menu item to each notepad window that's listed, each sub tray menu contains Activate, Minimize, Maximize, Restore and Close... Maybe this is more what your after as an example?Added comments so maybe you can see what it's doing. I can't see why you have to start a new thread for every question about the same thing , but each his own.Your previous postThis postYour Most current post Edited April 28, 2007 by smashly 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