Xclick doesn't work on VPS when not looking

Hi!

I have an xclick function (very last step) which is not executed unless Im on the microsoft remote desktop looking at the VPS.

No screen lock, no screen saver, bring browser to foreground is one of the commands.

Everything runs and the Xclcik fails to find the image, ONLY if I’m not watching with the remote desktop for a while. The macro runs fine up until the very last step which is the xclick, which means it’s not a screensaver/lock issue. Basically only when I actually close Microsoft Remote Desktop, it happens. If the remote desktop is open, it’s all fine.

Anyone experienced anything similar?

I have solution for it.
You can use other VPS and remote for this vps (vps run code)
or create more use control panel > use, and use this use remote -> 127.0.0.1

Hi Karen, thanks for replying.

About first solution, I thought about it, though it’s a bit of a stretch (and an additional expense), It’s possible. Were you able to figure out why this is happening? Isn’t there a more straightforward solution with the 1 VPS?

I didn’t quite understand the second solution, can you please be more specific? Thanks!

Ilya

hi,
you have permision full admin vps?

go to control panel -> user -> create new user. example: user1

close vps

open remote, and login user1,
after login, go to remote desktop (inside user1) -> IP address : 127.0.0.1 -> id + password of vps you put code.

sorry my bad english, hope you understand

Hi Karen, glad to know you have a solution.

But i don’t question understand your solution 1 and 2. Here is my understanding and please help verify:

for solution 1, assume i have VPS1 is running my ui.vision script, and i have another VPS2. Does it mean i login in VPS 2 first and using remote connection from VPS2 to VPS1 ?

I do all the setup in VPS1. After it, i leave connection from VPS2 to VPS active but disconnect VPS2.
So the internal screen will still be there for VPS1 for Xmoduel to work ?

For solution 2, do you mean i create another : use1 under VPS1 using admin id. and disconnect VPS1 and use use1 to logon VPS1 again. then i use remote desktop to connect to a special address: 127.0.0.1. after it, i disconnect user 1 and use admin id to login VPS1 again to setup my ui.vision scripts and disconnect again. because there is active remote connection under uesr1 account to connect with 127.0.0.1, so the virtual screen for admin id will still be there ?

please help confirm whether my understanding is correct or not.

solution 2:
Yes, after create use (ex: user1)

login user1, and connect to 127.0.01 into user1 (127.0.0.1 address of host)

for option 1, i created new user: user1 (admin right) and try to login 127.0.0.1 with user1 and get access denied error.

what i do is using original admin id to login 127.0.0.1 (under user1 account access) and enable the scripts and disconnect. and it works.

yep, good for you, this method keep vps always running.

1 Like

A much easier solution would be to do use tscon:

To avoid problems with RealUser commands, use the tscon utility to disconnect from Remote Desktop. tscon returns the control to the original local session on the remote computer, bypassing the logon screen. All programs on the remote computer continue running normally, including GUI tests.

To disconnect from Remote Desktop, run the following command on the remote computer (in the Remote Desktop window) as an Administrator:

%windir%\System32\tscon.exe RDP-Tcp#NNN /dest:console

where RDP-Tcp#NNN is the ID of your current Remote Desktop session, for example, RDP-Tcp#0. You can see it in the Windows Task Manager on the Users tab, in the Session column.

You will see the “Your remote desktop session has ended” message, and the Remote Desktop client will close. But all programs and tests on the remote computer will continue running normally.

Source:
https://ui.vision/howto/taskscheduler