Same key for different windows

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
likethevegetable
Posts: 81
Joined: 05 May 2021, 08:54

Same key for different windows

14 May 2021, 12:02

I have a tool that I'd like to behave one way on my home computer, and another version of it in a separate ahk file on my work computer. I frequently remote in to my work computer, and would like to do the following:

CapsLock -> run script stored on my home computer
CapsLock -> run different script stored on my work computer, only when in the remote desktop window.



Home Computer:

Code: Select all

#IfWinActive, Remote Desktop
{
	;CapsLock::Send {Shift down}{CapsLock}{Shift up} ; throws beeping sound unless in 
	CapsLock::+CapsLock ; does not work reliably
}
#IfWinActive

CapsLock::
DoSomething

Remote Desktop:

Code: Select all

+CapsLock::
DoSomethingElse
Rohwedder
Posts: 7644
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Same key for different windows

15 May 2021, 00:23

Hallo,
I run my scripts on different computers. To distinguish, it uses A_ComputerName:

Code: Select all

; MsgBox,% A_ComputerName
Desktop := A_ComputerName = "DESKTOP-E16UEGT"
Laptop := A_ComputerName = "DESKTOP-5DCP0DO"
Return
#IF Desktop And WinActive("ahk_exe WINWORD.EXE")
q::MsgBox, Word window on the desktop
#IF Laptop And WinActive("ahk_exe WINWORD.EXE")
q::MsgBox, Word window on the laptop
#If

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: jaka1, mikeyww, ReyAHK and 321 guests