Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

MouseGestureL


  • Please log in to reply
136 replies to this topic
Baal
  • Members
  • 81 posts
  • Last active: Apr 15 2016 04:38 PM
  • Joined: 04 Jun 2014

Nice GEV! Good find on superuser.com that one actually shows menu. Thanks. :D

 

But there is one problem. My previous AltTab was set to Xbutton1 & Wheel combo. So i could use wheel to select window and release Xbutton1 to activate with this script, i can't archive this. Maybe you could help?

; SHIFT+ALT+TAB menu

F2::
List =
Menu, windows, Add
Menu, windows, deleteAll
WinGet, AllWinsHwnd, List
Loop, %AllWinsHwnd%
{
WinGet, exStyle, exStyle, % "ahk_id" AllWinsHwnd%A_Index%
If !(exStyle & 0x100)
  Continue
WinGetTitle, CurrentWinTitle, % "ahk_id " AllWinsHwnd%A_Index%
WinGetClass, CurrentWinClass, % "ahk_id " AllWinsHwnd%A_Index%
If CurrentWinClass = ApplicationFrameWindow
  Continue
Menu, windows, Add, %CurrentWinTitle%%A_Tab%ahk_class %CurrentWinClass%, WinTitle
WinGet, Path, ProcessPath , % "ahk_id " AllWinsHwnd%A_Index%
Menu, windows, Icon, %CurrentWinTitle%%A_Tab%ahk_class %CurrentWinClass%, %Path%
}
Menu, windows, Show
return


WinTitle:
WinActivate, %A_ThisMenuItem%
GoSub, MouseCenterInWindow
return


MouseCenterInWindow:
CoordMode, Mouse, Relative
WinGetPos,,,Xmax,Ymax,A ; get active window size
Xcenter := Xmax/2        ; Calculate center of active window
Ycenter := Ymax/2
MouseMove, Xcenter, Ycenter
return


GEV
  • Members
  • 1364 posts
  • Last active:
  • Joined: 23 Oct 2013

Sth like this:

#NoEnv
#SingleInstance Force
#InstallMouseHook
#UseHook
Process, Priority, , High

SetTitleMatchMode, 2

DetectHiddenWindows, ON


; Press twice Xbutton1 
; and höld it to show the menu 
; or release it to send Alt+Tab

$Xbutton1::
If (A_PriorHotKey = "$Xbutton1 Up" AND A_TimeSincePriorHotkey < 500)
{
 KeyWait, Xbutton1, T.3
 If ErrorLevel 
  Run %A_ScriptDir%\MenuWindows.ahk
 else		
  GoSub,AltTab
}
return

$Xbutton1 Up:: Send, {Xbutton1 Up}


#IfWinActive MenuWindows.ahk

WheelUp::
Send, {Up}
return

WheelDown::
Send, {Down}
return

Xbutton1 Up::
Send, {Enter}
return

#IfWinActive

AltTab:
List =
WinGet, AllWinsHwnd, List
Loop, % AllWinsHwnd
{
WinGet, exStyle, exStyle, % "ahk_id" AllWinsHwnd%A_Index%
If !(exStyle & 0x100)
  Continue
WinGetTitle, CurrentWinTitle, % "ahk_id " AllWinsHwnd%A_Index%
WinGetTitle, active_title, A
If CurrentWinTitle = %active_title%
  continue
WinActivate, %CurrentWinTitle%
GoSub, MouseCenterInWindow
  break
}
return