I am trying to make a script which can help me to reorder position of 5 apps, if the apps are opened.
I want to have this order always, on the taskbar:
1. total commander
2. firefox
3. outlook
4. whatsapp
5. teamviewer
All good if all the apps are opened, but what if some of the apps are not opened, how the script will know which is opened and which is not, then... how to give the proper position of some of the apps, if the other are not opened, withtout making an 10.000 lines script of IFs
Here is where I got stuck
Code: Select all
CoordMode Pixel, Screen
CoordMode Mouse, Screen
Gui +LastFound
hWnd := WinExist()
DllCall( "RegisterShellHookWindow", UInt,Hwnd )
MsgNum := DllCall( "RegisterWindowMessage", Str,"SHELLHOOK" )
OnMessage( MsgNum, "ShellMessage" )
Return
first := 100
second := 270
third := 430
forth := 600
fifth := 750
ShellMessage( wParam,lParam )
{
If(wParam = 4 OR wParam = 32772)
{
pos1 := 0
pos2 := 0
pos3 := 0
pos4 := 0
pos5 := 0
low := 0
high := 0
if WinExist("ahk_class TTOTAL_CMD") && WinExist("ahk_exe TOTALCMD64.EXE")
pos1 := 1
if WinExist("ahk_class MozillaWindowClass") && WinExist("ahk_exe firefox.exe")
pos2 := 1
if WinExist("ahk_class rctrl_renwnd32") && WinExist("ahk_exe OUTLOOK.EXE")
pos3 := 1
if WinExist("ahk_class Chrome_WidgetWin_1") && WinExist("ahk_exe WhatsApp.exe")
pos4 := 1
if WinExist("ahk_class MainWindowFull") && WinExist("ahk_exe TeamViewer.exe")
pos5 := 1
order = %pos1%%pos2%%pos3%%pos4%%pos5%
if order = 10000
{
total := %first%
low := 50
high := 100
}
ImageSearch, x, y, 50, 1399, 1774, 1439, c:\Programe Instalate\TotalCommander.png
if x not between %low% and %high%
{
BlockInput, MouseMove
MouseGetPos, xnow, ynow
MouseClickDrag, left, %x%, %y%, %total%, %y%, 0
MouseMove, xnow, ynow, 0
BlockInput, MouseMoveOff
}
ImageSearch, x, y, 50, 1399, 1774, 1439, c:\Programe Instalate\Firefox.png
if x not between 215 and 250
{
BlockInput, MouseMove
MouseGetPos, xnow, ynow
MouseClickDrag, left, %x%, %y%, %fire%, %y%, 0
MouseMove, xnow, ynow, 0
BlockInput, MouseMoveOff
}
ImageSearch, x, y, 50, 1399, 1774, 1439, c:\Programe Instalate\Outlook.png
if x not between 280 and 410
{
BlockInput, MouseMove
MouseGetPos, xnow, ynow
MouseClickDrag, left, %x%, %y%, %out%, %y%, 0
MouseMove, xnow, ynow, 0
BlockInput, MouseMoveOff
}
ImageSearch, x, y, 50, 1399, 1774, 1439, c:\Programe Instalate\Whatsapp.png
if x not between 535 and 570
{
BlockInput, MouseMove
MouseGetPos, xnow, ynow
MouseClickDrag, left, %x%, %y%, %what%, %y%, 0
MouseMove, xnow, ynow, 0
BlockInput, MouseMoveOff
}
ImageSearch, x, y, 50, 1399, 1774, 1439, c:\Programe Instalate\TeamViewer.png
if x not between 695 and 735
{
BlockInput, MouseMove
MouseGetPos, xnow, ynow
MouseClickDrag, left, %x%, %y%, %team%, %y%, 0
MouseMove, xnow, ynow, 0
BlockInput, MouseMoveOff
}
}
}
Any idea how to make this automation?
Thank you in advance