2

I use Remote Desktop Manager daily to log into my Macbook Pro from my Windows PC (Windows 10). But once connected via ARD, it stays logged in basically forever. I would like to have the connection window close itself automatically after an idle period, maybe 10-15 minutes.

I'm guessing I could probably script this with AutoHotKey or similar, but I'm wondering if there is a way to do this using only built-in tools of Windows, maybe a batch script, etc.? I would love some suggestions on how to accomplish this. I'm not opposed to dedicated apps as well, but to be clear, I don't want to quit the application, just close the single connection window.

1 Answer 1

1

You can try this AutoHotKey script:

#Requires AutoHotkey v1.1

#Persistent  ; keeps the script permanently running

SetTimer, close_connection_window, 60000 ; 1 minute timer
return

    close_connection_window:
If WinExist("title of the connection window") 
    time++ ; checks the number in the variable "time" and increases it by 1 every 1 minute (in accordance with the timer period)
else
    time := 0     ; reset
If (time = 15)    ; 15 minutes
{
    WinClose, title of the connection window
    time := 0     ; reset
}
return

Replace title of the connection window with the title of the window you want to close.

https://www.autohotkey.com/docs/commands/SetTimer.htm

4
  • 1
    Thanks, I'm hoping to avoid AHK if possible but will keep this in mind if all else fails.
    – JVC
    Commented Oct 18, 2023 at 6:06
  • If you have a permanetly running AHK script with hotkeys/hotstrings and/or other functions you can add the above code to it.
    – Relax
    Commented Oct 18, 2023 at 6:51
  • 1
    @2012rcampion, it only checks if the program's visible window exists. If that window is closed, the variable time is 0 and the new one will close after 15 minutes.
    – Relax
    Commented Oct 18, 2023 at 16:15
  • 1
    And if by "idle" you mean "not active", replace If WinExist("title of the connection window") by If !WinActive("title of the connection window") in the above code.
    – Relax
    Commented Oct 18, 2023 at 21:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .