Can Alt+Tab (with two items in the menu) also press "play" in the new active window? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Kosmalak
Posts: 3
Joined: 22 Feb 2017, 18:19

Can Alt+Tab (with two items in the menu) also press "play" in the new active window?

22 Feb 2017, 18:47

Hello, everyone, I'd be very grateful if someone could help me with the following (I don't know if it can be made to work):
I have two windows in the alb+tab menu - a "Word" document and a "Media Player Classic". Is it possible to make a script, that after alt+tabbing from the "Word" document to the MPC, also presses play ("space") in the player which is now the active window, and then presses stop ("space" again) when I alt+tab back to the "Word" document and the player becomes the inactive window.
Thank you very much in advance.
4GForce
Posts: 553
Joined: 25 Jan 2017, 03:18
Contact:

Re: Can Alt+Tab (with two items in the menu) also press "play" in the new active window?

22 Feb 2017, 20:18

Kosmalak wrote:Hello, everyone, I'd be very grateful if someone could help me with the following (I don't know if it can be made to work):
I have two windows in the alb+tab menu - a "Word" document and a "Media Player Classic". Is it possible to make a script, that after alt+tabbing from the "Word" document to the MPC, also presses play ("space") in the player which is now the active window, and then presses stop ("space" again) when I alt+tab back to the "Word" document and the player becomes the inactive window.
Thank you very much in advance.
I ran into a weird issue but this works for VLC ( just add your window titles )
Whenever I bind Alt up, my alt tab menu goes old school (win7)

Code: Select all

#singleinstance force

Global altTabbed := False

Return

F10::
ExitApp

F9::Reload

$Alt up::									; Removing 'up' from here fixes the Switch menu but doesn't send the {Space}
	send {Alt up}
	if(!GetKeyState("Alt", "P")) {
		if(altTabbed) {
			WinGetActiveTitle activeWindowTitle
			if(InStr(activeWindowTitle, "VLC media player")) {		; filter window title
				send {Space}
			}
		}
		altTabbed := False
	}
Return

$Tab::
	if(GetKeyState("Alt", "P") AND !altTabbed) {
		altTabbed := True
	}	
	send {Tab}
Return
Kosmalak
Posts: 3
Joined: 22 Feb 2017, 18:19

Re: Can Alt+Tab (with two items in the menu) also press "play" in the new active window?

23 Feb 2017, 00:20

Hello, 4GForce, thank you so very much!!! We're halfway there. I changed the active window title and it works for MPC too. I use Windows 7 anyway, so "the weird part" is not a problem.
Now, when I alt+tab from the "Word" document to the player, it starts playing the video! Just like I wanted it to. That's awesome. The problem is that when I alt+tab back to 'Word", the video keeps on playing, while I wanted it to get paused. Still, what you've sent me will save me thousands of movements per day (because of the nature of my work), but if you can get the second half of it to work too, that will be beyond perfect!
Thank you once again.
4GForce
Posts: 553
Joined: 25 Jan 2017, 03:18
Contact:

Re: Can Alt+Tab (with two items in the menu) also press "play" in the new active window?  Topic is solved

23 Feb 2017, 03:15

Kosmalak wrote:Hello, 4GForce, thank you so very much!!! We're halfway there. I changed the active window title and it works for MPC too. I use Windows 7 anyway, so "the weird part" is not a problem.
Now, when I alt+tab from the "Word" document to the player, it starts playing the video! Just like I wanted it to. That's awesome. The problem is that when I alt+tab back to 'Word", the video keeps on playing, while I wanted it to get paused. Still, what you've sent me will save me thousands of movements per day (because of the nature of my work), but if you can get the second half of it to work too, that will be beyond perfect!
Thank you once again.
Oh, simple, check again when alt-tabbed is 1st activated

Code: Select all

#singleinstance force

Global altTabbed := False

Return

F10::
ExitApp

F9::Reload

$Alt up::									; Removing 'up' from here fixes the Switch menu but doesn't send the {Space}
	send {Alt up}
	if(!GetKeyState("Alt", "P")) {
		if(altTabbed) {
			WinGetActiveTitle activeWindowTitle
			if(InStr(activeWindowTitle, "VLC media player")) {		; filter window title
				send {Space}
			}
		}
		altTabbed := False
	}
Return

$Tab::
	if(GetKeyState("Alt", "P") AND !altTabbed) {
		altTabbed := True
		WinGetActiveTitle activeWindowTitle
		if(InStr(activeWindowTitle, "VLC media player")) {		; filter window title
			send {Space}
		}
	}	
	send {Tab}
Return
Kosmalak
Posts: 3
Joined: 22 Feb 2017, 18:19

Re: Can Alt+Tab (with two items in the menu) also press "play" in the new active window?

23 Feb 2017, 03:59

YES! It works now. It was a matter of when I activated the script. If my "Word" document is open and the player is paused when I activate the script, it does exactly what I want. Thank you so much a million times, 4GForce. I'm eternally grateful for your help!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: gkaoyan, Google [Bot], Joey5 and 204 guests