MouseMove v1 vs. v2 (and Citrix workspace)

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
Lorien
Posts: 33
Joined: 10 Dec 2019, 11:16

MouseMove v1 vs. v2 (and Citrix workspace)

Post by Lorien » 31 Jan 2023, 07:12

I have finally transitioned my scripts to v2... but I am having an issue that has me stumped.

I have long used a timer triggered routine to wiggle the mouse to keep my screen from locking. [Note: Changing the screen timeout is not an option. The admins have that locked up.]

Under v1 (latest), this all worked great. Under v2 (latest), my Citrix session is not receiving/acknowledging/???? the mouse wiggle.


I thought I've already RTFM, but am I missing some change to the way MouseMove works? Any ideas to test?

ntepa
Posts: 404
Joined: 19 Oct 2022, 20:52

Re: MouseMove v1 vs. v2 (and Citrix workspace)

Post by ntepa » 31 Jan 2023, 09:34

SendMode changes the way keys, mouse movement, and clicks are sent. In v1, Event mode is default. In v2, the default is Input. Try using SendMode("Event") to make MouseMove use event mode.

Lorien
Posts: 33
Joined: 10 Dec 2019, 11:16

Re: MouseMove v1 vs. v2 (and Citrix workspace)

Post by Lorien » 04 Feb 2023, 07:58

ntepa wrote:
31 Jan 2023, 09:34
SendMode changes the way keys, mouse movement, and clicks are sent. In v1, Event mode is default. In v2, the default is Input. Try using SendMode("Event") to make MouseMove use event mode.
Thanks for the suggestion, ntepa. Unfortunately, this does not solve the problem.

I added a MouseClick hoping maybe it would truly be sent to the remote system... but that didn't work either.


Still scratching my head....

ntepa
Posts: 404
Joined: 19 Oct 2022, 20:52

Re: MouseMove v1 vs. v2 (and Citrix workspace)

Post by ntepa » 04 Feb 2023, 12:25

Try this. It sends a mouse move message every second. I only tested it with msedge.exe. You'll need to change to Citrix (I don't know the exe).

Code: Select all

SetTimer RandomMouseMove.Bind("ahk_exe msedge.exe"), 1000

RandomMouseMove(win) {
    win := WinExist(win ?? "A")
    WinGetPos(,, &Width, &Height, win)
    x := Random(0, Width)
    y := Random(0, Height)
    lparam := x & 0xFFFF | (y & 0xFFFF) << 16
    PostMessage 0x200, , lParam, win
}

Lorien
Posts: 33
Joined: 10 Dec 2019, 11:16

Re: MouseMove v1 vs. v2 (and Citrix workspace)

Post by Lorien » 10 Feb 2023, 06:35

Still no joy.

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: MouseMove v1 vs. v2 (and Citrix workspace)

Post by swagfag » 11 Feb 2023, 18:27

then post both script versions and we can check if something's different

vmech
Posts: 343
Joined: 25 Aug 2019, 13:03

Re: MouseMove v1 vs. v2 (and Citrix workspace)

Post by vmech » 13 Feb 2023, 19:04

@Lorien
Try to match the higher latencies/lower speed of the simulated mouse.
Because simulated input in v2 is a bit faster than in v1. This may be the solution to the problem.
Please place your script code into [code][/code] block. Thank you.

User avatar
RaptorX
Posts: 368
Joined: 06 Dec 2014, 14:27
Contact:

Re: MouseMove v1 vs. v2 (and Citrix workspace)

Post by RaptorX » 15 Feb 2023, 23:20

vmech wrote:
13 Feb 2023, 19:04
@Lorien
Try to match the higher latencies/lower speed of the simulated mouse.
Because simulated input in v2 is a bit faster than in v1. This may be the solution to the problem.
For anyone reading this and not knowing how to achieve it you can set the speed on the MouseMove command:

MouseMove X, Y , [Speed], Relative


0 is the fastest speed and 100 is the slowest. I would set it to 50 for starters.

Also you might want to try SendMode "Play"
Projects:
AHK-ToolKit

Lorien
Posts: 33
Joined: 10 Dec 2019, 11:16

Re: MouseMove v1 vs. v2 (and Citrix workspace)

Post by Lorien » 18 Feb 2023, 09:06

I tried the Speed param on MouseMove, and using Play mode. It did not fix the issue. Both versions of my code below for your amusement enjoyment.

AHK v1.1 code
Spoiler
AHK v2 code
Spoiler

User avatar
RaptorX
Posts: 368
Joined: 06 Dec 2014, 14:27
Contact:

Re: MouseMove v1 vs. v2 (and Citrix workspace)

Post by RaptorX » 19 Feb 2023, 14:26

Did you try different send modes?

There's event, input and play.
That last one usually plays ball when other modes don't work.
Projects:
AHK-ToolKit

Lorien
Posts: 33
Joined: 10 Dec 2019, 11:16

Re: MouseMove v1 vs. v2 (and Citrix workspace)

Post by Lorien » 20 Feb 2023, 10:06

RaptorX wrote:
19 Feb 2023, 14:26
Did you try different send modes?

There's event, input and play.
That last one usually plays ball when other modes don't work.
I have used every mode except "InputThenPlay." But not since slowing down the speed....


Part of me is suspicious that it has to do with focusing on (i.e. activating) the Citrix session window for input.

I have another module that works when triggered by a hotstring. I have been having trouble with an AHK Gui button that a) activates the previous window (using SKAN's wingetlistalt), then b) calls the same function as the hotstring to send keystrokes. (I'll have to test this idea... tomorrow.)

User avatar
RaptorX
Posts: 368
Joined: 06 Dec 2014, 14:27
Contact:

Re: MouseMove v1 vs. v2 (and Citrix workspace)

Post by RaptorX » 20 Feb 2023, 10:23

Lorien wrote:
20 Feb 2023, 10:06
RaptorX wrote:
19 Feb 2023, 14:26
Did you try different send modes?

There's event, input and play.
That last one usually plays ball when other modes don't work.
I have used every mode except "InputThenPlay." But not since slowing down the speed....


Part of me is suspicious that it has to do with focusing on (i.e. activating) the Citrix session window for input.

I have another module that works when triggered by a hotstring. I have been having trouble with an AHK Gui button that a) activates the previous window (using SKAN's wingetlistalt), then b) calls the same function as the hotstring to send keystrokes. (I'll have to test this idea... tomorrow.)

If you are not sure that the window might be active, then using ControlSend or ControlClick might be a better fit.
Those send the Events/Clicks to the control even if it is not active (your mileage might vary depending on the program though and the Send Mode).

A quick note on that, that method might not work if the window is minimized as the control might not actually 'exist'.
Projects:
AHK-ToolKit

Lorien
Posts: 33
Joined: 10 Dec 2019, 11:16

Re: MouseMove v1 vs. v2 (and Citrix workspace)

Post by Lorien » 23 Feb 2023, 07:33

Well... the focus issue was stupid. I was getting unwanted hwnds, so the focus was going to a different window (that didn't accept text input, so I couldn't see where it was going).

I've hardcoded the KeepAlive to activate the Citrix window before the MouseMoves... I'll see if that helps.

Lorien
Posts: 33
Joined: 10 Dec 2019, 11:16

Re: MouseMove v1 vs. v2 (and Citrix workspace)

Post by Lorien » 23 Feb 2023, 12:23

:headwall: :headwall: :headwall: :headwall: :headwall: :headwall: :headwall:

Turns out calling

Code: Select all

KeepAlive.On()
every minute is a bad thing. (i.e. resetting the timer)


I'm to go crawl under a rock now.

User avatar
RaptorX
Posts: 368
Joined: 06 Dec 2014, 14:27
Contact:

Re: MouseMove v1 vs. v2 (and Citrix workspace)

Post by RaptorX » 28 Feb 2023, 10:20

Lorien wrote:
23 Feb 2023, 12:23
:headwall: :headwall: :headwall: :headwall: :headwall: :headwall: :headwall:

Turns out calling

Code: Select all

KeepAlive.On()
every minute is a bad thing. (i.e. resetting the timer)


I'm to go crawl under a rock now.
why is it a bad thing?
and do you think moving the mouse 2 pixels is enough for citrix to count it as a mouse move?

if you se the values higher can you see the mouse moving in the virtual machine?
Projects:
AHK-ToolKit

Lorien
Posts: 33
Joined: 10 Dec 2019, 11:16

Re: MouseMove v1 vs. v2 (and Citrix workspace)

Post by Lorien » 02 Mar 2023, 06:11

RaptorX wrote:
28 Feb 2023, 10:20
why is it a bad thing?
The important detail in that post was "resetting the timer". A 5 minute timer will have a hard time triggering when it is reset every minute... i.e. never.

Post Reply

Return to “Ask for Help (v2)”