Help with Windows 10 Task View

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Orium
Posts: 4
Joined: 11 May 2021, 04:45

Help with Windows 10 Task View

Post by Orium » 11 May 2021, 04:52

I'm trying to set up a script to execute when the computer goes idle, that will send a Win+Tab to bring up task view.

Code: Select all

IfWinActive ahk_class MultitaskingViewFrame
{
    Return
} else {
    Send #{Tab}
}
The problem is the IfWinActive never returns true while the Task View is on screen. Any help would be mucho appreciated.
User avatar
mikeyww
Posts: 26849
Joined: 09 Sep 2014, 18:38

Re: Help with Windows 10 Task View

Post by mikeyww » 11 May 2021, 06:17

Code: Select all

#SingleInstance Force
#InstallKeybdHook
#InstallMouseHook
SetTimer, Check, 250
Check:
If (A_TimeIdlePhysical < 3000)
 Return
SetTimer, Check, Off
SoundBeep, 1500
Send #{Tab}
ExitApp
Orium
Posts: 4
Joined: 11 May 2021, 04:45

Re: Help with Windows 10 Task View

Post by Orium » 11 May 2021, 10:58

That works wonderfully, but suffers from the same problem I was having before. The system goes idle, the wintab takes the system back out of idle, 5 mins pass, system goes idle again and the script ends up closing the Task View. Then it just cycles on and on, which is why I need some sort of logic check to prevent further wintabs from being executed.
User avatar
mikeyww
Posts: 26849
Joined: 09 Sep 2014, 18:38

Re: Help with Windows 10 Task View

Post by mikeyww » 11 May 2021, 11:12

So set a variable that tracks what you need, and act according to the variable.

Alternative: it appears that when the task view is active, the window title is "Task View". You could use that to determine what to do.

Code: Select all

#SingleInstance Force
#InstallKeybdHook
#InstallMouseHook
SetTimer, Check, 1000
Check:
If WinActive("Task View") || A_TimeIdlePhysical < 2000
 Return
SoundBeep, 1500
Send #{Tab}
Return
Orium
Posts: 4
Joined: 11 May 2021, 04:45

Re: Help with Windows 10 Task View

Post by Orium » 11 May 2021, 11:21

I had been using the Windows Task Scheduler to handle the system idle and script execution, but presumably ahk has event handlers that are up to the task? I'll look into that, thanks
User avatar
mikeyww
Posts: 26849
Joined: 09 Sep 2014, 18:38

Re: Help with Windows 10 Task View

Post by mikeyww » 11 May 2021, 11:42

Yes, and that is why the script uses them.
Orium
Posts: 4
Joined: 11 May 2021, 04:45

Re: Help with Windows 10 Task View

Post by Orium » 11 May 2021, 21:17

mikeyww wrote:
11 May 2021, 11:42
Yes, and that is why the script uses them.
Ahhh, I see now your original script was what I was looking for, I just needed to adjust the timings of it to suit my needs. Thanks so much
User avatar
mikeyww
Posts: 26849
Joined: 09 Sep 2014, 18:38

Re: Help with Windows 10 Task View

Post by mikeyww » 12 May 2021, 05:41

True. The second script adds a check for Task View, to avoid a repetition.
Post Reply

Return to “Ask for Help (v1)”