Jump to content

Automatically Cycle Open Windows


Recommended Posts

Hello. I'm brand new to Autoit, so please bear with me. I'm trying to write a very simple script that will cycle through already open windows every 10 seconds or so. What I am doing is cycling through multiple remote viewing screens (using radmin 3.0) to monitor systems at work. I don't need anything fancy just something that can maximize the next sequential window on the taskbar over and over. I tried an alt + tab loop but it doesn't work properly. It just switches between two different windows, back and forth. Can someone help me out or at least send me down the right path of where to find the information? I've tried searching these forums and google but can't seem to find what I need, exactly. Thanks

Link to comment
Share on other sites

It may not be as easy as you think because there are a lot of hidden windows which you may hit. You require an exclusion list. Try this. I think this is what you are after.

#include <Winapi.au3>
#include <Process.au3>
while 1
cycler()
WEnd

func cycler()
$winlist=_getwinlist ()
for $i= 1 to $winlist[0][1]
    ToolTip($winlist[$i][1])
    WinSetState($winlist[$i][2],"",@SW_MAXIMIZE)
    WinActivate($winlist[$i][2],"")
    sleep(4000)
Next
EndFunc

func _getwinlist ()
Local $sExclude_List = "|Start[CL:102939]|Start|Desktop|Start Menu[CL:102938]|taskbar|iconwin|desktop[CL:102937]|Program Manager|taskbar|Menu|Save As|Drag|maincontext|context|"
Local $sExclude_class = "|tooltips_class32|gdkWindowToplevel|gdkWindowTempShadow|TaskSwitcherWnd|gdkWindowTemp|bosa_sdm_M

icrosoft Office Word 11.0|MsoCommandBarPopup|MsoCommandBarShadow|NUIDialog|CallTip|ThumbnailClass|#32770|Desktop User Picture|OfficeTooltip|"
Local $Listit
Local $aWinList = WinList()
dim $Listit[$aWinList[0][0]][5]

;Count windows

For $i = 1 To $aWinList[0][0]
;Only display visible windows that have a title
    If $aWinList[$i][0] = "" Or Not BitAND(WinGetState($aWinList[$i][1]), 2) Then ContinueLoop
;Add to array all win titles that is not in the exclude list
        $class = _WinAPI_GetClassName($aWinList[$i][1])
    If Not StringInStr($sExclude_List, "|" & $aWinList[$i][0] & "|") and Not StringInStr($sExclude_class, "|" & $class & "|") Then
        $Listit[0][1]=$Listit[0][1]+1
        $Listit[$Listit[0][1]][0]= _ProcessGetName (WinGetProcess($aWinList[$i][1]))
        $Listit[$Listit[0][1]][1]= $aWinList[$i][0]
        $Listit[$Listit[0][1]][2]= $aWinList[$i][1]
        $Listit[$Listit[0][1]][3]= $class
    EndIf 
Next
ReDim $Listit[$Listit[0][1]+1][5]
return $Listit
EndFunc
Link to comment
Share on other sites

Hello. I'm brand new to Autoit, so please bear with me. I'm trying to write a very simple script that will cycle through already open windows every 10 seconds or so. What I am doing is cycling through multiple remote viewing screens (using radmin 3.0) to monitor systems at work. I don't need anything fancy just something that can maximize the next sequential window on the taskbar over and over. I tried an alt + tab loop but it doesn't work properly. It just switches between two different windows, back and forth. Can someone help me out or at least send me down the right path of where to find the information? I've tried searching these forums and google but can't seem to find what I need, exactly. Thanks

I simple way would be to do alt+tab then alt+shift+tab and keep doing this back and forth. This way there is a window that will come up a lot, but the rest will eventually show.

Anyways, the answer from picea892 is a lot better but a little more complex.

[font="Times New Roman"]Ocho.[/font]
Link to comment
Share on other sites

It may not be as easy as you think because there are a lot of hidden windows which you may hit. You require an exclusion list. Try this. I think this is what you are after.

FANTASTIC! this works exactly like i need it to. thank you very very much.
Link to comment
Share on other sites

  • 2 years later...

Hello,

Can someone alter the code to where you can select which windows will auto-cycle?

I am using WindowTabs (http://www.windowtabs.com/) which allows you to group windows together.

I would like to be able to auto-cycle different Radmin sessions as well as VNC sessions that are group together with WindowTabs, and not necessarily all open windows on the taskbar. Please also be aware that I have a dual-monitor setup.

Thanks in advance.

P.S. What is the correct procedure to import and run the script that was mentioned previously in this thread?

Link to comment
Share on other sites

Hello,

Can someone alter the code to where you can select which windows will auto-cycle?

I am using WindowTabs (http://www.windowtabs.com/) which allows you to group windows together.

I would like to be able to auto-cycle different Radmin sessions as well as VNC sessions that are group together with WindowTabs, and not necessarily all open windows on the taskbar. Please also be aware that I have a dual-monitor setup.

Thanks in advance.

P.S. What is the correct procedure to import and run the script that was mentioned previously in this thread?

Instead of reviving a 3 year old thread, create a new one and reference this thread in your post. However, looking at your request, it may require a different approach.

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...