Jump to content

MOVE SYSTEM TRAY ICONS


ZNote
 Share

Recommended Posts

Works on x86, not sure of x64.

Sometimes when moving left or right selected process icon moves two

places, In such case restart the program. ( Due to explorer icons )

Cannot handle taskmgr.exe icon.

You may have to click buttons once or more due to explorer icons.

Temporary disable hide inactive icons for better viewing/moving

of tray icons.

Not that great program but will move your system tray icons without

closing any process.

Use This UDF -> SYS_TRAY.UDF ( http://www.autoitscript.com/forum/index.ph...st&id=18577 )

Code:-

CODE
#cs ----------------------------------------------------------------------------

AutoIt Version: 3.3.0.0

Author: ZNOTE

Script Function: Move System Tray Icons

( Compile It, To Use It )

#ce ----------------------------------------------------------------------------

#NoTrayIcon

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****

#AutoIt3Wrapper_outfile=Move System Tray Icons.exe

#AutoIt3Wrapper_Compression=4

#AutoIt3Wrapper_Res_Comment=Move System Tray Icons ( Without Task Manager ) [ EXPERIMENTAL ]

#AutoIt3Wrapper_Res_Description=Move System Tray Icons

#AutoIt3Wrapper_Res_Fileversion=1.0.0.0

#AutoIt3Wrapper_Res_LegalCopyright=Copyright © ZNote

#AutoIt3Wrapper_Res_Language=1033

#AutoIt3Wrapper_Res_Field=CompanyName|ZNote Inc.

#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <ButtonConstants.au3>

#include <ComboConstants.au3>

#include <GUIConstantsEx.au3>

#include <StaticConstants.au3>

#include <array.au3>

#include <SysTray_UDF.au3>

Global $curPos, $curPos1, $Win_State = 0

$Form1 = GUICreate("Move System Tray Icons", 329, 194, 232, 202)

$Group1 = GUICtrlCreateGroup("", 16, 10, 297, 169)

$Combo1 = GUICtrlCreateCombo("<Select Process>", 32, 48, 265, 25)

$Button1 = GUICtrlCreateButton("Move Right", 56, 112, 81, 33, 0)

_ToolTip()

$Button2 = GUICtrlCreateButton("Move Left", 184, 112, 81, 33, 0)

_ToolTip()

GUICtrlCreateGroup("", -99, -99, 1, 1)

GUISetState(@SW_SHOW)

If ProcessExists("taskmgr.exe") Then

$Win_State = WinGetState("Windows Task Manager", "") ; 23 or 32

ProcessClose(ProcessExists("taskmgr.exe"))

EndIf

$var = _SysTrayIconProcesses()

$var1 = _ArrayFindAll($var,@ScriptName,0,_SysTrayIconCount(),1)

For $i = 0 To _SysTrayIconCount() Step 1

If $i == _SysTrayIconCount() Then ExitLoop

If $var[$i] == @ScriptName Then

; Store Indexes Where This Process Is Present

Else

GUICtrlSetData($Combo1, $var[$i])

EndIf

Next

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $Button1

$curPos = _SysTrayIconIndex(GUICtrlRead($Combo1))

$curPos1 = _SysTrayIconIndex(GUICtrlRead($Combo1))

$curPos1 = $curPos1 + 1

For $i = $curPos1 To _SysTrayIconCount() Step 1

If $i == _SysTrayIconCount() Then ExitLoop

If _ArraySearch($var1,$i,0,_SysTrayIconCount()) <> -1 Then

$curPos1 = $curPos1 + 1

Else

ExitLoop

EndIf

Next

_SysTrayIconmove($curPos, $curPos1)

Case $Button2

$curPos = _SysTrayIconIndex(GUICtrlRead($Combo1))

$curPos1 = _SysTrayIconIndex(GUICtrlRead($Combo1))

$curPos1 = $curPos1 - 1

For $i = $curPos1 To 0 Step -1

If $i == 0 Then ExitLoop

If _ArraySearch($var1,$i,0,_SysTrayIconCount()) <> -1 Then

$curPos1 = $curPos1 - 1

Else

ExitLoop

EndIf

Next

_SysTrayIconmove($curPos, $curPos1)

Case $GUI_EVENT_CLOSE

_RefreshSystemTray(1000)

If $Win_State <> 0 Then

If $Win_State == 23 Or $Win_State == 32 Then

Run(@SystemDir & "\taskmgr.exe", "", @SW_MINIMIZE)

Else

Run(@SystemDir & "\taskmgr.exe", "", @SW_RESTORE)

EndIf

EndIf

Exit

EndSwitch

WEnd

Func _RefreshSystemTray($nDelay = 1000) ; Not My Function

If @OSVersion = "WIN_VISTA" Or @OSVersion = "WIN_XP" Then $nPro = "1"

If $nPro <> "1" Then Return

; Save Opt settings

Opt("WinTitleMatchMode", 4)

Opt("WinSearchChildren", 1)

Local $error = 0

Do ;; Pseudo loop

Local $hWnd = WinGetHandle("classname=TrayNotifyWnd")

If @error Then

$error = 1

ExitLoop

EndIf

Local $hControl = ControlGetHandle($hWnd, "", "Button1")

; We're on XP and the Hide Inactive Icons button is there, so expand it

If $hControl <> "" And ControlCommand($hWnd, "", $hControl, "IsVisible") Then

ControlClick($hWnd, "", $hControl)

Sleep($nDelay)

EndIf

Local $posStart = MouseGetPos()

Local $posWin = WinGetPos($hWnd)

Local $y = $posWin[1]

While $y < $posWin[3] + $posWin[1]

Local $x = $posWin[0]

While $x < $posWin[2] + $posWin[0]

DllCall("user32.dll", "int", "SetCursorPos", "int", $x, "int", $y)

If @error Then

$error = 2

ExitLoop 3; Jump out of While/While/Do

EndIf

$x = $x + 8

WEnd

$y = $y + 8

WEnd

DllCall("user32.dll", "int", "SetCursorPos", "int", $posStart[0], "int", $posStart[1])

; We're on XP so we need to hide the inactive icons again.

If $hControl <> "" And ControlCommand($hWnd, "", $hControl, "IsVisible") Then

ControlClick($hWnd, "", $hControl)

EndIf

Until 1

SetError($error)

EndFunc ;==>_RefreshSystemTray

Func _ToolTip()

If @OSVersion == "WIN_XP" Then

GUICtrlSetTip(-1, " ZNote", "Developed By:-", 1, 2)

EndIf

If @OSVersion == "WIN_VISTA" Then

GUICtrlSetTip(-1, "ZNote", "Developed By:-", 1, 2)

EndIf

EndFunc ;==>_ToolTip

ENJOY!

:D

Edited by ZNote
Link to comment
Share on other sites

Works on x86, not sure of x64.

Sometimes when moving left or right selected process icon moves two

places, In such case restart the program. ( Due to explorer icons )

Cannot handle taskmgr.exe icon.

You may have to click buttons once or more due to explorer icons.

Temporary disable hide inactive icons for better viewing/moving

of tray icons.

Not that great program but will move your system tray icons without

closing any process.

Use This UDF -> SYS_TRAY.UDF ( http://www.autoitscript.com/forum/index.ph...st&id=18577 )

Code:-

ENJOY!

:D

Thanks! This should be useful!

Avian

A millihelen is the amount of beauty required to launch one ship.

Link to comment
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
 Share

  • Recently Browsing   0 members

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