Autohotkey script: increment/decrement values with pen

Post Reply
User avatar
KenC
Posts: 174
Joined: 14 Aug 2009, 09:28
Location: Denmark

Autohotkey script: increment/decrement values with pen

Post by KenC »

Here's an autohotkey script I came up with to change values up/down with the mouse/pen.

This allows you to setup hotkeys in TVPaint and then hit a hotkey assigned with Autohotkey to move the cursor up/down to change a value.

Some things you can do:

Hue up/down
Saturation up/down
Luminance up/down
Size up/down
Zoom in/out
Rotate canvas left/right

Basically anything that can be assigned 2 hotkeys in TVPaint to inc/dec a value can be done. Hit the key once and move the cursor up and down, hit the key again to continue working.

You just hit the hotkey and move the cursor on the screen and values go up or down.

If you don't have Autohotkey you can download it for free at: http://www.autohotkey.com/download/

Just copy the script from below and paste it into a text file with an .ahk extension and name it whatever you want. Doubleclick the file to run it. You can put it into your windows startup folder so it always starts with windows. Don't know about Mac.

You have to change a few easy things to hook it up to whatever keys you want. You can copy the section below and paste it multiple times with different keys to duplicate it for the things you want. Just look at the comments in the script to see what you have to change.

If you have TVPaint standard change the first line to:

#ifWinActive ahk_class TVP Animation 9

Code: Select all

#ifWinActive ahk_class TVP Animation 9 Pro
{
;Mess with this if moving the pen takes to much CPU
setbatchlines, 500ms 

#MaxThreadsPerHotkey 2

bbrake=1 

Coordmode, mouse, Screen

;This is the shortcut (m) you use to activate, look in AHK Help for special keycodes.
;Make sure this key is not bound to any function you need in TVPaint as this key will override that key.
m:: 
    MouseGetPos,, old_mousey 

    if bbrake 
    { 
        bbrake=0 
    } 
    else if !bbrake 
    { 
        bbrake=1 
        return 
    } 

    loop 
    { 
        MouseGetPos,, mousey 
    
        if ((mousey=old_mousey) and (bbrake != 1)) 
            continue
        else if bbrake=1 
            break 
    
        if (mousey > old_mousey) 
        { 
;Cursor move up. Change to a key you have set in TVPaint to increase something.
            send, {numpad4} 
            old_mousey:=mousey
        } 
        else if (mousey < old_mousey) 
        { 
;Cursor move down. Change to a key you have set in TVPaint to decrease something.
            send, {numpad6} 
            old_mousey:=mousey
        } 
    } 

return

}

Any questions just ask and I'll see if I can help.
There's no place like ~/
Post Reply