1 (изменено: morgan, 2020-05-15 14:29:07)

Тема: AHK: Индикатор прогресса на панели задач

Привет, всем. Хочу реализовать в скрипте вот эту вещь.
https://i.imgur.com/Rd67iiz.png

Нашел статью на Хабре: https://habr.com/ru/post/68867 (надеюсь за ссылки тут не забанят).
Интересует, возможно ли это реализовать на AHK?

2 (изменено: serzh82saratov, 2020-05-15 15:29:52)

Re: AHK: Индикатор прогресса на панели задач

https://autohotkey.com/board/topic/9786 … in-window/

#SingleInstance Force
#Persistent 
 

Gui, Font, s15
Gui, Add, Text,, % "This GUI should show a progress bar on its taskbar button.`n"
                 . "It will demonstrate the four different progress states:`n"
                 . "(N)ormal, (P)aused, (E)rror and (I)ndeterminate."
Gui, Show        ; Show the window and taskbar button.
Gui, +LastFound  ; SetTaskbarProgress will use this window.
; WinExist("ahk_class CabinetWClass")
Sleep 200
Loop
{
    progress_states=NPE
    Loop, Parse, progress_states
    {
        SetTaskbarProgress(0, A_LoopField)
        Loop 50 {
            SetTaskbarProgress(A_Index*2)
            Sleep 50
        }
        Sleep 1000
        Loop 50 {
            SetTaskbarProgress(100-A_Index*2)
            Sleep 50
        }
        SetTaskbarProgress(0)
        Sleep 1000
    }
    SetTaskbarProgress("I")
    Sleep 4000
}

; SetTaskbarProgress  -  Requires Windows 7.
;
; pct    -  A number between 0 and 100 or a state value (see below).
; state  -  "N" (normal), "P" (paused), "E" (error) or "I" (indeterminate).
;           If omitted (and pct is a number), the state is not changed.
; hwnd   -  The ID of the window which owns the taskbar button.
;           If omitted, the Last Found Window is used.
;

SetTaskbarProgress(pct, state="", hwnd="")
{
    static tbl, s0:=0, sI:=1, sN:=2, sE:=4, sP:=8
    if !tbl 
		tbl := ComObjCreate("{56FDF344-FD6D-11d0-958A-006097C9A090}", "{ea1afb91-9e28-4b86-90e9-9e9f8a5eefaf}")  
    if hwnd =
        hwnd := WinExist()
    if pct is not number
        state := pct, pct := ""
    else if (pct = 0 && state="")
        state := 0, pct := ""
    if state in 0,I,N,E,P   ; ITaskbarList3::SetProgressState
        DllCall(NumGet(NumGet(tbl+0)+10*A_PtrSize), "ptr", tbl, "ptr", hwnd, "uint", s%state%)
    if pct !=               ; ITaskbarList3::SetProgressValue
        DllCall(NumGet(NumGet(tbl+0)+9*A_PtrSize), "ptr", tbl, "ptr", hwnd, "int64", pct*10, "int64", 1000)
}
По вопросам возмездной помощи пишите на E-Mail: serzh82saratov@mail.ru Telegram: https://t.me/sergiol982
Win10x64 AhkSpy, Hotkey, ClockGui

3

Re: AHK: Индикатор прогресса на панели задач

В классической теме не работает. Но наверное можно надпись на кнопке заменить на "XX %".