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

Put simple Tips and Tricks that are not entire Tutorials in this forum
rj8810
Posts: 37
Joined: 16 Jul 2018, 22:34

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

06 Aug 2022, 23:10

full topic: "¡autohotkey working in the cloud! 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 9292 times
Attachments
image.png
image.png (158.76 KiB) Viewed 9293 times
Last edited by rj8810 on 09 Jul 2024, 13:49, edited 7 times in total.
rj8810
Posts: 37
Joined: 16 Jul 2018, 22:34

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

06 Oct 2022, 21:53

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.
gilberto_san
Posts: 9
Joined: 28 May 2020, 12:28

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

04 Aug 2023, 14:45

Hello my friend...please explain me better this method. I need of this.
rj8810
Posts: 37
Joined: 16 Jul 2018, 22:34

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

09 Jul 2024, 13:40

Sorry, I was traveling for some time, if this answer is still useful:
with the previous steps The visual effect is the same as putting one mirror in front of another.
Basically this method is for people who want to run their autohokey script on a PC or virtual machines that do not have a physical screen, since autohotkey gives you the big surprise that many of its commands do not work without a physical screen or for people who want to run multiple autohotkey scripts that interfere with each other for mouse and keyboard..
In summary, basically the previous method consists of connecting to your PC through RDP from your own PC, In this way, two screens or desktops are created, one inside the other and it is an effective way to trick autohotkey and make it believe that you have a physical screen even if you don't really have it or you have turned off the screen if you have it to save energy. also to be able to run your scripts in virtual machines in the cloud, which do not have a physical screen.
On your own physical PC, most of the time this is achieved by writing the IP address of your own PC in the rdp window, and on virtual machines by writing local host as shown in the images above, but if you have problems you should download rdp wraper or follow all the steps already mentioned.

Return to “Tips and Tricks (v1)”

Who is online

Users browsing this forum: No registered users and 36 guests