Switching active windows like a slideshow Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
LFR14
Posts: 4
Joined: 08 Jun 2023, 08:24

Switching active windows like a slideshow

Post by LFR14 » 08 Jun 2023, 08:39

Hello

So I don't really know how to set this up, but perhaps some experts here can help me easily.

We have several logging programs running on our display TV.
We would like to have each of these open full screen and after 10 seconds the next active program opens in full screen.
It keeps switching and looping the same script until we press a certain keybind & start it again with a certain keybind.

Can we set it up to only display a selected few active programs?


Thanks in advance! :salute:

Kind regards
Laurens

User avatar
mikeyww
Posts: 26883
Joined: 09 Sep 2014, 18:38

Re: Switching active windows like a slideshow

Post by mikeyww » 08 Jun 2023, 09:14

Welcome to this AutoHotkey forum!

Code: Select all

#Requires AutoHotkey v2.0
prog := ['chrome.exe', 'notepad.exe']
freq := 900 ; Frequency (ms) for changing windows

F3::SetTimer(show, freq), SoundBeep(1500), show()
F4::SetTimer(show, 0   ), SoundBeep(1000)

show() {
 Static n := 0
 n := n++ -prog.Length ? n : 1
 winTitle := 'ahk_exe' prog[n]
 If !WinExist(winTitle)
  Run(prog[n]), WinWait(winTitle)
 WinActivate winTitle
}

LFR14
Posts: 4
Joined: 08 Jun 2023, 08:24

Re: Switching active windows like a slideshow

Post by LFR14 » 09 Jun 2023, 02:42

Thanks for this help, looks a lot easier than I thought haha

Now I do have another question regarding the programs since I have 4 sessions running of the putty.exe program.
Can I cycle through the same program but the different windows?

Thanks in advance!

Kr
Laurens

User avatar
mikeyww
Posts: 26883
Joined: 09 Sep 2014, 18:38

Re: Switching active windows like a slideshow  Topic is solved

Post by mikeyww » 09 Jun 2023, 05:14

Code: Select all

#Requires AutoHotkey v2.0
winTitle := 'ahk_class PuTTY'
freq     := 900 ; Frequency (ms) for changing windows
winList  := (winTitle) => (SoundBeep(2500), WinGetList(winTitle))
hWnd     := winList(winTitle)

F3::SetTimer(show, freq), SoundBeep(1500), show()
F4::SetTimer(show, 0   ), SoundBeep(1000)
F5::hWnd := winList(winTitle)

show() {
 Static n := 0
 WinActivate hWnd[n := n++ - hWnd.Length ? n : 1]
}

LFR14
Posts: 4
Joined: 08 Jun 2023, 08:24

Re: Switching active windows like a slideshow

Post by LFR14 » 09 Jun 2023, 07:18

Thank you very much!!

LFR14
Posts: 4
Joined: 08 Jun 2023, 08:24

Re: Switching active windows like a slideshow

Post by LFR14 » 09 Jun 2023, 07:25

One last question for if I need it at sometime.

Can these 2 be combined, where I have other programs I want to slide through running / showing and then also the PuTTY windows?

User avatar
mikeyww
Posts: 26883
Joined: 09 Sep 2014, 18:38

Re: Switching active windows like a slideshow

Post by mikeyww » 09 Jun 2023, 07:28

Yes, you will just need the WinTitle for each window that you would like to activate. You can put the WinTitles into an array that is used by the switcher or timed routine. Read: WinTitle.

maikata329
Posts: 3
Joined: 29 Oct 2023, 16:03

Re: Switching active windows like a slideshow

Post by maikata329 » 29 Oct 2023, 17:42

Is there a way to control the screen switching so it only affects the applications that are running on an extended desktop? For the example of 900 ms the screens are getting focus every .9 seconds, and if work needs to be done on the main desktop, the timed function makes anything else unusable unless the timer is stopped.

User avatar
mikeyww
Posts: 26883
Joined: 09 Sep 2014, 18:38

Re: Switching active windows like a slideshow

Post by mikeyww » 29 Oct 2023, 19:38

You can get the window list, loop through the windows, check each window position, and exclude the ones that you do not want.

ForWinGetPos

Post Reply

Return to “Ask for Help (v2)”