OK. Ich weiß, das ist eine sehr blöde Frage ... Aber ich bin schon eine Stunde fest.
Ich habe sehr wenig Erfahrung mit ahk, aber ich habe bis jetzt jedes Skript ohne Probleme bearbeitet. Ich habe die ahk-Tutorials erforscht, aber bisher keine Lösung gefunden.
Ich versuche, zu prev zu wechseln. App mit einem einzigen Nummernblock aus .. .. Ich habe versucht:
!{Tab}
.
{Alt down}{Tab}{Alt up}
Ich habe es mit Schlafverzögerungen, Multilinien, Multilinien in Klammern, mit und ohne Kommas nach Befehlen usw. versucht.
Ich bin mir ziemlich sicher, ist sehr einfach, aber ich habe es noch nicht ausprobiert.
Irgendein Vorschlag?
$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 (vorgeschlagen vom Benutzer Ooker):
Das Skript zeigt ein Menü zur Auswahl an.
So sieht es aus:
Sie sollten alt + tab nicht manuell senden, da es sich um einen speziellen Windows-Befehl handelt. Verwenden Sie stattdessen die AltTab-Befehle , die das für Sie tun.
AltTabMenu
öffnet das Tab-Menü und wählt das Programm aus, währendAltTab
, ShiftAltTab
durch dieses navigiert.
h::AltTabMenu
n::AltTab
m::ShiftAltTab
Wenn Sie nur zur vorherigen Anwendung zurückkehren möchten, verwenden Sie Senden,! {Esc}.
Es gibt einige Probleme mit Windows 8/10 und Tasten wie ctrl-alt-del und alt-tab. Hier ist eine Lösung:
F1::
{
Send {Alt Down}{Tab} ;Bring up switcher immediately
KeyWait, F1, T.5 ; Go to next window; wait .5s before looping
if (Errorlevel)
{
While ( GetKeyState( "F1","P" ) ) {
Send {Tab}
Sleep, 400 ; wait 400ms before going to next window
}
}
Send {Alt Up} ;Close switcher on hotkey release
}
return
Nun, endlich fand ich den Grund und einige "Lösungen" hier und hier . Es scheint, dass Windows 8 Ahk {Alt Down} {Tab} und AltTabMenu und einige andere Tasten blockiert.
Im Moment verwende ich dies, um Fenster vorwärts zu scrollen:
Send !{ESC}
So zeigen Sie das AltTabMenu an:
Run, "C:\Users\Default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\Window Switcher.lnk"
Und dies, um zur vorherigen App zu wechseln, wie in einem der Themen vorgeschlagen:
LCtrl & z:: ; AltTabMenu
state := GetKeyState("Capslock", "T")
if state = 1
SetCapsLockState, Off ; CapsLock On blocks Task Switching metro window
Send, !{Tab} ; prevents displaying inactive Task Switching metro window
run, Window Switcher.lnk ; must be in script directory otherwise include path
WinWait, Task Switching,, 2
KeyWait, Ctrl
Send, {Enter}
if state = 1
SetCapsLockState, On ; restores CapsLock State
state =
return
#IfWinActive, Task Switching
LCtrl & q::Send, {Right}
LCtrl & a::Send, {Left}
Es wäre schön, wenn Sie zur vorherigen App ohne AltTabMenu-Splash gelangen würden.
Arbeitete für mich:
F1::
Send, {ALT DOWN}{TAB}{ALT UP}
return
Es simuliert das Alt + Tab-Verhalten für die F1-Taste.
Mit! {Tab} können Sie zwischen den Fenstern wechseln, wenn Sie vorher und nachher den Ruhezustand aktivieren.
send {Alt down}{tab}
send {Alt up}
Wenn Sie mehrere "Tabs" ausführen möchten, sollte die folgende Funktion hilfreich sein. Dies war zumindest eine eigene Lösung auf meinem Windows 8.1-Computer.
Der Ansatz ist:
AutoHotKey-Codebeispiel unten:
; Test switch of 1 window
F1::AltTabFunction(offset:=1)
; Test switch of 2 windows
F2::AltTabFunction(offset:=2)
AltTabFunction(offset:=1)
{
; ****************************
; Function for switching windows by ALT-TAB (offset = number of windows to "tab")
; ****************************
; Get list of all windows.
WinGet, AllWinsHwnd, List
WinGetTitle, active_title, A ; Get title of active window.
; Find index of the current window.
counter_of_none_hidden_windows := 0 ; Initiate counter for counting only the none-hidden windows.
Loop, % AllWinsHwnd
{
; Find title for window in this loop.
WinGetTitle, CurrentWinTitle, % "ahk_id " AllWinsHwnd%A_Index%
; From [1]: "Retrieves an 8-digit hexadecimal number representing the extended style of a window.".
; [1] : https://autohotkey.com/docs/commands/WinGet.htm
WinGet, exStyle, exStyle, % "ahk_id" AllWinsHwnd%A_Index%
; Skip hidden windows by checking exStyle.
If !(exStyle & 0x100){
Continue
}
; Window is not hidden. Increase counter.
counter_of_none_hidden_windows := counter_of_none_hidden_windows+1
; Set flag.
titles_match := CurrentWinTitle = active_title
If (titles_match) {
window_index_to_switch_to := counter_of_none_hidden_windows+offset
break
}
}
; Find index of the window to switch to and do the actual switch
counter_of_none_hidden_windows := 0 ; Initiate counter for counting only the none-hidden windows.
Loop, % AllWinsHwnd
{
; From [1]: "Retrieves an 8-digit hexadecimal number representing the extended style of a window.".
; [1] : https://autohotkey.com/docs/commands/WinGet.htm
WinGet, exStyle, exStyle, % "ahk_id" AllWinsHwnd%A_Index%
; Skip hidden windows by checking exStyle.
If !(exStyle & 0x100){
Continue
}
; Window is not hidden. Increase counter.
counter_of_none_hidden_windows := counter_of_none_hidden_windows+1
; Set flag.
found_window_to_switch_to := counter_of_none_hidden_windows = window_index_to_switch_to
; Switch window.
If (found_window_to_switch_to) {
; Get title.
WinGetTitle, CurrentWinTitle, % "ahk_id " AllWinsHwnd%A_Index%
; Activate by title.
WinActivate, %CurrentWinTitle%
; Stop loop.
break
}
}
return ; Nothing to return
}