AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

AltTab and commands

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Link68759
Guest





PostPosted: Thu Aug 14, 2008 2:48 pm    Post subject: AltTab and commands Reply with quote

At first, I made a script which uses the mousewheel and my side button to scroll through the windows in alt tab. Then, I decided to make the windows accessed through the script centered automatically, and return them to their first location when they aren't the active window.

My only issue is, I can't seem to have the Alt tab and extra script attach to one key combo.

Code:
XButton1 & WheelUp::
Send +{Alt down}{Tab}
Loop
{
GetKeyState, state, XButton1, P
If state = U
break
}
Send {Alt up}
WinGetActiveTitle, WinTitle
WinGetPos,x,y, Width, Height, %WinTitle%
WinMove, %WinTitle%,, (A_ScreenWidth/2)-(Width/2), (A_ScreenHeight/2)-(Height/2)
WinWaitNotActive, %WinTitle%
WinMove, %WinTitle%,,x,y
return
 
XButton1 & WheelDown::
Send {Alt down}{Tab}
Loop
{
GetKeyState, state, XButton1, P
If state = U
break
}
Send {Alt up}
WinGetActiveTitle, WinTitle
WinGetPos,x,y, Width, Height, %WinTitle%
WinMove, %WinTitle%,, (A_ScreenWidth/2)-(Width/2), (A_ScreenHeight/2)-(Height/2)
WinWaitNotActive, %WinTitle%
WinMove, %WinTitle%,,x,y
return


I think this script is buggy because it doesn't want to send alt down more than once. Would there be a way to assign the wheel and xbutton to AltTab, then have it execute script whenever the hotkey is executed? (preferably after the xbutton1 is lifted). When I tried

Code:
XButton1 & WheelUp::
ShiftAltTab
etc


it said that ShiftAltTab was not a command.
Back to top
Razlin



Joined: 05 Nov 2007
Posts: 454
Location: canada

PostPosted: Thu Aug 14, 2008 5:13 pm    Post subject: Reply with quote

Code:
XButton1 & WheelUp::
send ShiftAltTab
etc


you cant "send alt tab" or send {alt} {tab}
read documentation on "alttab"

anyhow.. my fix above should solve your problem.
_________________
-=Raz=-
Back to top
View user's profile Send private message
Link68759
Guest





PostPosted: Thu Aug 14, 2008 5:16 pm    Post subject: Reply with quote

tried that, and just now. it sends the text AltTab.
Back to top
Red Hat Boy



Joined: 10 Apr 2008
Posts: 111

PostPosted: Thu Aug 14, 2008 5:26 pm    Post subject: Reply with quote

You could have replaced
Code:
Loop
{
GetKeyState, state, XButton1, P
If state = U
break
}
with
Code:
KeyWait, XButton1
but it seems that if whatever XButton1 & WheelUp is assigned to has stopped it, it won't execute again.

Anyway, try this:
Code:
*$WheelUp::
GetKeyState, state, XButton1, p
if state = D
{
   if ActiveMode != 2
      {
      if ActiveMode = 1
         Send, {Shift down}{Tab}
      else
         Send {Shift down}{Alt down}{Tab}
      ActiveMode = 2
      }
   else
      Send, {Tab}
}
else
   Send, {WheelUp}
;
return

*$WheelDown::
GetKeyState, state, XButton1, p
if state = D
{
   if ActiveMode != 1
      {
      if ActiveMode = 2
         Send {Shift up}{Tab}
      else
         Send {Alt down}{Tab}
      ActiveMode = 1
      }
   else
      Send, {Tab}
}
else
   Send, {WheelDown}
;
return


~*$XButton1 up::
if ActiveMode
   {
   if ActiveMode = 2
      Send {Shift up}
   Send {Alt up}
   WinGetActiveTitle, WinTitle
   WinGetPos,x,y, Width, Height, %WinTitle%
   WinMove, %WinTitle%,, (A_ScreenWidth/2)-(Width/2), (A_ScreenHeight/2)-(Height/2)
   SetTimer, MoveWindow, -1
   ActiveMode = 0
   }
return

MoveWindow:
WinTitlePrev = %WinTitle%
xPrev = %x%
yPrev = %y%
WinWaitNotActive, %WinTitlePrev%
WinMove, %WinTitlePrev%,,xPrev,yPrev
return

I dont' have an XButton1, so I replaced it with x, and it worked...but it was also constantly typing xxxxxxxxxxxxxxxxxxxxxx... Rolling Eyes
_________________
I slit the sheet, the sheet I slit,
and on the slitted sheet I sit. ;~}
Back to top
View user's profile Send private message Send e-mail
Link68759
Guest





PostPosted: Thu Aug 14, 2008 6:40 pm    Post subject: Reply with quote

perfect! thanks. I don't seem to have the repeating error- xbutton1 functions normally as a browser/explorer back button by itself, and scrolls through the tabbing with the windows moving about correctly.

thanks again

-Link
Back to top
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group