1

Тема: AHK: Изменить размер панели задач win7

Здравствуйте.
Суть в том, что после гибернации размер панели задач меняется на минимальный, приходится каждый раз её оттягивать на место мышкой, хотелось бы автоматизировать этот процесс.

Код.

WinMove, ahk_class Shell_TrayWnd ,, , , 300, 1050

Ничего не меняет. В чём проблема?

2

Re: AHK: Изменить размер панели задач win7

Так можно:

WinActivate, ahk_class Shell_TrayWnd
PostMessage, 0x112, 0xF000,,, ahk_class Shell_TrayWnd  ; SC_SIZE
ControlSend, , {up 4}{enter},ahk_class Shell_TrayWnd

Можно еще отлавливать выход из гибернации.
https://autohotkey.com/board/topic/199 … me-events/

3

Re: AHK: Изменить размер панели задач win7

Или так.
Думал вообще что по правильному получится, если изменить с помощью SystemParametersInfo рабочую область монитора, но и после этого WinMove не работает.

CoordMode Mouse
hWA := WinActive("A")
MouseGetPos mX, mY
WinGetPos, wX, wY, , , ahk_class Shell_TrayWnd ahk_exe explorer.exe
MouseClickDrag, Left, wX, wY, wX, wY-50, 0
MouseMove mX, mY, 0 
WinActivate, ahk_id %hWA%
Return
По вопросам возмездной помощи пишите на E-Mail: serzh82saratov@mail.ru Telegram: https://t.me/sergiol982
Win10x64 AhkSpy, Hotkey, ClockGui

4 (изменено: serzh82saratov, 2016-08-13 19:48:07)

Re: AHK: Изменить размер панели задач win7

Вообщем в любом из этих вариантов, надо чтобы само определяло где находится панель.


TaskBarMove(50)
Sleep 500
TaskBarMove(-50) 
Return

TaskBarMove(Seek) {
	S_CoordModeMouse := A_CoordModeMouse
	CoordMode, Mouse, Screen
	hWA := WinActive("A")
	MouseGetPos mX, mY
	WinGetPos, wX, wY, wW, wH, ahk_class Shell_TrayWnd ahk_exe explorer.exe
	SysGet, MonitorPrimary, MonitorPrimary
	SysGet, Mon, Monitor, %MonitorPrimary%
	fX := MonLeft - wX, fY := MonTop - wY 
	(fX = 0 && fY = 0 && wW > wH) ? (dX := wX + wW // 2, dY := wY + wH - 1, sX := dX, sY := dY + Seek)   ; UP
	: (fX = 0 && fY = 0) ? (dX := wX + wW - 1, dY := wY + wH // 2, sX := dX + Seek, sY := dY)   ; Left
	: (fX = 0) ? (dX := wX + wW // 2, dY := wY + 1, sX := dX, sY := dY - Seek)   ; Down
	: (dX := wX + 1, dY := wY + wH // 2, sX := dX - Seek, sY := dY)   ; Right
	
	MouseClickDrag, Left, dX, dY, sX, sY
	WinActivate, ahk_id %hWA%
	MouseMove mX, mY 
	CoordMode, Mouse, %S_CoordModeMouse%
}
По вопросам возмездной помощи пишите на E-Mail: serzh82saratov@mail.ru Telegram: https://t.me/sergiol982
Win10x64 AhkSpy, Hotkey, ClockGui

5 (изменено: Malcev, 2016-08-13 18:30:42)

Re: AHK: Изменить размер панели задач win7

У меня твой вариант так работает, иначе просто кликает на старт.

CoordMode Mouse
hWA := WinActive("A")
MouseGetPos mX, mY
WinGetPos, , wY, wX, , ahk_class Shell_TrayWnd 
WinActivate, ahk_class Shell_TrayWnd
MouseClickDrag, Left, wX, wY, wX, wY-50, 0
MouseMove mX, mY, 0 
WinActivate, ahk_id %hWA%
Return

6 (изменено: OmTatSat, 2016-08-13 19:41:42)

Re: AHK: Изменить размер панели задач win7

Всем спасибо за оперативную помощь, вот такой код полностью удовлетворяет мои нужды.
P.S. панель задач слева.

Sleep, 5000
WinActivate, ahk_class Shell_TrayWnd
WinGetPos,,, w, , ahk_class Shell_TrayWnd
;MsgBox, % w 
if w = 32
{
PostMessage, 0x112, 0xF000,,, ahk_class Shell_TrayWnd  ; SC_SIZE
ControlSend, , {right 30}{enter},ahk_class Shell_TrayWnd
}
return

Добавил в планировщик заданий, по этой инструкции http://admin.sait32.ru/lercontent.php?id=73 теперь при выходе из гибернации трей автоматом принимает норм размер, ещё раз всем спасибо!

7 (изменено: OmTatSat, 2018-03-12 19:10:37)

Re: AHK: Изменить размер панели задач win7

Усовершенствованная версия - быстрее и невидимая.

Sleep, 5000
    CoordMode, Mouse, Screen
    SystemCursor("Off")
    PostMessage, 0x112, 0xF000,,, ahk_class Shell_TrayWnd  ; SC_SIZE
    ControlSend, , {right},ahk_class Shell_TrayWnd
    MouseMove, 300, 500
    sleep, 100
    stop2:
    ControlSend, , {enter},ahk_class Shell_TrayWnd
    sleep, 100
    if (A_Cursor = "SizeWE")
    goto, stop2
    SystemCursor("On")
    return


; скрыть курсор
ShowCursor:
SystemCursor("On")
ExitApp

SystemCursor(OnOff=1)   ; INIT = "I","Init"; OFF = 0,"Off"; TOGGLE = -1,"T","Toggle"; ON = others
{
    static AndMask, XorMask, $, h_cursor
        ,c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13 ; system cursors
        , b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13   ; blank cursors
        , h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,h12,h13   ; handles of default cursors
    if (OnOff = "Init" or OnOff = "I" or $ = "")       ; init when requested or at first call
    {
        $ = h                                          ; active default cursors
        VarSetCapacity( h_cursor,4444, 1 )
        VarSetCapacity( AndMask, 32*4, 0xFF )
        VarSetCapacity( XorMask, 32*4, 0 )
        system_cursors = 32512,32513,32514,32515,32516,32642,32643,32644,32645,32646,32648,32649,32650
        StringSplit c, system_cursors, `,
        Loop %c0%
        {
            h_cursor   := DllCall( "LoadCursor", "uint",0, "uint",c%A_Index% )
            h%A_Index% := DllCall( "CopyImage",  "uint",h_cursor, "uint",2, "int",0, "int",0, "uint",0 )
            b%A_Index% := DllCall("CreateCursor","uint",0, "int",0, "int",0
                , "int",32, "int",32, "uint",&AndMask, "uint",&XorMask )
        }
    }
    if (OnOff = 0 or OnOff = "Off" or $ = "h" and (OnOff < 0 or OnOff = "Toggle" or OnOff = "T"))
        $ = b  ; use blank cursors
    else
        $ = h  ; use the saved cursors

    Loop %c0%
    {
        h_cursor := DllCall( "CopyImage", "uint",%$%%A_Index%, "uint",2, "int",0, "int",0, "uint",0 )
        DllCall( "SetSystemCursor", "uint",h_cursor, "uint",c%A_Index% )
    }
}

8

Re: AHK: Изменить размер панели задач win7

По зажатию F5.

f5::
Sleep, 200 ; пауза
If GetKeyState("f5","P") = 0 ; отслеживаем состояние - если кнопка отпущена
  Sendplay, {f5} ; выполняем обычное действие
else ; в противном случае, то есть если после паузы клавиша в нажатом состоянии
  { ;, клавиша %A_ThisHotkey% нажата по истечении заданного периода ; само действие
    CoordMode, Mouse, Screen
    SystemCursor("Off")
    PostMessage, 0x112, 0xF000,,, ahk_class Shell_TrayWnd  ; SC_SIZE
    ControlSend, , {right},ahk_class Shell_TrayWnd
    MouseMove, 300, 500
    sleep, 100
    stop2:
    ControlSend, , {enter},ahk_class Shell_TrayWnd
    sleep, 100
    if (A_Cursor = "SizeWE")
    goto, stop2
    SystemCursor("On")
    return
}
Return

; скрыть курсор
ShowCursor:
SystemCursor("On")
ExitApp

SystemCursor(OnOff=1)   ; INIT = "I","Init"; OFF = 0,"Off"; TOGGLE = -1,"T","Toggle"; ON = others
{
    static AndMask, XorMask, $, h_cursor
        ,c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13 ; system cursors
        , b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13   ; blank cursors
        , h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,h12,h13   ; handles of default cursors
    if (OnOff = "Init" or OnOff = "I" or $ = "")       ; init when requested or at first call
    {
        $ = h                                          ; active default cursors
        VarSetCapacity( h_cursor,4444, 1 )
        VarSetCapacity( AndMask, 32*4, 0xFF )
        VarSetCapacity( XorMask, 32*4, 0 )
        system_cursors = 32512,32513,32514,32515,32516,32642,32643,32644,32645,32646,32648,32649,32650
        StringSplit c, system_cursors, `,
        Loop %c0%
        {
            h_cursor   := DllCall( "LoadCursor", "uint",0, "uint",c%A_Index% )
            h%A_Index% := DllCall( "CopyImage",  "uint",h_cursor, "uint",2, "int",0, "int",0, "uint",0 )
            b%A_Index% := DllCall("CreateCursor","uint",0, "int",0, "int",0
                , "int",32, "int",32, "uint",&AndMask, "uint",&XorMask )
        }
    }
    if (OnOff = 0 or OnOff = "Off" or $ = "h" and (OnOff < 0 or OnOff = "Toggle" or OnOff = "T"))
        $ = b  ; use blank cursors
    else
        $ = h  ; use the saved cursors

    Loop %c0%
    {
        h_cursor := DllCall( "CopyImage", "uint",%$%%A_Index%, "uint",2, "int",0, "int",0, "uint",0 )
        DllCall( "SetSystemCursor", "uint",h_cursor, "uint",c%A_Index% )
    }
}