Send 'Close Window' command to an application that does not accept "Command+W"?

Would appreciate any help here - can't figure this one out. I am on MacOS Ventura.

The app in question is Sound ID Reference by Sonarworks. It does not close when I enter "Command-W". Not sure why. Other apps close with this command. In order to close it, I need to click the red circle on the top left of the window.

My goal is to create a shortcut like this: Open Sound ID Reference > Close Window.

So whenever the application opens, the window automatically closes and it only remains running in the menu bar. I do not need the main window / dock icon to be open. I have the app set to open on login, but I want the window to be closed and it to just be running in the menu bar.

Create a conditional activation group that looks for the window name of your app
then go to ALL APPS and to Automations & Named & Other Triggers link that CAG via the Conditional Activation Group Name and tell him what to do eg hide window

screenshots are are an example with the app air mail

Hey, thanks for the response. This is a good idea, didn't think to use a CAG. The only issue is that when the "hide" function is ran, the window is hidden, but the app icon still remains in the dock. If I were to manually click on the red button on the top left of the app's window, the window closes AND the dock icon goes away. I'm trying to replicate that.

Have you tried this?

I saw that, but that is the trigger correct? I want "Leftclick Red Window Button" to be the action that is executed when the trigger is triggered. Ideally I think the trigger would be that the application is launched.

No. In this case the CAG is the trigger and the Red Window Button is the triggered action

I am not sure, but instead of show/hide try this

Move mouse to the red button (of the front window) then left click ???

Perhaps this is a better solution (no cag) - you have to play around with how much delay you need