问题描述
好的.我知道这是一个非常愚蠢的问题.但是我已经被困了一个小时了.
Ok. I know this is a very stupid question.But I'm stuck already for an hour.
我对ahk的使用经验很少,但是直到现在我都完成了每个脚本的工作,没有出现任何问题.我浏览了ahk教程,但到目前为止没有找到解决方案.
I got very little experience with ahk, however I made work every script until now with no problems. I explored the ahk tutorials but found no solution up to now.
我正尝试切换到上一个.单个数字键盘关闭键的应用程序.我尝试过:
I'm trying to switch to prev. app with a single numpad off key.I've tried:
!{Tab}
{Alt down}{Tab}{Alt up}
我已经尝试过使用睡眠延迟,多行,多行括号内的命令,并在命令后加/不加逗号等.
I've tried it with Sleep delays, multiline, multiline inside brackets, with and without commas after commands, etc.
我很确定这很简单,但是我还没有尝试过.
I'm quite sure is very simple but something I've not tried yet.
有什么建议吗?
推荐答案
$F1:: AltTab()
$F2:: AltTabMenu()
; AltTab-replacement for Windows 8:
AltTab(){
list := ""
WinGet, id, list
Loop, %id%
{
this_ID := id%A_Index%
IfWinActive, ahk_id %this_ID%
continue
WinGetTitle, title, ahk_id %this_ID%
If (title = "")
continue
If (!IsWindow(WinExist("ahk_id" . this_ID)))
continue
WinActivate, ahk_id %this_ID%, ,2
break
}
}
; AltTabMenu-replacement for Windows 8:
AltTabMenu(){
list := ""
Menu, windows, Add
Menu, windows, deleteAll
WinGet, id, list
Loop, %id%
{
this_ID := id%A_Index%
WinGetTitle, title, ahk_id %this_ID%
If (title = "")
continue
If (!IsWindow(WinExist("ahk_id" . this_ID)))
continue
Menu, windows, Add, %title%, ActivateTitle
WinGet, Path, ProcessPath, ahk_id %this_ID%
Try
Menu, windows, Icon, %title%, %Path%,, 0
Catch
Menu, windows, Icon, %title%, %A_WinDir%\System32\SHELL32.dll, 3, 0
}
CoordMode, Mouse, Screen
MouseMove, (0.4*A_ScreenWidth), (0.35*A_ScreenHeight)
CoordMode, Menu, Screen
Xm := (0.25*A_ScreenWidth)
Ym := (0.25*A_ScreenHeight)
Menu, windows, Show, %Xm%, %Ym%
}
ActivateTitle:
SetTitleMatchMode 3
WinActivate, %A_ThisMenuItem%
return
;-----------------------------------------------------------------
; Check whether the target window is activation target
;-----------------------------------------------------------------
IsWindow(hWnd){
WinGet, dwStyle, Style, ahk_id %hWnd%
if ((dwStyle&0x08000000) || !(dwStyle&0x10000000)) {
return false
}
WinGet, dwExStyle, ExStyle, ahk_id %hWnd%
if (dwExStyle & 0x00000080) {
return false
}
WinGetClass, szClass, ahk_id %hWnd%
if (szClass = "TApplication") {
return false
}
return true
}
编辑(由用户 确定 建议):
EDIT (suggested by the user Ooker):
该脚本会弹出一个菜单供您选择.
The script pops up a menu for you to choose.
这是它的样子:
这篇关于在Ahk中发送Alt + Tab的正确方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!