loin2kolpotoru Posted April 17, 2013 Share Posted April 17, 2013 I want to Automatically set all system tray icons in xp from "hide when inactive" to "always hide" is there a script which will help? Link to comment Share on other sites More sharing options...
Decipher Posted April 17, 2013 Share Posted April 17, 2013 loin2kolpotoru,Welcome to the AutoIt Forums, Please review the following topics.Also remember to search before posting. Anonymous Spoiler Link to comment Share on other sites More sharing options...
Decipher Posted April 17, 2013 Share Posted April 17, 2013 (edited) loin2kolpotoru, This removed everything except for the Local Area Connection icon in the system tray. #include "SysTray_UDF.au3" For $IconIndex = 0 To _SystrayIconCount() _SysTrayIconRemove($IconIndex) Next *Edit - Link to UDF is in previous post. Or though I haven't tried this because all my system tray icons are already missing after testing the first snippet. $hSysTray = _FindTrayToolbarWindow() WinSetState($hSysTray, "", @SW_HIDE) ; - Renable using: WinSetState($hSysTray, "", @SW_SHOW) Anonymous Edited April 17, 2013 by Decipher Spoiler Link to comment Share on other sites More sharing options...
loin2kolpotoru Posted April 17, 2013 Author Share Posted April 17, 2013 Thank you for answering, i have visited those links and tried your scripts but i am not trying to do that i am just trying to automate the process of manually setting all tray icons to "always hide", so that they will remain in the tray and show when i click the arrow in the tray to see them. Link to comment Share on other sites More sharing options...
Decipher Posted April 17, 2013 Share Posted April 17, 2013 (edited) loin2kolpotoru,This does what you want.#Include <GuiToolBar.au3> _ShowHideTrayIcons(0) Func _ShowHideTrayIcons($iState) Local $iPrevOption = Opt("WinTitleMatchMode", 4) Local $hTray = WinGetHandle("[CLASS:Shell_TrayWnd]") Local $hToolbar = ControlGetHandle($hTray, "", "[CLASSNN:ToolbarWindow321]") Opt("WinTitleMatchMode", $iPrevOption) Local $iCmd, $iCount = _GUICtrlToolbar_ButtonCount($hToolbar) If $iState = 1 Then $iState = $TBSTATE_ENABLED Else $iState = $TBSTATE_HIDDEN EndIf For $i = 0 To $iCount - 1 $iCmd = _GUICtrlToolbar_IndexToCommand($hToolbar, $i) _GUICtrlToolbar_SetButtonState($hToolbar, $iCmd, $iState) Next EndFunc*Edit - I just reread your last post.Anonymous Edited April 17, 2013 by Decipher Spoiler Link to comment Share on other sites More sharing options...
guinness Posted April 17, 2013 Share Posted April 17, 2013 $iPrevOption isn't used even though it should be. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Decipher Posted April 17, 2013 Share Posted April 17, 2013 guinness, Thanks I meant to reset it but forgot. Anonymous Spoiler Link to comment Share on other sites More sharing options...
Decipher Posted April 18, 2013 Share Posted April 18, 2013 (edited) This works but some applications like Process Explorer seem to interfere. expandcollapse popup#Include <GuiToolBar.au3> AdlibRegister("_ShowTrayIconsOnHover", 250) While 1 WEnd Func _ShowTrayIconsOnHover() Local Const $iHideSysTrayIcons = 0, $iShowSysTrayIcons = 1 Local Static $iTrayVisible = False, $aTrayPos = _ShowHideTrayIcons($iHideSysTrayIcons) Local $aPos = MouseGetPos() If $aPos[0] >= $aTrayPos[0] And $aPos[0] <= $aTrayPos[0] + $aTrayPos[2] And _ $aPos[1] >= $aTrayPos[1] And $aPos[1] <= $aTrayPos[1] + $aTrayPos[3] Then If Not $iTrayVisible Then $aTrayPos = _ShowHideTrayIcons($iShowSysTrayIcons) EndIf $iTrayVisible = True ElseIf $iTrayVisible Then $aTrayPos = _ShowHideTrayIcons($iHideSysTrayIcons) $iTrayVisible = False EndIf EndFunc Func _SysTrayHwnd() Local Const $iPrevOption = Opt("WinTitleMatchMode", 4) Local $aHwnd[3] = [WinGetHandle("[CLASS:Shell_TrayWnd]"), 0, 0] $aHwnd[1] = ControlGetHandle($aHwnd[0], "", "[CLASSNN:ToolbarWindow321]") $aHwnd[2] = WinGetProcess($aHwnd[0]) Opt("WinTitleMatchMode", $iPrevOption) Return $aHwnd EndFunc Func _ShowHideTrayIcons($iState) Local Static $sHidden = "", $aHwnd = _SysTrayHwnd() ; - Set the initial handles Local $hTray = $aHwnd[0], $hToolbar = $aHwnd[1], $iExplorer = $aHwnd[2], $sHwnd = "" If Not ProcessExists($iExplorer) Then ; - Retrieve the new handles if explorer has been restarted. $aHwnd = _SysTrayHwnd() EndIf Local $iCmd, $iCount = _GUICtrlToolbar_ButtonCount($hToolbar) If $iState = 1 Then $iState = $TBSTATE_ENABLED Else $iState = $TBSTATE_HIDDEN EndIf For $i = 0 To $iCount - 1 $iCmd = _GUICtrlToolbar_IndexToCommand($hToolbar, $i) $sHwnd = '{' & $iCmd & '},' If $iState = $TBSTATE_HIDDEN And Not StringInStr($sHidden, $sHwnd) Then $sHidden &= $sHwnd EndIf _GUICtrlToolbar_SetButtonState($hToolbar, $iCmd, $iState) Next Local $aHidden = StringSplit($sHidden, ",", 3) For $i = Abs(UBound($aHidden, 1) - 2) To 0 Step -1 If _GUICtrlToolbar_GetButtonState($hToolbar, Int($aHidden[$i])) <> $iState Then _GUICtrlToolbar_SetButtonState($hToolbar, Int($aHidden[$i]), $iState) EndIf Next Return WinGetPos($hTray) EndFunc Anonymous Edited April 18, 2013 by Decipher Spoiler Link to comment Share on other sites More sharing options...
Decipher Posted April 18, 2013 Share Posted April 18, 2013 (edited) This is what you asked for. expandcollapse popup#NoTrayIcon #include <GuiListView.au3> #include <Array.au3> Global Const $iHideSysTrayIcons = 0, $iShowSysTrayIcons = 1 _HideShowSysTrayIcons($iHideSysTrayIcons) _HideShowSysTrayIcons($iShowSysTrayIcons) Func _HideShowSysTrayIcons($iState) Run("rundll32.exe shell32.dll, Options_RunDLL 1") WinWait("[TITLE:Taskbar and Start Menu Properties; CLASS:#32770; INSTANCE:1]", "", 2000) Local $hTaskbarDialog = WinGetHandle("[TITLE:Taskbar and Start Menu Properties; CLASS:#32770; INSTANCE:1]") WinSetState($hTaskbarDialog, "", @SW_HIDE) ControlSend($hTaskbarDialog, "", ControlGetHandle($hTaskbarDialog, "", "[ClassnameNN:Button10]"), "!c") WinWait("[TITLE:Customize Notifications; CLASS:#32770; INSTANCE:1]", "", 2000) $hTaskbarDialogA = WinGetHandle("[TITLE:Customize Notifications; CLASS:#32770; INSTANCE:1]") WinSetState($hTaskbarDialogA, "", @SW_HIDE) Local $hListView = ControlGetHandle($hTaskbarDialogA, "", "[CLASS:SysListView32; INSTANCE:1]") $iCount = 0 While WinExists($hTaskbarDialogA) If $iCount >= _GUICtrlListView_GetItemCount($hListView)+1 Then ExitLoop EndIf $iCount +=1 ControlSend($hTaskbarDialogA, "", $hListView, "{SPACE}") $aCombo = ControlGetHandle($hTaskbarDialogA, "", "[CLASS:ComboBox; INSTANCE:1]") For $i = 1 To 3 Step 1 ControlSend($hTaskbarDialogA, "", $aCombo, "{DOWN}") Next If Not $iState Then ControlSend($hTaskbarDialogA, "", $aCombo, "{UP}") EndIf ControlSend($hTaskbarDialogA, "", $hListView, "{DOWN}") WEnd ControlSend($hTaskbarDialogA, "","[CLASS:Button; INSTANCE:2]","{ENTER}") WinClose($hTaskbarDialog) EndFunc *Edit - Typo Anonymous Edited April 18, 2013 by Decipher Spoiler Link to comment Share on other sites More sharing options...
guinness Posted April 18, 2013 Share Posted April 18, 2013 Use Local Static in functions, not Global. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 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