Mouseclick after mouse move

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
jrachr
Posts: 545
Joined: 01 Mar 2021, 17:33

Mouseclick after mouse move

Post by jrachr » 18 Sep 2023, 16:08

Good Day. Need a little help if I may. Spent better part of the day trying to get this to work and now admitting defeat. I have a program Trakt tv that requires username and password. Logically sending tab after username would be the way to but for some reason Trakt does not recognize Tab as a means to move page down after username has been inputted otherwise we would not be having this discussion. Anyways I came up with this solution to mousemove the cursor and then click. However after cursor is moved it will not click. Now the left click on the mouse does this just fine. Have also tried Mouseclick,, 1610, 1400 and that doesn't work. Cursor moves but click does not occur as it should. Any idea's anybody? Tk's

Code: Select all

#SingleInstance Force
Try Run % A_IsAdmin ? "" : "*RunAs " A_AhkPath " """ A_ScriptFullPath """"

0::
SendRaw, jrachr
Click 1610, 1400 
Sleep 10000
Send, {Enter}
Sleep 1000
Run, https://trakt.tv/users/jrachr/progress
Return

User avatar
mikeyww
Posts: 27274
Joined: 09 Sep 2014, 18:38

Re: Mouseclick after mouse move

Post by mikeyww » 18 Sep 2023, 17:21

I would create a new test script.

Code: Select all

#Requires AutoHotkey v1.1.33

x := 1610
y := 1400

F2::MouseMove x, y
F3::Click
See if F2 works. Next, press F3. If it fails, click manually in place. If that works, try UI Access or admin mode. If that fails, look for some AHK experts here! :think:

Some programs block scripting.

If you are at a Web site, short of UI Automation, JavaScript, etc., you could tab into the next field instead of clicking.

Code: Select all

#Requires AutoHotkey v1.1.33
^F2::Send user`tpassword

User avatar
DevWithCoffee
Posts: 55
Joined: 13 Oct 2020, 12:16

Re: Mouseclick after mouse move

Post by DevWithCoffee » 18 Sep 2023, 17:27

The mouse position is relative due to the screen resolution and zoom, both defined by the user.

I believe that the most convenient thing would be to create an extension for Chromirium and another for Firefox that performs this operation.

If it's your website, I advise you to use only Javascript.

jrachr
Posts: 545
Joined: 01 Mar 2021, 17:33

Re: Mouseclick after mouse move

Post by jrachr » 18 Sep 2023, 17:52

@mikey. While your test script works fine I still have to press 2 buttons to get from username to password. As per my initial script I am already running in admin. I also pointed out that the tab button does not work with particular program.No idea why but that eliminates the option of your ^F2 suggestion. The goal at the end of the day is to have username inputted and the go to password at which time I would type in password followed by enter where I would then be logged in. If someone out there knows how to force the tab button to work that would be great.

jrachr
Posts: 545
Joined: 01 Mar 2021, 17:33

Re: Mouseclick after mouse move

Post by jrachr » 18 Sep 2023, 18:13

@devwithcoffee. I have no idea how to create an extension for Firefox or what I would need this extension to do. Sorry. Not that technically minded.As I said moving the cursor is not the problem.It moves exactly where it need's to go but for some reason it will not click when it it get's there. But it clicks fine via mikeys test script if I use 2 hotkeys instead of one.IE I tried replacing his F3 with a sleep but nothing. However F2 moves Cursor and F3 triggers password box so I can type password in. I am trying to avoid exposing password just in case I am hacked or anything.Any help would be appreciated.

User avatar
mikeyww
Posts: 27274
Joined: 09 Sep 2014, 18:38

Re: Mouseclick after mouse move

Post by mikeyww » 18 Sep 2023, 18:29

So there is progress. Let's see the Sleep script. How about increasing the mouse delay as well?

jrachr
Posts: 545
Joined: 01 Mar 2021, 17:33

Re: Mouseclick after mouse move

Post by jrachr » 18 Sep 2023, 18:43

@mikey. Here is the script.Very odd though. For whatever reason the y setting has gone from 1400 to 1145. No idea why. But with this sleep script the click does not click whereas your first one with F2 & F3 works.

Code: Select all

#Requires AutoHotkey v1.1.33

x := 1610
y := 1145

2::MouseMove x, y
Sleep 2000
Click

User avatar
mikeyww
Posts: 27274
Joined: 09 Sep 2014, 18:38

Re: Mouseclick after mouse move

Post by mikeyww » 18 Sep 2023, 19:02

You're right. You need to put each of your multiple commands below your hotkey. If a command is on the same line, it includes an implicit Return. Explained here: Introduction and Simple Examples.

A click can change the active window, and coordinates are relative to the active window by default-- whichever window is active at that time.

jrachr
Posts: 545
Joined: 01 Mar 2021, 17:33

Re: Mouseclick after mouse move

Post by jrachr » 18 Sep 2023, 19:20

@mikey. Got it. Thank You. Something as simple as that. Here is final code.Will try to finetune later but it works. If you have any further suggestions to neaten this up feel free. Cheer's

Code: Select all

#Requires AutoHotkey v1.1.33

x := 1610
y := 1145

2::
SendRaw, jrachr
MouseMove x, y
Sleep 1000
Click
Sleep 10000
Send, {Enter}
Run, https://trakt.tv/users/jrachr/progress
Return

Post Reply

Return to “Ask for Help (v1)”