Programming with Autohotkey for screenshots

Robert

Elquin

Programming with Autohotkey for screenshots

February 03 2016
I'm really bad with coding and I've tried different suggestions from reddit (unhelpful) and stackoverflow (rude and unhelpful) but the script I'm trying to figure out for AutoHotkey isn't working.

It's extremely simple what I want to have done. I just want the right mouse button to be pressed down and drag 1 pixel in the specified direction. This seems to work with the script I'm currently using and will move the screen by 1 pixel to the left or up depending on whether I enter 1 into the X or Y coordinate. If I want to reverse the direction of the X/Y movement and put in -1, the scrip doesn't work at all. The mouse still moves, but it never right clicks and nothing happens. I'm just getting frustrated with this and hope someone can hellp me out.

This is the script I'm using now and again, it will work for moving in one direction either left or down, but will not work once I change the x or y to -1.

#Persistent

$F10::Capture()
Numpad0::ExitApp

Capture()
{
    hours := 1.0
    Loop, % hours*720
    {
        Click Down Right
        MouseMove, 0, 1, 0, R
        Send, {PrintScreen}
        Sleep, 2000
    }
}


This code was the only answer I got in reddit and it just doesn't work at all... :(

up::
down::
left::
right::capture(a_thishotkey)

capture(xy) {
    static go := 0  ; a way to know the function is still running
    if go
        return  ; loop is already active, get me out of here
    hours := 1  ; no decimal unless you really want fractions
    go := 1
    loop % hours * 720 
    {
        if (go := 0)
        click down right
        if (xy = "up")
            mousmove,, -1, r
        if (xy = "down")
            mousmove,, 1, r
        if (xy = "left")
            mousmove -1,, r
        if (xy = "right")
            mousmove 1,, r
        send {printscreen}
        click up right  ; let go before continuing
        sleep 2000
    }
    go := 0 ; loop has finished
}


Thank you so much for helping. *fingers crossed*
Edited February 03 2016 by Elquin
Jamie

tuvak

Programming with Autohotkey for screenshots

February 03 2016
Code zero zero zero destruct zero.
2 people liked this