Jump to content

Random Paint (Script Paints in Paint)


TimCunningham
 Share

Recommended Posts

Hello AutoIT forms! First post so I thought I'd make it fun! :bike:

I used AutoIT to actually "paint" in MS Paint. What it is actually doing is randomly picking random colors, using random tools, and drawing circles, boxes, and spirals-randomly.

It may or may not be a good introduction to AutoIT as it is what I used to introduce myself to the code.

The DrawCircle() Function may be interesting to some as well as DrawSpiral().

Also, as a bonus, it draws Zapdos by clicking points exactly (so your screen resolution will unfortunately have to be the same size as mine 1366x768). If you guys can think of a great way to make those clicks work on any computer I really do need something along those lines as I need scripts to work on multiple computers that already have points setup and don't work on other machines.

Anyhow I tried to put as much comments in the codes as possible to help explain what my code is doing. If it doesn't work, it is probably because this is my first actual script with this program so please, criticism is very welcomed!

If you notice in the comments section at the top I am trying to think of a way to make the program draw better. Right now, Pointilloop() only looks like a really scrambled TV. It has no shape at all. Same with Pointillism() from what I have seen. The DrawRandomPictures() is somewhat neat, sometimes and can actually produce some things that had a human produced them on a large scale I could see them ending up in an art show! Haha

http://tinypic.com/r/xrarl/6

http://tinypic.com/r/2usyio6/6

http://tinypic.com/r/34glzs8/6

http://tinypic.com/r/20if13o/6

http://tinypic.com/r/ljdqe/6

Yet once again I would like to better it and I would imagine this requiring some form of basic AI. Unless I am missing something else. Technically speaking there is no such thing as random in a computer so the computer is really picking the numbers thus actually "drawing" but I need to teach it how to draw better. Or to put another way, how to pick numbers better perhaps. Thoughts?

The code (finally after a long rant :dance:) (Also I am attempting to upload some example pictures too)

#cs ----------------------------------------------------------------------------

AutoIt Version: 3.2.12.1
Author:         Tim Cunningham

Script Function: Opens paint and draws random pictures (Can also draw Zapdos if your screen resolution is set 
to 1600x900

Paint in Paint

Things that I think I should add: 
Pointillism [x]
Pick a thinkness size (look in the zapdos part) [x]
Color 2 option for a fill in shapes 
A way for the picture to look waaaay less random/not like scribbles (AI?) 

#ce ----------------------------------------------------------------------------


#cs================================================================================
Cords for the different buttons: 
Pencil: $x/5.5, $y/11
Bucket: $x/4.981, $y/11
Text A: $x/4.6533, $y/11
Edit Colors cord: $x/1.3525, $y/11
Eraser: $x/5.5, $y/7.5

#ce================================================================================ 


#cs================================================================================
Main Code
#ce================================================================================

#include <Math.au3>
Global $coord[2]

;Open paint and maximuze the program
Run("mspaint.exe", "", @SW_MAXIMIZE)
Sleep(500)

;Get's the size of paint and defines them to variables to use for different computers 
$size = WinGetClientSize("Untitled - Paint")
$x = $size[0]
$y = $size[1]

Sleep(500) 
;MsgBox(0,"Resolution","Pain resolution is " & @lf & $size[0] & " by " & $size[1],2)

;I have these all commented out because each one of these takes a long time to do 
;DrawRandomPictures()  ;this can take avg of 12 hours to draw all 100 pictures
;Zapdos() ;this takes about five minutes
;Pointillism() ;this takes more than 3 days...
;Pointilloop() ;Never actually finished one. Probably would take a good week 

#cs================================================================================
Functions
#ce================================================================================


Func DrawRandomPictures()
   ;Draw a set number of pictures and saves them to whatever the default folder is when you hit F12
   For $saveCount = 1 to 100 Step 1 

   ;Crop the area to pretty much the size of the screen
   MouseClick("left", $x/9.5, $y/11)
   Sleep(200)
   MouseClickDrag("left",0+5,$y/5.10,$x/1.1, $y/1.05)
   Sleep(200)
   MouseClick("left", $x/8, $y/11.5)
   MouseClick("left",$x/5.5, $y/11)

   ;Create a loop to do random drawing by the computer
   For $i = 1 to 50 Step 1

 ;creates a random number to pick from which actions to do 
 $theRandomNumber = Random(1,7,1)

 ;I used $x*.8 and $y*.8 because the $x and $y varaibles are from the entire paint screen and if you look
 ;at paint right now, you can see tons of white space (depending on your monitor), off to the right. And there is a lot of now-paint
 ;area as well on the y-axis. I don't want to be clicking these spots so I make sure that the random numbers generated can't go that high

 Select 
Case $theRandomNumber = 1
RandomColor(0)
Case $theRandomNumber = 2
DrawBox(Random(1,200),Random(1,$x*.7),Random($y*.3,$y*.8))
Case $theRandomNumber = 3
DrawSpiral(Random(1,3),Random(1,40),Random(-40,40),Random(-40,40),Random(1,$x*.7),Random($y*.3,$y*.8))
Case $theRandomNumber = 4
DrawCircle(Random(1,200),Random(1,$x*.7),Random($y*.3,$y*.8))
Case $theRandomNumber = 5
RandomFill(Random(1,$x*.7),Random($y*.3,$y*.8))
Case $theRandomNumber = 6
DrawSymbol(Random(1,200),Random(1,$x*.7),Random($y*.3,$y*.8))
Case $theRandomNumber = 7
DrawSymbol(Random(1,200),Random(1,$x*.7),Random($y*.3,$y*.8))
Case Else
MsgBox(0,"Oh nose!","Something went wrong Random number generated was: " & $theRandomNumber)
 EndSelect

 Next
 Save($saveCount)  
 Send("^n")
   Next

EndFunc

Func DrawSymbol($length, $xPos, $yPos)

$picker = Random(1,7,1)

Select
   Case $picker = 1 
 ;Rounded Rectangle
 MouseClick("left",$x/3, $y/11)
 MouseClickDrag("left", $xPos, $yPos, $xPos + Random(10, $x), $yPos + Random(10,$y))

Case $picker = 2
 ;Rectangle
 MouseClick("left",$x/3.1, $y/11)
 MouseClickDrag("left", $xPos, $yPos, $xPos + Random(10, $x), $yPos + Random(10,$y))

   Case $picker = 3
 ;Oval
 MouseClick("left",$x/3.2, $y/11)
 MouseClickDrag("left", $xPos, $yPos, $xPos + Random(10, $x), $yPos + Random(10,$y))

   Case $picker = 4
 ;Curve
 MouseClick("left",$x/3.4, $y/11)

 ;Curve tool starts out with a click and drag then needs two clicks for the curves
 ;The clicks can be anywhere and the curve will adjust according to the click placement
 MouseClickDrag("left", $xPos, $yPos, $xPos + Random(10, $x), $yPos + Random(10,$y))
 MouseClick("left", Random(1,$x*.7), Random($y*.3,$y*.8))

 ;I wanted to have the option of having only one curve so I made an if statement and a random true false to see if the second curve should be used
 $z = Random(0,1,1) 
 If $z = 1 Then 
MouseClick("left", Random(1,$x*.7), Random($y*.3,$y*.8))
 Else
Pencil() 
 EndIf 

   Case $picker = 5
 ;Line
 MouseClick("left",$x/3.6, $y/11)
 MouseClickDrag("left", $xPos, $yPos, $xPos + Random(10, $x), $yPos + Random(10,$y))


   Case $picker = 6
 ;Polygon
 MouseClick("left",$x/2.8, $y/11)

 ;Polygon tool uses a click and drag for the first line so that's what I use.
 ;Click and drag to a random place 
 MouseClickDrag("left", $xPos, $yPos, $xPos + Random(10, $x), $yPos + Random(10,$y))

 ;Then I allow the computer to use up to $length points on polygon. With this tool you can click anywhere and the next 
 ;line will continue from the previous endpoint of the previous line
 ; I do this until $length is reached
 For $i =1 to Random(3,10,1) Step 1 
MouseClick("left", Random(1,$x*.7), Random($y*.3,$y*.8))
 Next

 ;Then I have it click exactly where the line started thus ending the loop 
 MouseClick("left", $xPos, $yPos)


   Case $picker = 7
 ;Triagnle
 MouseClick("left",$x/2.7, $y/11)
 MouseClickDrag("left", $xPos, $yPos, $xPos + Random(10, $x), $yPos + Random(10,$y))

EndSelect


EndFunc

Func Save($fileName)
 Send("{F12}")
 Sleep(600)
 Send("Picture" & $fileName)
 Sleep(500)
 Send("{ENTER}")
EndFunc

Func Cut()
   ;Cuts the paint area to the size of the screen
   MouseClick("left", $x/9.5, $y/11)
   Sleep(200)
   MouseClickDrag("left",0+5,$y/5.10,$x/1.1, $y/1.05)
   Sleep(200)
   MouseClick("left", $x/8, $y/11.5)
   MouseClick("left",$x/5.5, $y/11)
EndFunc

Func DrawSpiral($loops, $r, $xWarp, $yWarp, $xCent, $yCent)

;Click the pencil
Pencil()

For $i = 0 to 360*$loops Step 1
   $r = $r + .08
   $circleX = $r * Cos(_Radian($i) + $xWarp) 
   $circleY = $r * Sin(_Radian($i) + $yWarp)
   If $i=0 Then
 MouseMove($xCent+$circleX,$yCent+$circleY)
 MouseDown("left")
   EndIf   

   MouseMove($xCent+$circleX,$yCent+$circleY)

   ;check to see if the mouse leaves a large screen area and if it does go back to the select case to do another function
   ;this is because the spiral takes a long time to draw and if it is offscreen somewhere we don't want to wait for it to finish just for nothing :) 
   $mousepos = mousegetpos()
   If $mousePos[0] >= $x Then ExitLoop   
   If $mousePos[1] >= $y Then ExitLoop 
   If $mousePos[0] <= 1 Then ExitLoop
   If $mousePos[1] < $y*.2 Then ExitLoop

Next

MouseUp("left")

EndFunc

;Draw a perfect circle
Func DrawCircle($r, $xCent, $yCent)

;Click the pencil
Pencil()

For $i = 0 to 360 Step 1
   $circleX = $r * Cos(_Radian($i)) 
   $circleY = $r * Sin(_Radian($i))
   If $i=0 Then
 MouseMove($xCent+$circleX,$yCent+$circleY)
 MouseDown("left")
   EndIf   
   MouseMove($xCent+$circleX,$yCent+$circleY)

   ;if mouse leaves large drawing space we move on to another draw function 
   $mousepos = mousegetpos()
   If $mousePos[0] >= $x Then ExitLoop   
   If $mousePos[1] >= $y Then ExitLoop 
   If $mousePos[0] <= 5 Then ExitLoop
   If $mousePos[1] < $y*.195 Then ExitLoop

Next
MouseUp("left")

EndFunc

;Draw a Box
Func DrawBox($length, $xPos, $yPos)
;Click the pencil
Pencil()

MouseClickDrag("left", $xPos, $yPos, $xPos, $yPos + $length)
MouseClickDrag("left", $xPos, $yPos, $xPos + $length, $yPos)
MouseClickDrag("left", $xPos + $length, $yPos, $xPos + $length, $yPos + $length)
MouseClickDrag("left", $xPos, $yPos + $length, $xPos + $length, $yPos + $length)

EndFunc

;Fill a random area with the paint bucket tool and then select a new color
Func RandomFill($xPos, $yPos) 

;Click the paint bucket tool
MouseClick("left", $x/4.981, $y/11)

;Now click at the random place so it fills with the current selected color
MouseClick("left", $xPos, $yPos)

;Select a new random color so that if the entire area is filled, we can see what is being drawn
RandomColor(0)

EndFunc

;Picks a random color and shade of the picked color (can be black and white) 
Func RandomColor($pickedColor)
;Declare a boolean to false because it does not always find a color and loop until it finds a color and picks it
$foundColor = False

;click the Edit Colors button
MouseClick("left", $x/1.3525, $y/11)

Sleep(500)

$colorWindowSize = WinGetClientSize("Edit Colors")
$xColor = $colorWindowSize[0]
$yColor = $colorWindowSize[1]


$colorPos = WinGetPos("Edit Colors")
$xColorPos = $colorPos[0]
$yColorPos = $colorPos[1]

;$xColorPos + 200, $yColorPos + 35, $xColorPos + 412, $yColorPos + 250, $colorRand
;MouseMove($xColorPos + 412, $yColorPos + 225)


While Not $foundColor

If Not $pickedColor Then
   $colorRand = Hex(Random(0,0xFFFFFF, 1))
   $colorRand = StringTrimLeft($colorRand, 2) 
   $colorRand = StringReplace($colorRand,$colorRand,"0x" & $colorRand)
Else
   $colorRand = $pickedColor
EndIf

;Cords for the color box in Edit Colors to use for pixelsearch 
;Bottom Right: $xColorPos + 412, yColorPos + 225
;Top Right: $xColorPos + 412, $ycolorPos + 37
;Top Left: $xColorPos + 235, $ycolorPos + 37
;Bottom Right: $xColorPos + 412, $ycolorPos + 225

;Finds the color position of the color wanted and selects it from the color range 
$color = PixelSearch($xColorPos + 235, $yColorPos + 37, $xColorPos + 412, $yColorPos + 225, $colorRand, 10)

;if it errors we don't want it to click OK to exit the Edit Colors Box. 
If Not @error Then

   ;Select the color that was found
    MouseClick("left", $color[0], $color[1])
Sleep(500)

If $pickedColor = 0 Then
;Now pick a random shade
$randomShade = Random(38,225)
MouseClick("left", $xColorPos + 440, $yColorPos + $randomShade)

;Now click the Ok button to finalize the selection! Whew! 
MouseClick("left", $xColorPos + 40, $yColorPos + 310)
 Else
MouseClick("left", $xColorPos+440, $yColorPos + 93.5)
MouseClick("left",$xColorPos + 40, $yColorPs + 310) 
   EndIf
$foundColor = True
 EndIf

WEnd

EndFunc

;Reselect the pencil tool to continue drawing 
Func Pencil()
   MouseClick("left",$x/5.5, $y/11)
EndFunc

Func Pointilloop() 
   Cut()
   $xPos = 5
   $yPos = $y*.195

   While 1 
     
 ;Click the point selected
 MouseClick("left", $xPos, $yPos)

 ;MsgBox(0,"$xPos","$xPos is: " & $xPos) 
 ;Add 1 to the $xPos by adding 1 to $xCount
 $xPos = $xPos + 1

 ;These If statements check to see if the pos is now outside of our paint area since we add 1 to x and y in a loop
 If $xPos > $x*.836 Then
$xPos = 5 ;Must set the $xPos back to 0 so it goes back to the beginning of the line 
$yPos = $yPos + 1 ;this adds one to the y-axis thus the next line of pixels is drawn 

 EndIf
 If $yPos > $y*.95 Then
Save("loop") 
ExitLoop ;if it is lower than the paint screen it means the painting is done!  
 EndIf
 ;This will generate a random color 20% of the time (0,1,2,3,4 can be picked and we do RandomColor(0) when 1 is picked) 
 $z = Random(0,4,1)
 If $z = 1 Then 
RandomColor(0) 
 EndIf
   WEnd
EndFunc

Func Pointillism()

   ;Draw a set number of pictures and saves them to whatever the default folder is when you hit F12
   For $saveCount = 1 to 1 Step 1 

 Cut() 

   For $i = 1 to 100000 Step 1
 $xPos = Random(5,$x*.836)
 $yPos = Random($y*.195,$y*.95)

 $z = Random(0,2,1)
 If $z = 1 Then 
RandomColor(0) 
 EndIf
 ;Click the point selected
 MouseClick("left", $xPos, $yPos)

 ;Now I wanted the points of the same color to be sort of around the same area so I set up a for loop 
 ;to add or subtract some amount from the x and y pos a bunch of times
 For $i = 0 to 250 Step 1 
$z = Random(0,2,1) 
If $z = 0 Then 
$xCheck = $xPos + Random(1,50) 
$zZ = Random(0,1,1);I was getting two boxes diagnally from each other if I only did + X and Y pos or - X and Y pos. This will make it more random 
  If $zZ = 0 Then
 $yCheck = $yPos + Random(1,50)
  Else
 $yCheck = $yPos - Random(1,50) 
  EndIf

  ;MouseClick("left", $xCheck, $yCheck)
ElseIf $z = 1 Then
$xCheck = $xPos - Random(1,50)
$zZ = Random(0,1,1);I was getting two boxes diagnally from each other if I only did + X and Y pos or - X and Y pos. This will make it more random
If $zZ = 0 Then
 $yCheck = $yPos + Random(1,50)
  Else
 $yCheck = $yPos - Random(1,50) 
  EndIf

;These If statements check to see if the pos is now outside of our paint area since we added or subtracted to our random position 
If $xCheck < 5 Then ;if the pos is less then 0 then the click will technically be off the screen so put it at point 1 
  $xCheck = 5 
EndIf
If $yCheck < $y*.195 Then ;this would click above the paint area thus the possibility that another tool is clicked and we lose the brush selected
  $yCheck = $y*.195 
EndIf
If $xCheck > $x*.836 Then
  $xCheck = $x*.836 ;if the point + random number is greater than $x*.7 it would press off of the paint area so that would be a wasted click
EndIf
If $yCheck > $y*.95 Then
 $yCheck = $y*.95 ;same reasoning as the previous if statement except this is even more important as it could click something on the taskbar or the start button  
EndIf
;Finally click the mouse! haha 
MouseClick("left", $xCheck, $yCheck)
Else 
;Do nothing so that it is not exactly 100 points added or subtracted each tiume 
EndIf
 Next ; bunch of pixels loop 

   Next ; Save For Loop 
   Save($saveCount)  
   Send("^n")
   Next

EndFunc

Func Zapdos() 

   Cut() 

   ;Click the polygon tool 
   MouseClick("left",$x/2.8, $y/11)

   ;click the Sizes button
   MouseClick("left", $x/2.15, $y/11)

   ;Now click the 2nd smallest size 
   MouseClick("left", $x/2.15, $y/4)


   ;head-------------------------------------------------
   MouseClickDrag("left", 467, 200, 506, 273)
   MouseClick("left",562,215,1)
   MouseClick("left",542,286,1)
   MouseClick("left",609,267,1)
   MouseClick("left",575,292,1)
   MouseClick("left",640,289,1)
   MouseClick("left",567,335,1)
   MouseClick("left",594,378,1)
   MouseClick("left",533,357,1)
   MouseClick("left",546,392,1)
   MouseClick("left",517,376,1)
   MouseClick("left",499,372,1)
   MouseClick("left",512,361,1)
   MouseClick("left",510,348,1)
   MouseClick("left",502,346,1)
   MouseClick("left",493,334,1)
   MouseClick("left",473,344,1)
   MouseClick("left",469,350,1)
   MouseClick("left",469,362,1)
   MouseClick("left",465,370,1)
   MouseClick("left",448,375,1)
   MouseClick("left",464,346,1)
   MouseClick("left",431,356,1)
   MouseClick("left",460,321,1)
   MouseClick("left",424,269,1)
   MouseClick("left",445,272,1)
   MouseClick("left",436,250,1)
   MouseClick("left",466,274,1)
   MouseClick("left",467, 200,1)

   ;the rest of the beak-------------------------------------------------

   ;Click the curve tool 
   MouseClick("left",$x/3.4, $y/11)   
   MouseClickDrag("left", 498, 371, 423, 451) 
   MouseClick("left", 470, 398)
   Pencil() 

   ;Click the curve tool 
   MouseClick("left",$x/3.4, $y/11)
   MouseClickDrag("left", 420, 454, 465, 369)
   MouseClick("left", 449, 394) 
   Pencil() 

   ;lip -------------------------------------------------

   ;Click the curve tool 
   MouseClick("left",$x/3.4, $y/11)
   MouseClickDrag("left", 510, 349, 489, 379)
   MouseClick("left", 497, 362) 
   Pencil() 

   ;Click the brushes ToolTip
   MouseClick("left",$x/4.15,$y/11,1)

   ;Draw the nostril 
   MouseClickDrag("left",493,347,485,356)
   MouseClickDrag("left",492,344,487,355)

   Pencil() 

   ;Eyes-------------------------------------------------

   ;Left-------------------------------------------------
   Pencil() 

   ;Click the polygon tool 
   MouseClick("left",$x/2.8, $y/11)

   ;click the Sizes button
   MouseClick("left", $x/2.15, $y/11)

   ;Now click the smallest size 
   MouseClick("left", $x/2.15, $y/5.6)

   MouseClickDrag("left",497, 340,507,331)
   MouseClick("left",516,323,1) 
   MouseClick("left",524,317,1)
   MouseClick("left",546,307,1)
   MouseClick("left",541,317,1)
   MouseClick("left",535,327,1)
   MouseClick("left",533,335,1)
   MouseClick("left",520,341,1)
   MouseClick("left",502,345,1)
   MouseClick("left",499,344,1)
   MouseClick("left",497, 340,1) 

  ;Little curve in the eye-----------------------------------------------------

  ;Click the curve tool 
   MouseClick("left",$x/3.4, $y/11)
   MouseClickDrag("left", 499, 343, 517, 340)
   MouseClick("left", 516, 327) 
   MouseClick("left", 523, 315) 

   ;Fill the surronding eye-----------------------------------------------------

   ;Click the paint bucket tool
   MouseClick("left", $x/4.981, $y/11)
   MouseClick("left", 531, 326) 
   Pencil() 

   ;Left Pupil------------------------------------------------------------------

   ;Click the curve tool 
   MouseClick("left",$x/3.4, $y/11)
   MouseClickDrag("left", 502, 345, 513, 342)
   MouseClick("left", 510, 335)

   ;Fill the pupil--------------------------------------------------------------

   ;Click the paint bucket tool
   MouseClick("left", $x/4.981, $y/11)
   MouseClick("left", 509, 342) 


   ;Right-------------------------------------------------

   ;Click the polygon tool 
   MouseClick("left",$x/2.8, $y/11)
   MouseClickDrag("left",489,335,478,324)
   MouseClick("left",470,310,1)
   MouseClick("left",469,323,1)
   MouseClick("left",469,332,1)
   MouseClick("left",471,337,1)
   MouseClick("left",473,341,1)
   MouseClick("left",480,341,1)
   MouseClick("left",489,335,1)

   ;Little curve in the eye------------------------------------------------- 

  ;Click the curve tool 
   MouseClick("left",$x/3.4, $y/11)
   MouseClickDrag("left", 485, 339, 476, 342)
   MouseClick("left", 472, 315) 
   MouseClick("left", 475, 336) 

   ;Fill the surronding eye-----------------------------------------------

   ;Click the paint bucket tool
   MouseClick("left", $x/4.981, $y/11)
   MouseClick("left", 472, 321) 
   Pencil() 

   ;Right Pupil-------------------------------------------------------

   ;Click the curve tool 
   MouseClick("left",$x/3.4, $y/11)
   MouseClickDrag("left", 480, 340, 477, 342)
   MouseClick("left", 479, 328) 
   MouseClick("left", 476, 335) 

   ;Fill the pupil-----------------------------------------------------

   ;Click the paint bucket tool
   MouseClick("left", $x/4.981, $y/11)
   MouseClick("left", 479, 337) 
   Pencil()


   ;Left Wing-------------------------------------------------

   ;Click the draw line tool 
   MouseClick("left",$x/3.6, $y/11)

   ;click the Sizes button
   MouseClick("left", $x/2.15, $y/11)

   ;Now click the 2nd smallest size 
   MouseClick("left", $x/2.15, $y/4)
   Sleep(500) 


   MouseClickDrag("left",597,292,760,182)
   MouseClick("left",$x/2, $y/2)

   MouseClickDrag("left",760,182,712,253)
   MouseClick("left",$x/2, $y/2)

   MouseClickDrag("left",712,253,1025,152)
   MouseClick("left",$x/2, $y/2)

   MouseClickDrag("left",1025,152,777,341)
   MouseClick("left",$x/2, $y/2)

   MouseClickDrag("left",777,341,933,352)
   MouseClick("left",$x/2, $y/2)

   MouseClickDrag("left", 933 ,352, 641, 417)
   MouseClick("left",$x/2, $y/2)
   MouseClickDrag("left", 641, 417, 728, 486) 
   MouseClick("left",$x/2, $y/2)

   ;After the toe -------------------------------------------------
   MouseClickDrag("left", 740, 497, 784, 536)
   MouseClick("left",$x/2, $y/2)
   MouseClickDrag("left", 784, 536, 721, 516) 
   MouseClick("left",$x/2, $y/2)

   ;In between the toes -------------------------------------------------
   MouseClickDrag("left", 697, 504, 671, 491) 
   MouseClick("left",$x/2, $y/2)
   MouseClickDrag("left", 643, 480, 608, 465) 
   MouseClick("left",$x/2, $y/2)

   ;Curve for left side of the body -------------------------------------------------
   MouseClick("left",$x/3.4, $y/11) ;curve tool   
   MouseClickDrag("left", 583, 440, 588, 394)
   MouseClick("left", 589, 399) 
   Pencil()

   ;Tail wing -------------------------------------------------

   ;Click the polygon tool 
   MouseClick("left",$x/2.8, $y/11)

   ;MouseClickDrag("left",618,598,634,641)
   MouseClickDrag("left", 574,505,572,521)
   MouseClick("left",617,552,1)
   MouseClick("left",606,569,1)
   MouseClick("left",604,576,1)
   MouseClick("left",606,580,1)
   MouseClick("left",611,585,1)
   MouseClick("left",641,667,1)
   MouseClick("left",642,691,1)
   MouseClick("left",627,682,1)
   MouseClick("left",610,660,1)
   MouseClick("left",576,618,1)
   MouseClick("left",573,617,1)
   MouseClick("left",575,608,1)
   MouseClick("left",565,659,1)
   MouseClick("left",558,693,1)
   MouseClick("left",552,705,1)
   MouseClick("left",536,634,1)
   MouseClick("left",528,613,1)
   MouseClick("left",503,637,1)
   MouseClick("left",478,664,1)
   MouseClick("left",461,685,1)
   MouseClick("left",467,645,1)
   MouseClick("left",490,586,1)
   MouseClick("left",470,592,1)
   MouseClick("left",411,618,1)
   MouseClick("left",457,572,1)
   MouseClick("left",488,549,1)
   MouseClick("left",509,531,1)
   MouseClick("left",496,507,1)
   MouseClick("left",574,505,1)


   ;Click the eraser tool so we can erase the line that was automatically drawn 
   MouseClick("left", $x/5.5, $y/7.5)

   ;Erase the line 
   MouseClickDrag("left", 496, 506, 574, 504)

   Pencil() 

   ;Touch up the lines because of the erasing just did

   ;Click the line tool 
   MouseClick("left",$x/3.6, $y/11)
   MouseClickDrag("left",509,531,496,505)
   Pencil() 
   ;Click the line tool 
   MouseClick("left",$x/3.6, $y/11)
   MouseClickDrag("left",575,504,572,521)
   MouseClick("left", $x/2, $y,2) 
   Pencil() 

   ;Back-left-tail-background wings-------------------------------------------------
   MouseClick("left",$x/3.4, $y/11)   
   MouseClickDrag("left", 638, 569, 700, 625)
   MouseClick("left", 671, 590) 
   Pencil()

   MouseClick("left",$x/3.4, $y/11)   
   MouseClickDrag("left", 626, 591, 700, 625)
   MouseClick("left", 652, 605) 
   Pencil()

   MouseClick("left",$x/3.4, $y/11)   
   MouseClickDrag("left", 644, 599, 666, 635)
   MouseClick("left", 655, 616) 
   Pencil()

   MouseClick("left",$x/3.4, $y/11)   
   MouseClickDrag("left", 626, 619, 666, 635)
   MouseClick("left", 643, 624) 
   Pencil()

   ;Left Leg (not foot)-------------------------------------------------

   ;Click the polygon tool 
   MouseClick("left",$x/2.8, $y/11)

   MouseClickDrag("left", 559, 425, 574, 434)
   MouseClick("left",587,443,1)
   MouseClick("left",597,451,1)
   MouseClick("left",606,462,1)
   MouseClick("left",611,469,1)
   MouseClick("left",615,479,1)
   MouseClick("left",616,493,1)
   MouseClick("left",609,495,1)
   MouseClick("left",605,498,1)
   MouseClick("left",604,503,1)
   MouseClick("left",604,506,1)
   MouseClick("left",604,510,1)
   MouseClick("left",596,510,1)
   MouseClick("left",587,509,1)
   MouseClick("left",580,506,1)
   MouseClick("left",576,505,1)
   MouseClick("left",569,501,1)
   MouseClick("left",562,495,1)
   MouseClick("left",557,492,1)
   MouseClick("left",553,488,1)
   MouseClick("left",549,486,1)
   MouseClick("left",547,481,1)
   MouseClick("left",559,481,1)
   MouseClick("left",547,467,1)
   MouseClick("left",564,459,1)
   MouseClick("left",548,446,1)
   MouseClick("left",567,441,1)
   MouseClick("left",559, 425,1)

   Pencil() 

   ;Click the polygon tool 
   MouseClick("left",$x/2.8, $y/11)   

   ;Left foot -------------------------------------------------
   MouseClickDrag("left",616,493,609,495)
   MouseClick("left",605,498,1)
   MouseClick("left",604,503,1)
   MouseClick("left",604,506,1)
   MouseClick("left",604,510,1)
   MouseClick("left",624,534,1)
   MouseClick("left",621,544,1)
   MouseClick("left",613,556,1)
   MouseClick("left",606,569,1)
   MouseClick("left",604,576,1)
   MouseClick("left",606,580,1)
   MouseClick("left",611,585,1)
   MouseClick("left",615,593,1)
   MouseClick("left",625,602,1)
   MouseClick("left",625,587,1)
   MouseClick("left",625,582,1)
   MouseClick("left",632,573,1)
   MouseClick("left",639,568,1)
   MouseClick("left",650,562,1)
   MouseClick("left",665,558,1)
   MouseClick("left",679,556,1)
   MouseClick("left",693,556,1)
   MouseClick("left",705,557,1)
   MouseClick("left",714,560,1)
   MouseClick("left",723,561,1)
   MouseClick("left",727,561,1)
   MouseClick("left",730,558,1)
   MouseClick("left",739,554,1)
   MouseClick("left",752,549,1)
   MouseClick("left",745,543,1)
   MouseClick("left",738,540,1)
   MouseClick("left",733,541,1)
   MouseClick("left",731,537,1)
   MouseClick("left",725,535,1)
   MouseClick("left",712,537,1)
   MouseClick("left",702,540,1)
   MouseClick("left",695,540,1)
   MouseClick("left",687,538,1)
   MouseClick("left",685,534,1)
   MouseClick("left",692,530,1)
   MouseClick("left",703,525,1)
   MouseClick("left",715,519,1)
   MouseClick("left",730,513,1)
   MouseClick("left",729,507,1)
   MouseClick("left",747,488,1)
   MouseClick("left",749,487,1)
   MouseClick("left",744,486,1)
   MouseClick("left",736,486,1)
   MouseClick("left",727,488,1)
   MouseClick("left",722,492,1)
   MouseClick("left",712,492,1)
   MouseClick("left",704,497,1)
   MouseClick("left",686,512,1)
   MouseClick("left",677,516,1)
   MouseClick("left",674,518,1)
   MouseClick("left",665,518,1)
   MouseClick("left",658,513,1)
   MouseClick("left",675,482,1)
   MouseClick("left",680,477,1)
   MouseClick("left",680,472,1)
   MouseClick("left",674,469,1)
   MouseClick("left",680,449,1)
   MouseClick("left",667,455,1)
   MouseClick("left",657,466,1)
   MouseClick("left",652,466,1)
   MouseClick("left",645,470,1)
   MouseClick("left",645,484,1)
   MouseClick("left",642,494,1)
   MouseClick("left",633,517,1)
   MouseClick("left",615,491,1)


   ;Curves in toenails -------------------------------------------------
   MouseClick("left",$x/3.4, $y/11)   
   MouseClickDrag("left", 659, 465, 674, 469)
   MouseClick("left", 665, 469) 
   Pencil()
   MouseClick("left",$x/3.4, $y/11)
   MouseClickDrag("left", 722, 493, 730, 505)
   MouseClick("left", 725, 499) 
   Pencil()
   MouseClick("left",$x/3.4, $y/11) 
   MouseClickDrag("left", 734, 542, 731, 558)
   MouseClick("left", 729, 546) 
   Pencil()
   MouseClick("left",$x/3.4, $y/11) 
   MouseClickDrag("left", 626, 582, 610, 583)
   MouseClick("left", 617, 578) 

   Pencil()

   ;Right leg (not foot)-------------------------------------------------

   ;Click the polygon tool 
   MouseClick("left",$x/2.8, $y/11)  

   MouseClickDrag("left",485,431,483,447)
   MouseClick("left",498,446,1)
   MouseClick("left",492,461,1)
   MouseClick("left",507,460,1)
   MouseClick("left",500,480,1)
   MouseClick("left",509,479,1)
   MouseClick("left",502,495,1)
   MouseClick("left",512,500,1)
   MouseClick("left",488,507,1)
   MouseClick("left",469,508,1)
   MouseClick("left",454,507,1)
   MouseClick("left",459,500,1)
   MouseClick("left",459,492,1)
   MouseClick("left",453,489,1)
   MouseClick("left",446,490,1)
   MouseClick("left",450,476,1)
   MouseClick("left",459,461,1)
   MouseClick("left",471,444,1)
   MouseClick("left",485,431,1)


   ;Right foot-------------------------------------------------
   Pencil() 

   ;Click the polygon tool 
   MouseClick("left",$x/2.8, $y/11)   

   MouseClickDrag("left",454,507,459,500)
   MouseClick("left",459,492,1)
   MouseClick("left",453,489,1)
   MouseClick("left",446,490,1)
   MouseClick("left",420,512,1)
   MouseClick("left",411,497,1)
   MouseClick("left",391,455,1)
   MouseClick("left",382,453,1)
   MouseClick("left",371,445,1)
   MouseClick("left",358,446,1)
   MouseClick("left",368,458,1)
   MouseClick("left",365,466,1)
   MouseClick("left",381,486,1)
   MouseClick("left",387,503,1)
   MouseClick("left",377,501,1)
   MouseClick("left",360,495,1)
   MouseClick("left",343,486,1)
   MouseClick("left",332,482,1)
   MouseClick("left",323,484,1)
   MouseClick("left",309,486,1)
   MouseClick("left",299,492,1)
   MouseClick("left",315,494,1)
   MouseClick("left",326,500,1)
   MouseClick("left",333,506,1)
   MouseClick("left",350,509,1)
   MouseClick("left",371,516,1)
   MouseClick("left",343,518,1)
   MouseClick("left",324,520,1)
   MouseClick("left",321,529,1)
   MouseClick("left",308,546,1)
   MouseClick("left",326,539,1)
   MouseClick("left",336,543,1)
   MouseClick("left",354,536,1)
   MouseClick("left",365,536,1)
   MouseClick("left",374,536,1)
   MouseClick("left",384,537,1)
   MouseClick("left",394,539,1)
   MouseClick("left",405,545,1)
   MouseClick("left",409,554,1)
   MouseClick("left",410,566,1)
   MouseClick("left",415,570,1)
   MouseClick("left",416,580,1)
   MouseClick("left",412,588,1)
   MouseClick("left",421,587,1)
   MouseClick("left",427,579,1)
   MouseClick("left",427,568,1)
   MouseClick("left",433,558,1)
   MouseClick("left",428,544,1)
   MouseClick("left",426,532,1)
   MouseClick("left",433,523,1)
   MouseClick("left",454,507,1)


   ;Curves in toenails-------------------------------------------------
   MouseClick("left",$x/3.4, $y/11)   
   MouseClickDrag("left", 367, 459, 382, 452)
   MouseClick("left", 382, 460) 
   Pencil()
   MouseClick("left",$x/3.4, $y/11)
   MouseClickDrag("left", 326, 499, 329, 483)
   MouseClick("left", 331, 493) 
   Pencil()
   MouseClick("left",$x/3.4, $y/11) 
   MouseClickDrag("left", 322, 525, 328, 538)
   MouseClick("left", 331, 530) 
   Pencil()
   MouseClick("left",$x/3.4, $y/11) 
   MouseClickDrag("left", 417, 573, 428, 569)
   MouseClick("left", 424, 572) 

   ;Right wing-------------------------------------------------

   ;Click the draw line tool 
   MouseClick("left",$x/3.6, $y/11)

   MouseClick("left",$x/2, $y/2)   
   MouseClickDrag("left",343,485,366,457)
   MouseClick("left",$x/2, $y/2)
   MouseClickDrag("left",375,448,398,421)
   MouseClick("left",$x/2, $y/2)
   MouseClickDrag("left",399,423,144,344)
   MouseClick("left",$x/2, $y/2)
   MouseClickDrag("left",144,344,310,342)
   MouseClick("left",$x/2, $y/2)
   MouseClickDrag("left",310,342,113,182)
   MouseClick("left",$x/2, $y/2)
   MouseClickDrag("left",114,181,372,266)
   MouseClick("left",$x/2, $y/2)
   MouseClickDrag("left",373,266,325,168)
   MouseClick("left",$x/2, $y/2)
   MouseClickDrag("left",325,168,445,270)
   MouseClick("left",$x/2, $y/2)
   MouseClickDrag("left",301,243,276,213)
   MouseClick("left",$x/2, $y/2)
   MouseClickDrag("left",276,213,355,235)
   MouseClick("left",$x/2, $y/2)
   MouseClickDrag("left",303,343,177,277)
   MouseClick("left",$x/2, $y/2)
   MouseClickDrag("left",177,277,233,278)

   ;Finishing up some wing parts left out-------------------------------------------------

   ;Left wing parts 
   MouseClickDrag("left",738,217,775,199)
   MouseClick("left",$x/2, $y/2)
   MouseClickDrag("left",747,243,775,199)
   MouseClick("left",$x/2, $y/2)

   MouseClickDrag("left",890,252,946,238)
   MouseClick("left",$x/2, $y/2)
   MouseClickDrag("left",833,342,946,238)
   MouseClick("left",$x/2, $y/2)

   MouseClickDrag("left",813,381,872,383)
   MouseClick("left",$x/2, $y/2)
   MouseClickDrag("left",681,449,872,383)
   MouseClick("left",$x/2, $y/2)

   MouseClickDrag("left",503,636,504,671)
   MouseClick("left",$x/2, $y/2)
   MouseClickDrag("left",535,634,504,671)
   MouseClick("left",$x/2, $y/2)

   MouseClickDrag("left",567,642,592,667)
   MouseClick("left",$x/2, $y/2)
   MouseClickDrag("left",591,639,592,667)
   MouseClick("left",$x/2, $y/2)

   ;bottom part of right Wing
   MouseClickDrag("left",398,473,475,440)

   ;Curve in the left side of his mid section
   MouseClick("left",$x/3.4, $y/11)   
   MouseClickDrag("left",474,443,469,402)
   MouseClick("left",467,423,1)

   Pencil()  

   ;Time to fill the areas in with color!----------------------------------

   ;Body and wings 
   PickColor(32,216,148,245,209,69)
   ;Click the paint bucket tool 
   MouseClick("left",$x/4.981, $y/11) 
   MouseClick("left",690,313,1)
   MouseClick("left",360,325,1)
   MouseClick("left",358,478,1)
   MouseClick("left",507,286,1)
   MouseClick("left",748,509,1)
   MouseClick("left",654,589,1)
   MouseClick("left",691,480,1)

   ;Feet and beak
   PickColor(22,233,97,204,112,3)
   MouseClick("left",411,526,1)
   MouseClick("left",672,546,1)
   MouseClick("left",475,374,1)
   MouseClick("left",505,359,1)

   ;Legs
   PickColor(26,42,120,149,134,105)
   MouseClick("left",473,475,1)
   MouseClick("left",579,466,1)

   ;Back wings 
   PickColor(164,44,74,67,64,93)
   MouseClick("left",235,294,1)
   MouseClick("left",315,231,1)
   MouseClick("left",743,221,1)
   MouseClick("left",881,278,1)
   MouseClick("left",744,409,1)
   MouseClick("left",516,638,1)
   MouseClick("left",578,635,1)
   MouseClick("left",640,611,1)

   Pencil()   


EndFunc

Func PickColor($h,$s,$l,$r,$g,$b)
;click the Edit Colors button
MouseClick("left", $x/1.3525, $y/11)

Sleep(500)

$colorWindowSize = WinGetClientSize("Edit Colors")
$xColor = $colorWindowSize[0]
$yColor = $colorWindowSize[1]


$colorPos = WinGetPos("Edit Colors")
$xColorPos = $colorPos[0]
$yColorPos = $colorPos[1]

Send("{TAB}")
Sleep(100)
Send("{TAB}")
Sleep(100)
Send("{TAB}")
Sleep(100)
Send("{TAB}")
Sleep(100)
Send("" & $h)
Send("{TAB}")
Sleep(100)
Send("" & $s)
Send("{TAB}")
Sleep(100)
Send("" & $l)
Send("{TAB}")
Sleep(100)
Send("" & $r)
Sleep(100)
Send("{TAB}")
Send("" & $g)
Sleep(100)
Send("{TAB}")
Send("" & $b)
Sleep(100)

;Click the shade to be in the middle 
MouseClick("left", $xColorPos+440, $yColorPos + 93.5)

;Now click the Ok button to finalize the selection! Whew! 
MouseClick("left", $xColorPos + 40, $yColorPos + 310)

EndFunc
Edited by TimCunningham
Link to comment
Share on other sites

What are those UBB codes doing in your (AutoIt) code?

Suggest you remove them.

Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Link to comment
Share on other sites

What are those UBB codes doing in your (AutoIt) code?

Suggest you remove them.

I believe this was because I used code rather than "AutoIT Code" when first writing my post. I have edited the post to display AutoIT code.

Trigs good (always nice to see people who know their maths :) ), but I think you might like this: http://members.chello.at/~easyfilter/bresenham.html

Take a look at GUICtrlSetGraphic as well.

That is interesting. I was wondering how I would do simple curves. I was thinking it would draw circles and stop a certain number of pixels in the loop, but with these I can actually draw the curves.

Btw, if anyone runs the program for a while and comes up with a few impressive pictures that it drew, I would love for you to share them. :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...