1 (изменено: Makarov, 2021-04-28 18:04:03)

Тема: AHK: Зажатие клавиш в свернутом окне.

В ахк есть такая команда, как "ControlSend" при помощи нее я отправлял в определенное, свернутое окно команды не влияя на основное окно.
После при написании скрипта я наткнулся на проблему с зажатием клавиш в ControlSend. Так и не нашел ответа.
Если находится в окне то клавиша после повтора действий зажимается и нормально работает
Но если находится в свернутом режиме то после повтора клавиша не зажимается.

#SingleInstance, force
#IfWinActive, ahk_exe javaw.exe
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
DetectHiddenWindows, On
SetTitleMatchMode, 2
Gui,1:+AlwaysOnTop
Gui, Add, Edit, x12 y60 w120 h20 vPressAD gTime_all,
Gui, Add, Edit, x12 y90 w120 h20 vPressW gTime_all,
Gui, Add, Edit, x12 y120 w120 h20 vClick1 gTime_all,
Gui, Add, Text, x142 y60 w100 h25 , How long you press A and D
Gui, Add, Text, x142 y90 w100 h25 , How long you press W
Gui, Add, Text, x142 y120 w100 h25 , Chang click to
Gui, Add, Text, x12 y10 w610 h20 , Maddy's SB Scripts
Gui, Add, Text, x12 y30 w610 h20 , Made by gothboyrommy#4956/Kartavich#3891
Gui, Add, Text, x12 y170 w170 h25 , Press F8 for auto walk and auto click
Gui, Add, Text, x228 y180 w170 h25 , V2.56
Gui, Show, w260 h200, Auto Farm
clipboard := "my text"
clipboard := ""
clipboard := clipboard
clipboard := clipboard "https://discord.gg/uthcvXw9Pb"
StringReplace, clipboard, clipboard, ABC, DEF, All
Sleep 300
HideTrayTip()
TrayTip Maddy's Money Maker, V2.56
sleep 5000
TrayTip Maddy's Money Maker, Thank you for using me <3
sleep 5000
TrayTip Maddy's Money Maker, My discord sever is copied to your clipboard
HideTrayTip() {
TrayTip
if SubStr(A_OSVersion,1,3) = "10." {
Menu Tray, NoIcon
Sleep 200
Menu Tray, Icon
}
}
return
GuiClose:
ExitApp
Time_all:
Gui, Submit, NoHide
F8::
Loop
{
SetKeyDelay, 0, 50
sleep, 500
ControlSend, , t, ahk_pid 15000
Sleep, 30
ControlSend, , /, ahk_pid 15000
Sleep, 30
ControlSend, , i, ahk_pid 15000
Sleep, 30
ControlSend, , s, ahk_pid 15000
sleep, 30
ControlSend, , {enter}, ahk_pid 15000
Sleep, 100
ControlSend, , t, ahk_pid 15000
Sleep, 30
ControlSend, , /, ahk_pid 15000
Sleep, 30
ControlSend, , s, ahk_pid 15000
Sleep, 30
ControlSend, , e, ahk_pid 15000
Sleep, 30
ControlSend, , t, ahk_pid 15000
Sleep, 30
ControlSend, , h, ahk_pid 15000
Sleep, 30
ControlSend, , o, ahk_pid 15000
Sleep, 30
ControlSend, , m, ahk_pid 15000
Sleep, 30
ControlSend, , e, ahk_pid 15000
sleep, 30
ControlSend, , {enter}, ahk_pid 15000
Sleep, 100
ControlSend, , t, ahk_pid 15000
Sleep, 30
ControlSend, , /, ahk_pid 15000
Sleep, 30
ControlSend, , s, ahk_pid 15000
Sleep, 30
ControlSend, , k, ahk_pid 15000
Sleep, 30
ControlSend, , y, ahk_pid 15000
Sleep, 30
ControlSend, , b, ahk_pid 15000
Sleep, 30
ControlSend, , l, ahk_pid 15000
Sleep, 30
ControlSend, , o, ahk_pid 15000
Sleep, 30
ControlSend, , c, ahk_pid 15000
sleep, 30
ControlSend, , k, ahk_pid 15000
sleep, 30
ControlSend, , {enter}, ahk_pid 15000
sleep, 100
ControlSend, , /, ahk_pid 15000
sleep, 30
ControlSend, , i, ahk_pid 15000
sleep, 30
ControlSend, , s, ahk_pid 15000
sleep, 30
ControlSend, , {enter}, ahk_pid 15000
sleep, 3000
SetKeyDelay, 0, 50
ControlSend,, {%Click1% down}, ahk_pid 15000
sleep 100
ControlSend,, {w down}, ahk_pid 15000
sleep %PressW%
ControlSend,, {w up}, ahk_pid 15000
sleep 100
ControlSend,, {a down}, ahk_pid 15000
sleep, %PressAD%
ControlSend,, {a up}, ahk_pid 15000
sleep 100
ControlSend,, {Space Down}, ahk_pid 15000
sleep, 1500
ControlSend,, {Space Up}, ahk_pid 15000
sleep, 100
ControlSend,, {w down}, ahk_pid 15000
sleep %PressW%
ControlSend,, {w up}, ahk_pid 15000
sleep 100
ControlSend,, {d down}, ahk_pid 15000
sleep, %PressAD%
ControlSend,, {d up}, ahk_pid 15000
sleep 100
ControlSend,, {Space Down}, ahk_pid 15000
sleep, 1500
ControlSend,, {Space Up}, ahk_pid 15000
sleep, 100
ControlSend,, {%Click1% up}, ahk_pid 15000
sleep 100
ControlSend,, {%Click1% down}, ahk_pid 15000
sleep 100
ControlSend,, {w down}, ahk_pid 15000
sleep %PressW%
ControlSend,, {w up}, ahk_pid 15000
sleep 100
ControlSend,, {a down}, ahk_pid 15000
sleep, %PressAD%
ControlSend,, {a up}, ahk_pid 15000
sleep 100
ControlSend,, {Space Down}, ahk_pid 15000
sleep, 1500
ControlSend,, {Space Up}, ahk_pid 15000
sleep, 100
ControlSend,, {w down}, ahk_pid 15000
sleep %PressW%
ControlSend,, {w up}, ahk_pid 15000
sleep 100
ControlSend,, {d down}, ahk_pid 15000
sleep, %PressAD%
ControlSend,, {d up}, ahk_pid 15000
sleep 100
ControlSend,, {Space Down}, ahk_pid 15000
sleep, 1500
ControlSend,, {Space Up}, ahk_pid 15000
sleep, 100
ControlSend,, {%Click1% up}, ahk_pid 15000
sleep 100
ControlSend,, {%Click1% down}, ahk_pid 15000
sleep 100
ControlSend,, {s down}, ahk_pid 15000
sleep 500
ControlSend,, {s up}, ahk_pid 15000
sleep 100
ControlSend,, {a down}, ahk_pid 15000
sleep 500
ControlSend,, {a up}, ahk_pid 15000
sleep 100
ControlSend,, {d down}, ahk_pid 15000
sleep 500
ControlSend,, {d up}, ahk_pid 15000
sleep 100
ControlSend,, {s down}, ahk_pid 15000
sleep 500
ControlSend,, {s up}, ahk_pid 15000
sleep 100
ControlSend,, {d down}, ahk_pid 15000
sleep 500
ControlSend,, {d up}, ahk_pid 15000
sleep 100
ControlSend,, {%Click1% up}, ahk_pid 15000
sleep 100
}
Return
F12::ExitApp

2

Re: AHK: Зажатие клавиш в свернутом окне.

Код оформляется тегом 'code'.

Win10x64, AHK v1.1.33.09 (Unicode 64-bit) | AHK-Wiki | Переменные и выражения | RegEx101