Jump to content

Recommended Posts

Posted

Is there any way to hide the system tray icon of another application from within AutoIt? I know it's not very likely, but it would still be pretty useful...

Posted

Is there any way to hide the system tray icon of another application from within AutoIt? I know it's not very likely, but it would still be pretty useful...

TraySetState(2)
Posted

TraySetState(2)

That only affects the AutoIt script's tray icon, not another app's.

The desktop is just another window, and the system tray is just another control. Use AU3Info.exe to check them out. The controls there can be hidden/deleted/etc. just like any other.

:)

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
Posted (edited)

TraySetState(2)

As PsaltyDS said, this is only for AutoIt's icon.

The desktop is just another window, and the system tray is just another control. Use AU3Info.exe to check them out. The controls there can be hidden/deleted/etc. just like any other.

I actually checked it out before I posted. Under XP (not sure about other versions of windows), the entire tray/"Notification Area" is one ToolbarWindow32 control. I don't want to hide the entire tray area...

Perhaps it's a matter of a Windows API call? I don't know my WinAPI very well at all, but I'll look into it. In the meantime, any help would be appreciated!

Edited by phaze424
Posted

That only affects the AutoIt script's tray icon, not another app's.

The desktop is just another window, and the system tray is just another control. Use AU3Info.exe to check them out. The controls there can be hidden/deleted/etc. just like any other.

:)

Does that actually work? Every time I've tried it just failed. I always use tuape's SYSTRAY UDF:

http://www.autoitscript.com/forum/index.ph...;hl=systray+udf

Works a dream :)

Posted

As PsaltyDS said, this is only for AutoIt's icon.

I actually checked it out before I posted. Under XP (not sure about other versions of windows), the entire tray/"Notification Area" is one ToolbarWindow32 control. I don't want to hide the entire tray area...

Perhaps it's a matter of a Windows API call? I don't know my WinAPI very well at all, but I'll look into it. In the meantime, any help would be appreciated!

Look at the toolbar UDF commands. This demo hides/enables the Volume icon in my sytem tray:

#Include <GuiToolBar.au3>

HotKeySet("{ESC}", "_Quit")

Opt("WinTitleMatchMode", 4)
Global $hTray = WinGetHandle("[CLASS:Shell_TrayWnd]")
Global $hToolbar = ControlGetHandle($hTray, "", "[CLASSNN:ToolbarWindow321]")
Global $iCnt = _GUICtrlToolbar_ButtonCount($hToolbar)
ConsoleWrite("Debug: $iCnt = " & $iCnt & @LF)
Global $iCmdVolume = -1
Global $sMsg, $sText, $iCmd
For $n = 0 To $iCnt - 1
    $sMsg = "Index: " & $n 
    $iCmd = _GUICtrlToolbar_IndexToCommand($hToolbar, $n)
    $sMsg &= "  CommandID: " & $iCmd
    $sText = _GUICtrlToolbar_GetButtonText($hToolbar, $iCmd)
    If StringInStr($sText, "Volume") Then $iCmdVolume = $iCmd
    $sMsg &= "  Text: " & $sText
    ConsoleWrite("Debug: " & $sMsg & @LF)
Next
ConsoleWrite("Debug: $iCmdVolume = " & $iCmdVolume & @LF)

Global $bolVisible = True
While 1
    $bolVisible = Not $bolVisible
    If $bolVisible Then
        _GUICtrlToolbar_SetButtonState($hToolbar, $iCmdVolume, $TBSTATE_ENABLED)
    Else
        _GUICtrlToolbar_SetButtonState($hToolbar, $iCmdVolume, $TBSTATE_HIDDEN)
    EndIf
    Sleep(1000)
WEnd

Func _Quit()
    _GUICtrlToolbar_SetButtonState($hToolbar, $iCmdVolume, $TBSTATE_ENABLED)
    Exit
EndFunc

:)

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
Posted (edited)

Does that actually work? Every time I've tried it just failed. I always use tuape's SYSTRAY UDF:

http://www.autoitscript.com/forum/index.ph...;hl=systray+udf

Works a dream :)

Look at the toolbar UDF commands. This demo hides/enables the Volume icon in my sytem tray:

#Include <GuiToolBar.au3>

HotKeySet("{ESC}", "_Quit")

Opt("WinTitleMatchMode", 4)
Global $hTray = WinGetHandle("[CLASS:Shell_TrayWnd]")
Global $hToolbar = ControlGetHandle($hTray, "", "[CLASSNN:ToolbarWindow321]")
Global $iCnt = _GUICtrlToolbar_ButtonCount($hToolbar)
ConsoleWrite("Debug: $iCnt = " & $iCnt & @LF)
Global $iCmdVolume = -1
Global $sMsg, $sText, $iCmd
For $n = 0 To $iCnt - 1
    $sMsg = "Index: " & $n 
    $iCmd = _GUICtrlToolbar_IndexToCommand($hToolbar, $n)
    $sMsg &= "  CommandID: " & $iCmd
    $sText = _GUICtrlToolbar_GetButtonText($hToolbar, $iCmd)
    If StringInStr($sText, "Volume") Then $iCmdVolume = $iCmd
    $sMsg &= "  Text: " & $sText
    ConsoleWrite("Debug: " & $sMsg & @LF)
Next
ConsoleWrite("Debug: $iCmdVolume = " & $iCmdVolume & @LF)

Global $bolVisible = True
While 1
    $bolVisible = Not $bolVisible
    If $bolVisible Then
        _GUICtrlToolbar_SetButtonState($hToolbar, $iCmdVolume, $TBSTATE_ENABLED)
    Else
        _GUICtrlToolbar_SetButtonState($hToolbar, $iCmdVolume, $TBSTATE_HIDDEN)
    EndIf
    Sleep(1000)
WEnd

Func _Quit()
    _GUICtrlToolbar_SetButtonState($hToolbar, $iCmdVolume, $TBSTATE_ENABLED)
    Exit
EndFunc

:)

Thanks! I didn't even know about these UDFs. This should work well for my purposes.

Edited by phaze424

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...