Page 1 of 1

how to make autohotkey work on pc via rdp connections, or work on multiple, different and independent virtual desktops

Posted: 06 Aug 2022, 23:10
by rj8810
full topic: "how to make autohotkey work on pc via rdp connections, or work on multiple, different and independent virtual desktops without scripts interfering with each other." ¡if anyone has a better idea please post it!


the problem with autohotkey working on desktops or virtual machines in the cloud or on rdp connections commented on other forums is that several autohotkey commands like sendinput, click, mousemove, imagesearch, etc don't work when you minimize the rdp window or disconnect.

I was looking everywhere in the autohotkey community and google for a solution but nothing worked for me, until one morning I had an idea: make an rdp loop connection, to call it that. this is somewhat redundant but it works very well for me, It is about connecting to your virtual machine or server from that same virtual machine or server through the default rdp of windows.
This can also be achieved with chrome remote desktop, but I don't recommend it as it only allows one session at a time, and the screen resolution is a bit different than what you're used to; although if the previous points do not matter to you, go ahead with chrome remote desktop, since it is really very easy to achieve the connection compared to the default rdp of windows, I guess because of license issues.

but if you want to use the native windows rdp you may have certain problems that you can solve or avoid by following these steps:
1.- create several users in the virtual machine, so it will be easier to have multiple connections and multiple sessions (it differs from the previous one in that the sessions give you a different independent desktop; while there can be several connections to the same desktop, which causes a fight for control of the mouse and keyboard between the different connected people, or autohotkeys scripts in this case)

2.- enable multiple rdp connections at the same time.
https://kb.vmware.com/s/article/81353#:~:text=Enable%20Multiple%20RDP%20Sessions&text=msc%20and%20open%20it.,Desktop%20Services%20session%20to%20Disabled.

3.- enable multiple sessions, which is a bit restricted by windows , but it can be achieved in my case it worked for me with windows server 2012 R2 base and windows 7 :

https://pupuweb.com/solved-fix-multiple-rdp-sessions-connections-windows10-windows11/#policies

And if the above is not enough...:
try run this powershell comands, execute as an administrator:
https://drive.google.com/file/d/1gOVlsNxm96N_lxtLUSN53FvGV5Vg0djc/view?usp=sharing.

4.- try to connect with the public ip or dns of your virtual machine server or physical pc,
if you get an error that says: Your Credentials Did not Work....
try:
https://appuals.com/fix-your-credentials-did-not-work-in-remote-desktop/
https://www.thewindowsclub.com/your-credentials-did-not-work-in-remote-desktop-on-windows-10

or The most effective and fastest solution that I found after several days of research is to write "localhost" in computer address instead of the ip jajaja, that works perfect in aws virtual machines to connect from the virtual machine to the same virtual machine.

note: you can connect to your virtual machine via rdp from your physical computer, and once inside the virtual machine, connect to the same virtual machine also via rdp, and once you take control of your virtual machine with the second connection, you can run your autohotkey scripts and disconnect or close the first and main remote desktop connection being careful not to close the second connection which must be maximized before closing the first connection.
If you can connect to your same virtual or physical machine, you can get autohotkey to work in the cloud even if you have disconnected or minimized the remote desktop window, you can also get multiple autohotkey scripts to work on multiple virtual desktops at the same time as the following picture shows without interfering with each other for mouse or keyboard control:
image.png
image.png (221.81 KiB) Viewed 5113 times

Re: how to make autohotkey work on pc via rdp connections, or work on multiple, different and independent virtual deskto

Posted: 06 Oct 2022, 21:53
by rj8810
I update, the previous methods did not work for me on another pc with windows 10, but RPD wraper works great,
https://github.com/sebaxakerhtc/rdpwrap/releases/download/v1.8.6.1/RDPWrapMod-v1.8.6.1.zip

You should only run the install.bat file, and after installation run RDP_CnC.exe from the installation path.
then choose the screen resolution and enjoy.

Re: how to make autohotkey work on pc via rdp connections, or work on multiple, different and independent virtual deskto

Posted: 04 Aug 2023, 14:45
by gilberto_san
Hello my friend...please explain me better this method. I need of this.