我想在程序打开后立即按下F11键,而不必按任何热键等,基本上是自动按键启动。这是我的代码:
; This section fullscreens XENIA on Play
#SingleInstance, Force
numpad0::
IfWinExist, ahk_class XeniaWindowClass ahk_exe xenia.exe
{
WinActivate, ahk_class XeniaWindowClass
#IfWinActive, ahk_class XeniaWindowClass
{
Send, {F11}
}
}
return
任何帮助,谢谢!
答案 0 :(得分:0)
哦,我明白了。那你就是这样做的。您运行该功能,您也可以通过按numpad0
来调用它(但是,您必须在运行程序后启动此脚本,或者在上一篇文章中查看我的答案):
; This section fullscreens XENIA on Play
#Persistent
#SingleInstance, Force
GoSub, DoIt
return
numpad0::
GoSub, DoIt
return
DoIt:
IfWinExist, ahk_class XeniaWindowClass ahk_exe xenia.exe
{
WinActivate, ahk_class XeniaWindowClass
#IfWinActive, ahk_class XeniaWindowClass
{
Send, {F11}
}
}
return
Hth,lmk。 。
答案 1 :(得分:0)
也许是这样的?
#Persistent
SetTimer, XeniaWatcher
XeniaWatcher() {
WinWaitActive, ahk_class XeniaWindowClass
Send, {F11}
WinWaitNotActive, ahk_class XeniaWindowClass
}
还是这个?
#Persistent
SetTimer, XeniaWatcher
XeniaWatcher() {
WinWaitActive, ahk_class XeniaWindowClass
Send, {F11}
WinWaitClose, ahk_class XeniaWindowClass
}
答案 2 :(得分:0)
; This section fullscreens XENIA on Play
#SingleInstance, Force
SetInterval, check, 200 ; check every 200ms
sentB4:=0
check:
If ( (WinExist("ahk_class XeniaWindowClass")) && (WinExist("ahk_exe xenia.exe")) ) {
If (sentB4 == 0) {
WinActivate, ahk_class XeniaWindowClass
If ( WinActive("ahk_class XeniaWindowClass") ) {
send, {F11} ; send desired key (fullscreen in this case)
sentB4:=1 ; update status
}
}
} else {
sentB4:=0 ; reset status
}
return
我更新了您过时的IfWinExist函数,因为它们已被弃用,请阅读注释以获取更多信息
numpad0::
gosub, check
return
还要添加它以进行手动触发...