1
votes

I'm stumped on how to best re-write my hotkey. What I want to do is simple. I have a script that switches to File Explorer IF it's currently open Else it will open a new file explorer window.

Here's the catch - It's hard to "identify" if the Explorer window is open. I used to just do this by using WinActivate, 00123456 because that's the name of the folder (eight-digit random number). But the problem with that is that these are support ticket numbers. And that number will also be within the title of my current Chrome session and sometimes other windows too (Firefox, Snagit, notepad, etc). So it will inadvertently switch to those other programs. So that led me to exclude in this way:

Ticket_Out := clipboard
xclude:= Ticket_Out . " | Salesforce - Google Chrome"
WinActivate, % Ticket_Out, , % xclude

That's handy except for it only excludes 1 window at a time. How could I implement something that excludes a second application? OR --- another thought, how could I just say: look for Explorer.exe with window title "00123456" ?

1

1 Answers

0
votes

You can use ahk_exe to filter by the process name too:

WinActivate, ahk_exe explorer.exe %Ticket_Out%

Another way would be to look for the window class - since depending on the Windows version Explorer can use either CabinetWClass or ExploreWClass, you can use a group, as shown in the docs:

; Define the group: Windows Explorer windows
GroupAdd, Explorer, ahk_class ExploreWClass ; Unused on Vista and later
GroupAdd, Explorer, ahk_class CabinetWClass

; Activate any window matching the above criteria and the title
WinActivate, ahk_group Explorer %Ticket_Out%