I really hope IL will decide to implement a similar system simply because.... it's so cool!
The script doesn't need any extra tweaking unless you want to edit the preset colors I made.
Here you can see it in action:
What it does in detail:
Whenever you press F2 or Mbutton to open the 'Rename box':
- Consecutive F2 hits will randomize the color by first setting it to fully saturated, then will perform a random click inside the color wheel
- WheelDown does the same (in case you don't want to use your keyboard at all)
- WheelUp opens the Color Palette editor and starts to scrolls clockwise through 17 fully saturated colors (palette stays open)
- once the Color Palette editor is active, WheelDown scrolls counterclockwise through the same 17 colors
- Left Click anywhere to confirm the color and move the cursor directly on the tick icon of the Rename box, ready to accept the changes you've made.
- F3 = Enter x2 (confirms Color + Rename box changes)
- Esc or Right Click = discard changes
Once the Color selector window is open (to open it simply left click as you'd normally do when you want to change a color):
- Freely scroll up/down to choose the color you want between those 17 presets (feel free to edit them)
- Ctrl+Wheelup/WheelDown allow more precise color selections for many more in-between colors
- Alt+Wheelup/WheelDown changes the Luminance for the currently selected color
- pressing 'D' on your keyboard resets color to Default, confirms and moves cursor to tick icon of the Rename box, ready to accept the changes you've made.
- F2 randomizes color in the same way but the Color Palette editor stays open (Left Click to confirm, Right Click or Esc to discard)
- F3 = Enter x2 (confirms Color + Rename box changes)
- Esc or Right Click= discard changes
NOTE: In case something messes up, you can press Ctrl and while pressed the Left Mouse button will work again as without the script
Here the script:
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#Persistent
#singleInstance force
#Keyhistory 500
setKeyDelay, 5, 5
setMouseDelay, 20
#MaxHotkeysPerInterval 2000
SetDefaultMouseSpeed, 0
{ ; Pi rule for Color Wheel
pi = 3.141592653589793
Radius = 120
rad2degree(rad)
{
global pi
return rad*180/pi
}
degree2rad(degree)
{
global pi
return degree*pi/180
}
}
#IfWinActive, ahk_class TNameEditForm
{ ; VARIOUS STUFF
F2::
MouseGetPos, xDname, yDname
click 260,30
WinWaitActive ahk_class TPaletteEditorForm
click r 220,460
sendraw 120
send {Enter}
Random, OutX, -1.0, 1.0
Random, Sign, -1.0, 1.0
OutY := Round((sqrt(1 - OutX ** 2) * 118 * Sign) + 196)
OutX := Round((OutX * 118) + 148)
Click %OutX%, %OutY%
send {Enter}
WinWaitActive ahk_class TNameEditForm
MouseMove 40,50 ;260,30
return
LButton::
MouseGetPos, xRme2, yRme2
if ( xRme2 = 40 and yRme2 = 50 )
{
click
WinWaitClose ahk_class TNameEditForm
MouseMove LOLAX, LOLAY
}
else
Click
return
Rbutton::
MouseGetPos, xout2, yout2,, yo
if yo = TNewCaption1
send {Esc}
else
send {Rbutton}
return
WheelUp::
MouseGetPos, xoD, yoD
click 260,30
WinWaitActive ahk_class TPaletteEditorForm
click r 220,460
sendraw 120 ; this sets the Luminance to 120
send {Enter}
MouseMove 149, 77
click
MouseGetPos, baseX, baseY
baseY -= Radius
Angle = 0
return
WheelDown::
MouseGetPos, xoD, yoD
click 260,30
WinWaitActive ahk_class TPaletteEditorForm
click r 220,460
sendraw 120 ; this sets the Luminance to 120
send {Enter}
Random, OutX, -1.0, 1.0
Random, Sign, -1.0, 1.0
OutY := Round((sqrt(1 - OutX ** 2) * 118 * Sign) + 196)
OutX := Round((OutX * 118) + 148)
Click %OutX%, %OutY%
send {Enter}
MouseMove -240, 50
WinWaitActive ahk_class TNameEditForm
MouseGetPos, baseX, baseY
baseY -= Radius
Angle = 0
return
Pause::Enter
return
*Ins::n
return
F3::
Send {Enter}
return
}
#IfWinActive
#IfWinActive, Color selector ahk_class TPaletteEditorForm
{ ; COLOR PALETTE HACK
Alt & WheelUp::
MouseGetPos, xcol1, ycol1
MouseMove, 216,460
send +{WheelUp 30}
mousemove, xcol1, ycol1
Return
Alt & WheelDown::
MouseGetPos, xcol2, ycol2
MouseMove, 216,460
send +{WheelDown 30}
mousemove, xcol2, ycol2
Return
$WheelUp::
Loop, 12
{
Angle -= 1.8
newX := baseX - Radius*sin(degree2rad(angle))
newY := baseY + 240 - Radius*cos(degree2rad(angle))
click, %newX%, %newY%
}
Return
$WheelDown::
Loop, 12
{
Angle += 1.8
newX := baseX - Radius*sin(degree2rad(angle))
newY := baseY + 240 - Radius*cos(degree2rad(angle))
click, %newX%, %newY%
}
Return
Ctrl & WheelUp::
Loop, 5
{
Angle -= 1.8
newX := baseX - Radius*sin(degree2rad(angle))
newY := baseY + 240 - Radius*cos(degree2rad(angle))
click, %newX%, %newY%
;click
}
Return
Ctrl & WheelDown::
Loop, 5
{
Angle += 1.8
newX := baseX - Radius*sin(degree2rad(angle))
newY := baseY + 240 - Radius*cos(degree2rad(angle))
click, %newX%, %newY%
;click
}
Return
Lbutton::
MouseGetPos, x, y,, awe
if awe = TVectorPanel2
{
send {Enter}
WinWaitActive ahk_class TNameEditForm
MouseMove 40,50
}
else
click
return
Rbutton::
Send {Esc}
return
D::
MouseGetPos, xD, yD
click 312,351
MouseMove xD, yD
Send {Enter}
WinWaitActive ahk_class TNameEditForm
MouseMove 40,50
return
*F2::
Random, OutX, -1.0, 1.0
Random, Sign, -1.0, 1.0
OutY := Round((sqrt(1 - OutX ** 2) * 118 * Sign) + 196)
OutX := Round((OutX * 118) + 148)
Click %OutX%, %OutY%
return
F3::
Send {Enter 2}
return
$Enter::
Send {Enter 2}
return
}
#IfWinActive