Sign in to follow this  
Followers 0
Dirk98

Determine Tray

7 posts in this topic

How to leave only 3 certain programs running in the tray and to kick out any other ones? If one (or 2 or 3 etc.) of the preset programs is missing the script will stop with a window showing the missing ones and will exit on hitting OK.

Thanks.

Share this post


Link to post
Share on other sites



How to leave only 3 certain programs running in the tray and to kick out any other ones? If one (or 2 or 3 etc.) of the preset programs is missing the script will stop with a window showing the missing ones and will exit on hitting OK.

Thanks.

The system tray is really just a toolbar control. Have you coded anything at all yet? Can you just list all items in the tray? The _Toolbar* functions in PaulIA's Auto3Lib will get you pretty far.

If you need more help, post your code so far...

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Dirk98 - Is this related to your previous topic concerning automating GFkeys?

Share this post


Link to post
Share on other sites

In case you haven't figure it out yet, I made a script a few days ago to remove desired icons from the tray using tuape's udf's.

#include <GUIConstants.au3>
#include "SysTray_UDF.au3"


$iProcesses = _SysTrayIconProcesses()
For $i=0 to Ubound($iProcesses)-1
    custMsgBox($iProcesses[$i])
Next

Func custMsgBox($oItem)
GUICreate("Tray Icon Remover", 493, 106)
GUICtrlCreateLabel("The process '"&$oItem&"' is currently running in the tray. ", 8, 16, 425, 17)
GUICtrlCreateLabel("What do you want to do?", 8, 40, 124, 17)
$HideIcon = GUICtrlCreateButton("Hide From Tray", 8, 72, 113, 25, $BS_DEFPUSHBUTTON)
$CloseProcess = GUICtrlCreateButton("Close Process", 248, 72, 113, 25, 0)
$Nothing = GUICtrlCreateButton("Nothing", 368, 72, 113, 25, 0)
$Show = GUICtrlCreateButton("Show in Tray", 126, 72, 113, 25, 0)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            GUIDelete()
            ExitLoop
        Case $Nothing
            GUIDelete()
            ExitLoop
        Case $CloseProcess
            ProcessClose($oItem)
            GUIDelete()
            ExitLoop
        Case $HideIcon
            _SysTrayIconVisible(1, _SysTrayIconIndex($oItem))
            GUIDelete()
            ExitLoop
        Case $Show
            _SysTrayIconVisible(0, _SysTrayIconIndex($oItem))
            GUIDelete()
            ExitLoop
    EndSwitch
WEnd
EndFunc

Notice that using "Hide From Tray" will only hide the icon. If you want to close the process use "Close Process". "Show in Tray" will bring it back.

Here you can download tuape's include file:

http://www.autoitscript.com/forum/index.ph...ost&id=8946

Save it in the 'Include' folder of AutoIt.

Share this post


Link to post
Share on other sites

Thank you very much, guys. Yes I'm still trying to learn a way to control the popup menus of some programs in the tray (like GFKeys). I have not found the answer yet to the more basic question how to select one of the 2 options in the Volume popup, script once made by PAiulia:

#include <A3LMenu.au3>
#include <A3LToolbar.au3>

Opt("WinTitleMatchMode", 4)

$hWnd   = ControlGetHandle("classname=Shell_TrayWnd", "", "Notification Area")
$iCount = _Toolbar_ButtonCount($hwnd)

for $iI = 1 to $iCount
  $iCommand = _Toolbar_IndexToCommand($hWnd, $iI)
  $sText    = _Toolbar_GetButtonText ($hWnd, $iCommand)
  if $sText = "Volume" then
    if ControlGetHandle("classname=Shell_TrayWnd", "", "Button2") <> 0 then
      ControlClick("classname=Shell_TrayWnd", "", "Button2")
    endif
    _Toolbar_ClickButton($hWnd, $iCommand, "right", False, 1, 1)
    _Menu_ClickPopupAccel("O")
    ExitLoop
  endif
next

Share this post


Link to post
Share on other sites

In case you haven't figure it out yet, I made a script a few days ago to remove desired icons from the tray using tuape's udf's.

Notice that using "Hide From Tray" will only hide the icon. If you want to close the process use "Close Process". "Show in Tray" will bring it back.

Here you can download tuape's include file:

http://www.autoitscript.com/forum/index.ph...ost&id=8946

Save it in the 'Include' folder of AutoIt.

Thanks, Nahuel, I have had that include since I started messing with the tray. Also thanks for your script, goes to my collection. It looks I'll have a coherent register of potentially useful script elements that I can use before I learn do code anything by myself. But hey, there's no key or method to become talented like you, guys. :)

Share this post


Link to post
Share on other sites

Thanks, Nahuel, I have had that include since I started messing with the tray. Also thanks for your script, goes to my collection. It looks I'll have a coherent register of potentially useful script elements that I can use before I learn do code anything by myself. But hey, there's no key or method to become talented like you, guys. :)

The reason I asked if you are still attempting to automate GFkeys is because it looks like you are attempting a workaround to complete your task.

It seems like you are trying to isolate the GFKeys tray icon just so it is always in the same position. If this the case you should just be using the AU3Lib UDF mentioned above to interact with that icon regardless of the others presence.

Share this post


Link to post
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
Sign in to follow this  
Followers 0