Page 1 of 1

How to Automatically close a specific window when windows starts?

Posted: 05 Jun 2023, 10:09
by yfjuu6
Hy, I'am a newbie in autohotkey.
I have a specific program that I made It start automatically when Windows starts, and this program works by default in the system tray icon.
The program is :
The window title : LilySpeech Settings
The process name : ahk_exe LilySpeech64-1.exe
The problem is :
When the program starts automatically when Windows starts, it works by default in the system icon, but the window of the program appears and It stills appear on the screen Every time I start Windows.
- I want the window of the program to be closed automatically and only every time I start Windows, knowing that if I close the program window the program continues to work in the system tray icon and this is what I want.
- I'm looking for an AHK script to do that.
- Note : I'm using AHK V1.1.36.02.
- I've tried this but didn't work:

Code: Select all

Loop {

WinWaitActive ahk_exe LilySpeech64-1.exe

WinClose ahk_exe LilySpeech64-1.exe
}
- Please help! I appreciate your time and effort. Thanks in advance.

Re: How to Automatically close a specific window when windows starts?  Topic is solved

Posted: 05 Jun 2023, 11:01
by mikeyww
Could try:

Code: Select all

#Requires AutoHotkey v1.1.33
#SingleInstance
winTitle := "LilySpeech Settings ahk_exe LilySpeech64-1.exe"
WinWait % winTitle
WinClose
SoundBeep 1500
ExitApp
This script would also run at startup. If the script remains running while your other window is visible, then use Window Spy to check the WinTitle information for that window.

Re: How to Automatically close a specific window when windows starts?

Posted: 05 Jun 2023, 11:26
by yfjuu6
mikeyww wrote:
05 Jun 2023, 11:01
Could try:

Code: Select all

#Requires AutoHotkey v1.1.33
#SingleInstance
winTitle := "LilySpeech Settings ahk_exe LilySpeech64-1.exe"
WinWait % winTitle
WinClose
SoundBeep 1500
ExitApp
This script would also run at startup. If the script remains running while your other window is visible, then use Window Spy to check the WinTitle information for that window.
It worked, that's exactly what I was looking for, Thanks. :-P