autohotkeypaint.net

AutoHotkey's MouseClickDrag issues in dealing with selecting Paint.NET images squared area?


(If you want to reproduce this example, please download Paint.NET from here, it's free and it's got more functions than Microsoft Paint).

When you open Paint.NET, load a simple image and take rectangular selection as instrument.

I've written this simple script:

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

^d::
MouseClickDrag, Left, 365, 434, 906, 460
;You can change mouse coordinates as you wish
Send, ^c
Return

Run it with Ctrl + d.

I'm not able to select the area described by those coordinates, while using the rectangular color filling instrument works fine.

It seems AutoHotkey does not highlight the area if I use the rectangular selector.

Have you got the same issue?


Solution

  • If SendMode Input doesn't work, Event usually does. Unfortunately, it's not as fast as Input, so playing around with SetKeyDelay may help going against that effect.
    However, if you're looking for a way to manipulate images automatically, I recommend using GDI+.