WinWaitActive open untargeted windows

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Atom
Posts: 42
Joined: 05 Sep 2016, 06:49

WinWaitActive open untargeted windows

Post by Atom » 25 Sep 2022, 04:10

This script works as intended and I have used it for some time.
However, while workspaces are being opened, various other unrelated and minimized windows are caused to open momentarily.
This does not appear to interfere with the script's function, but I'd like to prevent the extraneous window openings anyway.

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#Persistent
#SingleInstance Force

title := "Open Workspace Warning"

Loop
{
	WinWaitActive, %title%			; waits until window is active
	ControlClick, Open Windows with Items Enabled, %title%
	Sleep, 50 
}

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

Re: WinWaitActive open untarageted windows

Post by mikeyww » 25 Sep 2022, 05:48

Some debugging strategies:
1. Remove the loop. Test a single iteration. If it works, add one or two new iterations individually.
2. Increase the sleep.
3. Check the window titles of the newly activated windows.
4. Determine when the ControlClick is occurring, and the iteration in which each click happens.

Atom
Posts: 42
Joined: 05 Sep 2016, 06:49

Re: WinWaitActive open untarageted windows

Post by Atom » 25 Sep 2022, 13:10

Thank you. I am going to try changing the sleep first because that is the simplest.
I am considering adding either or both of the exclude title and exclude text parameters.

Post Reply

Return to “Ask for Help (v1)”