Shifting Only Start Position Each Loop

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
starkel
Posts: 2
Joined: 16 May 2024, 09:32

Shifting Only Start Position Each Loop

Post by starkel » 16 May 2024, 09:47

I'm new to AHK and have almost no coding experience.

I am using a pre-built script from this forum to record my mouse clicks. After recording this is the code:

My goal is to shift only the first click down 50 pixels after each loop and the script will run for 50 loops.

If someone could assist it would be much appreciated. I understand a y-coordinate might need to be defined and a line added before the first click, but programming is not my forte. I know logically what needs to be added but not the language.

Thank you very much.

Code: Select all

Loop, 50
{

SetTitleMatchMode, 2
CoordMode, Mouse, Window

tt = Issues
WinWait, %tt%
IfWinNotActive, %tt%,, WinActivate, %tt%

Sleep, 600

MouseClick, L, 1464, 604 ; Select task line (I want to shift this command down 50 pixels after each loop)

Sleep, 600

MouseClick, L, 3428, 1769 ; Select location details line

Sleep, 600

MouseClick, L, 3428, 1769,,, D ; Begin highlighting

Sleep, 1000

MouseClick, L, 3456, 1757,,, U ; End highlighting

Sleep, 600

MouseClick, R, 3439, 1766 ; Open paste menu

Sleep, 600

MouseClick, L, 3082, 1285 ; Select paste

Sleep, 600

}
RussF
Posts: 1301
Joined: 05 Aug 2021, 06:36

Re: Shifting Only Start Position Each Loop

Post by RussF » 16 May 2024, 10:30

You could try this (untested):

Code: Select all

Loop, 32
{

SetTitleMatchMode, 2
CoordMode, Mouse, Window

tt = Issues
WinWait, %tt%
IfWinNotActive, %tt%,, WinActivate, %tt%

Sleep, 600

MouseClick, L, 1464, (604 + ((A_Index - 1) * 50) ; Select task line (I want to shift this command down 50 pixels after each loop)

Sleep, 600

MouseClick, L, 3428, 1769 ; Select location details line

Sleep, 600

MouseClick, L, 3428, 1769,,, D ; Begin highlighting

Sleep, 1000

MouseClick, L, 3456, 1757,,, U ; End highlighting

Sleep, 600

MouseClick, R, 3439, 1766 ; Open paste menu

Sleep, 600

MouseClick, L, 3082, 1285 ; Select paste

Sleep, 600

}
You must have a 4k display at 100% scaling, because moving 50 pixels down 50 times is 2500 pixels, added to the starting value of 604 exceeds the resolution of a 1440P monitor.

[Edit] - See my notes on a subsequent message

Russ
Last edited by RussF on 16 May 2024, 11:59, edited 2 times in total.
User avatar
boiler
Posts: 17279
Joined: 21 Dec 2014, 02:44

Re: Shifting Only Start Position Each Loop

Post by boiler » 16 May 2024, 11:39

In case it's not clear why this line would cause an error, a space is needed before the semicolon for it to be seen as a comment:

Code: Select all

MouseClick, L, 1464, (604 + ((A_Index - 1) * 50); Select task line (I want to shift this command down 50 pixels after each loop)
Like this:

Code: Select all

MouseClick, L, 1464, (604 + ((A_Index - 1) * 50) ; Select task line (I want to shift this command down 50 pixels after each loop)
RussF
Posts: 1301
Joined: 05 Aug 2021, 06:36

Re: Shifting Only Start Position Each Loop

Post by RussF » 16 May 2024, 11:55

Thank you @boiler - a typo on my part. I will fix the code above.

As I think about it, I was getting my x and y confused regarding displays, and even a 4k display at 100% scaling would not be able to support a y value of 3054, since a 4k display has a resolution of 3840 (x) by 2160 (y).

The largest number of iterations you could achieve is 32 (starting at 604). I have edited the code above for this as well.

Russ
starkel
Posts: 2
Joined: 16 May 2024, 09:32

Re: Shifting Only Start Position Each Loop

Post by starkel » 17 May 2024, 09:45

Thank you everyone for the help! It was exactly what I needed, regarding the computer monitor: I have the screen in portrait mode with a further out zoom to let me see all of the lines.

This makes updating 2,000+ entries a whole lot less tedious.
Post Reply

Return to “Ask for Help (v1)”