neon-dev / rdphotkeyhelper Goto Github PK
View Code? Open in Web Editor NEWListens for media keys when working within a remote desktop session
License: MIT License
Listens for media keys when working within a remote desktop session
License: MIT License
Hi! I'm just starting to use ahk and realized that a bunch of the codes (like this one) are in v1. I can try porting this one to v2, but do you have any guidelines that I could follow?
Thank you!
The hotkey script allows mute and volume button commands but play/pause, stop and skip are not working.
Hi, looks like a great script!
Unfortunately, for me it doesn't work at all. Server and client are both Windows 10 21H2. Tried script and exe release.
Any ideas what could be the problem?
Hi,
First of all thanks for the script!
I also use another script to map the numpad keys to volume keys and prev/next:
#Requires AutoHotkey v1.1.33
#usehook
;if not A_IsAdmin
;{
; Run *RunAs "%A_ScriptFullPath%" ; Requires v1.0.92.01+
; ExitApp
;}
NumpadUp::Volume_Up
NumpadDown::Volume_Down
NumpadIns::Volume_Mute
NumpadLeft::Media_Prev
NumpadClear::Media_Play_Pause
NumpadRight::Media_Next
I also adjusted your script to be able to use these keys in a RDP session:
;@Ahk2Exe-Set FileVersion, 1.2.0.0
;@Ahk2Exe-Set ProductVersion, 1.2.0.0
;@Ahk2Exe-PostExec "MPRESS.exe" "%A_WorkFileName%" -q -x, 0,, 1, 1
#SingleInstance Force
KeyHistory(0)
A_IconTip := "RDP Hotkey Helper"
ExeNamesPattern := "i)\\(mstsc|ApplicationFrameHost|VMConnect)\.exe$"
SetTitleMatchMode("RegEx")
While true {
global RdpHwnd := 0
WinWaitActive("ahk_exe " ExeNamesPattern)
RdpHwnd := WinExist("A")
Suspend(true) ; rebind all hotkeys, otherwise they won't work in RDP fullscreen mode
Suspend(false)
Sleep(250)
WinWaitNotActive("ahk_id " RdpHwnd)
}
#UseHook
Volume_Mute::PassToLocalMachine()
Volume_Down::PassToLocalMachine()
Volume_Up::PassToLocalMachine()
Media_Next::PassToLocalMachine()
Media_Prev::PassToLocalMachine()
Media_Stop::PassToLocalMachine()
Media_Play_Pause::PassToLocalMachine()
NumpadUp::PassToLocalMachine()
NumpadDown::PassToLocalMachine()
NumpadIns::PassToLocalMachine()
NumpadLeft::PassToLocalMachine()
NumpadClear::PassToLocalMachine()
NumpadRight::PassToLocalMachine()
PassToLocalMachine() {
If (RdpHwnd == 0 || WinExist("A") != RdpHwnd) {
Send("{" A_ThisHotKey "}")
Return
}
WM_APPCOMMAND := 0x0319
;MsgBox A_ThisHotKey
If (A_ThisHotKey = "Volume_Mute" or A_ThisHotKey = "NumpadIns")
PostMessage(WM_APPCOMMAND, 0, 8<<16, , "ahk_class Shell_TrayWnd") ; APPCOMMAND_VOLUME_MUTE
Else If (A_ThisHotKey = "Volume_Down" or A_ThisHotKey = "NumpadDown")
PostMessage(WM_APPCOMMAND, 0, 9<<16, , "ahk_class Shell_TrayWnd") ; APPCOMMAND_VOLUME_DOWN
Else If (A_ThisHotKey = "Volume_Up" or A_ThisHotKey = "NumpadUp")
PostMessage(WM_APPCOMMAND, 0, 10<<16, , "ahk_class Shell_TrayWnd") ; APPCOMMAND_VOLUME_UP
Else If (A_ThisHotKey = "Media_Next" or A_ThisHotKey = "NumpadRight")
PostMessage(WM_APPCOMMAND, 0, 11<<16, , "ahk_class Shell_TrayWnd") ; APPCOMMAND_MEDIA_NEXTTRACK
Else If (A_ThisHotKey = "Media_Prev" or A_ThisHotKey = "NumpadLeft")
PostMessage(WM_APPCOMMAND, 0, 12<<16, , "ahk_class Shell_TrayWnd") ; APPCOMMAND_MEDIA_PREVIOUSTRACK
Else If (A_ThisHotKey = "Media_Stop")
PostMessage(WM_APPCOMMAND, 0, 13<<16, , "ahk_class Shell_TrayWnd") ; APPCOMMAND_MEDIA_STOP
Else If (A_ThisHotKey = "Media_Play_Pause" or A_ThisHotKey = "NumpadClear")
PostMessage(WM_APPCOMMAND, 0, 14<<16, , "ahk_class Shell_TrayWnd") ; APPCOMMAND_MEDIA_PLAY_PAUSE
}
Exit(*) {
ExitApp()
}
It seems the two scripts conflict with eachother. When I had the RDP session in fullscreen and switch back to my native desktop, the numpad keys don't map anymore.
Do you have any idea how I could combine these functionalities?
Hey, thanks for creating this little tool, it's really helpful in homeoffice setups.
Only issue is, the compiled exe you released gets flagged by a lot of AV programs. Noticed it first a few days ago when a device running G Data AV blocked it, and today my other computer running windows defender also quarantined it.
Since a version I compiled myself from your AHK script works fine without any alerts I'd guess it's because you activated compression during compilation. Those packers are quite frequently (also) used by malware, so quite a lot of AV engines react to them.
I always have my NumLock off, but when running RDPHotkeyHelper in the background and switching from my local computer to my RDP computer the NumLock turns on. I can turn it off again, but when I switch back to local and then back to RDP it automatically switches on again.
Steps to reproduce (Windows 10 Pro):
When I stop RDPHotkeyHelper and do the steps again, the numlock stays off the whole time.
Edit:
Ahhh I see you do it deliberately:
SetNumLockState, On ; the remote desktop client disables num lock upon first connection for some reason
So I guess it should be optional.
Have an extra menu item 'NumLock: State
', and have the user select the option to turn it off (default take the current state of the NumLock when RDPHotkeyHelper was started).
Would be good to add support for virtual machine connections via Hyper-V as well.
Should be relatively simple -- as best as I can tell the windows just end with the title " - Virtual Machine Connection"
Alternately, you could match based on executable: vmconnect.exe
Hi,
Thanks for your script! Volume keys are working nicely... :-)
However, somehow I can't seem to get the media keys to work. My RDP client is a Win10 machine.
Media keys work locally.
Any ideas what might go wrong?
Thanks for your help.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.