Jump to content

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

Auto ALT+TAB every 30 minutes?


  • Please log in to reply
11 replies to this topic
dexter74
  • Members
  • 2 posts
  • Last active: Jun 14 2007 03:28 PM
  • Joined: 14 Jun 2007
I want to make a script, which every 30 minutes change active window (ALT+TAB).

How I can do that?

TheIrishThug
  • Members
  • 419 posts
  • Last active: Jan 18 2012 02:51 PM
  • Joined: 19 Mar 2006
SetTimer

Causes a subroutine to be launched automatically and repeatedly at a specified time interval.



dexter74
  • Members
  • 2 posts
  • Last active: Jun 14 2007 03:28 PM
  • Joined: 14 Jun 2007

SetTimer

Causes a subroutine to be launched automatically and repeatedly at a specified time interval.


Thank, but still don't know how should looks like whole script....

I made something like this:

Loop 100
{
WinWait, Program Manager,
IfWinNotActive, Program Manager, , WinActivate, Program Manager,
WinWaitActive, Program Manager,
Send, {ALTDOWN}{TAB}{TAB}{ALTUP}
Sleep 1800000 ; 30 minutes.

}

Any advices?

engunneer
  • Moderators
  • 9162 posts
  • Last active: Jul 15 2014 12:00 AM
  • Joined: 30 Aug 2005
That will only work for 50 hours, and you probably don't need the WinWait, etc commands. Here is the Settimer version

Do you mean for it to send Tab twice?

Settimer, sendaltTab,  1800000 ; 30 minutes.

Return

sendaltTab:
Send, {ALT DOWN}{TAB}{ALT UP}
Return



ManaUser
  • Members
  • 1121 posts
  • Last active: Mar 03 2011 09:08 PM
  • Joined: 24 May 2007
Alt+Tab is a special key combination and (unless this has changed recently) it can't be sent using the send command, only with a hotkey. If you're trying to cycle through several windows, you might want to look at the GroupActivate for an alternative.

engunneer
  • Moderators
  • 9162 posts
  • Last active: Jul 15 2014 12:00 AM
  • Joined: 30 Aug 2005
AltTab is special {alt down}{tab}{alt up} is not. The last example here shows you can still activate the menu with the send command.


Alt-Tab Hotkeys

Each Alt-Tab hotkey must be a combination of two keys, which is typically achieved via the ampersand symbol (&). In the following example, you would hold down the right Alt key and press J or K to navigate the alt-tab menu:

RAlt & j::AltTab
RAlt & k::ShiftAltTab

AltTab and ShiftAltTab are two of the special commands that are only recognized when used on the same line as a hotkey. Here is the complete list:

AltTab: If the alt-tab menu is visible, move forward in it. Otherwise, display the menu (only if the hotkey is an "&" combination of two keys; otherwise, it does nothing).

ShiftAltTab: Same as above except move backward in the menu.

AltTabAndMenu: If the alt-tab menu is visble, move forward in it. Otherwise, display the menu.

AltTabMenuDismiss: Close the Alt-tab menu.

To illustrate the above, the mouse wheel can be made into an entire substitute for Alt-tab. With the following hotkeys in effect, clicking the middle button displays the menu and turning the wheel navigates through it:

MButton::AltTabMenu
WheelDown::AltTab
WheelUp::ShiftAltTab

To cancel a hotkey-invoked Alt-tab menu without activating the selected window, use a hotkey such as the following. It might require adjustment depending on: 1) the means by which the alt-tab menu was originally displayed; and 2) whether the script has the keyboard hook installed.

LCtrl & CapsLock::AltTab
!MButton::  ; Middle mouse button. The ! prefix makes it fire while the Alt key is down (which it is if the alt-tab menu is visible).
IfWinExist ahk_class #32771  ; Indicates that the alt-tab menu is present on the screen.
    Send !{Escape}{Alt up}
return

Currently, all special Alt-tab actions must be assigned directly to a hotkey as in the examples above (i.e. they cannot be used as though they were commands). Also, the presence of the alt-tab menu can be detected via IfWinExist ahk_class #32771

Custom alt-tab actions can also be created via hotkeys. In the following example, you would press F1 to display the menu and advance forward in it. Then you would press F2 to activate the selected window (or press Escape to cancel):

*F1::Send {Alt down}{tab} ; Asterisk is required in this case.
!F2::Send {Alt up}  ; Release the Alt key, which activates the selected window.
~*Escape::
IfWinExist ahk_class #32771
    Send {Escape}{Alt up}  ; Cancel the menu without activating the selected window.
return



ManaUser
  • Members
  • 1121 posts
  • Last active: Mar 03 2011 09:08 PM
  • Joined: 24 May 2007

AltTab is special {alt down}{tab}{alt up} is not. The last example here shows you can still activate the menu with the send command.

Huh, right you are.

nuganen
  • Members
  • 6 posts
  • Last active: Feb 17 2012 02:46 AM
  • Joined: 07 Nov 2007
Hi,

how would you change the code

#Persistent
Settimer, sendaltTab, 5000 ;2 minutes

Return

sendaltTab:
Send, {ALT DOWN}{TAB}{ALT UP}
Return

if you have 4 windows open?
cheers
huy

engunneer
  • Moderators
  • 9162 posts
  • Last active: Jul 15 2014 12:00 AM
  • Joined: 30 Aug 2005
change {TAB} to {TAB 3}
:?:

nuganen
  • Members
  • 6 posts
  • Last active: Feb 17 2012 02:46 AM
  • Joined: 07 Nov 2007
cheers for the quick response
just have a few more questions
how would you go about changing the code so that doesnt matter how many windows is open it will just loop through that like using a variable

i tried using groupActivate however having no luck atm

here the code i tried

#Persistent

GroupAdd, AllWindows
GroupActivate, Allwindows, R

Settimer, sendaltTab, 5000 ;2 minutes

Return

sendaltTab:
Send, {ALT DOWN}{TAB}{ALT UP}
Return


  • Guests
  • Last active:
  • Joined: --

...every 30 minutes?

...yikes, why so slow?

I want to make a script, which every 30 minutes change active window (ALT+TAB).

How I can do that?

...well ok, old post, but whatever...thread with info...
alt & tab
alt & tab (page 2, with my posts)...my script, from that thread...
Cycle Windows

how would you change the code
...
if you have 4 windows open?

...you wouldn't (change that code)...just use my Cycle Windows script...it supports any amount of windows...& doesn't use Alt+Tab...

  • Guests
  • Last active:
  • Joined: --

Hi,

sendaltTab:
Send, {ALT DOWN}{TAB}{ALT UP}
Return

if you have 4 windows open?
cheers
huy


replace alt+tab with alt+esc.