How to make a Hotkey for a specific window/process? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
prringer

How to make a Hotkey for a specific window/process?  Topic is solved

29 May 2017, 14:33

Hello guys,

I have Windows 10 and I am Using Autohotkey. I controll my PC in the upper etage with TeamViewer and my PC is permanently running a CMD window. For some reason, the CMD window goes in some kind of idle mode sometimes so I use AutoHotkey to spamm Enter every 20 seconds so my CMD window always works and it refreshes everytime it registers a key.

I set my PC so it restarts every 3 hours and I thought about putting the script simply in shell:startup so it will automatically load at startup like my CMD window (I'm mining Ethereum - if you're wondering what i mean with CMD window).

Can I set my script so it "locks" on my CMD window (conhost.exe) every time the script runs? So i dont have to put my mouse on the process/window that it spamms in the right place.

My script is very basic, I only want that it spamms in the window from "conhost.exe". Or locks on this window, or however it can be solved:

#Persistent
SetTimer, PressTheKey, 20000
Return

PressTheKey:
Send, {Enter}
Return

Ty in advance.
User avatar
boiler
Posts: 16926
Joined: 21 Dec 2014, 02:44

Re: How to make a Hotkey for a specific window/process?

29 May 2017, 21:15

You can try the ControlSend command, which works with some windows, but not all. If it doesn't work, you can use WinActivate to activate your CMD window before you send to it. You can also determine which window is active right before it does that, so then you can return focus to that window afterwards.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: ConnorMcLoud, Google [Bot] and 169 guests