Jump to content

Recommended Posts

Posted

Having major trouble as I'm a noob. My objective is to draw the colors of the rainbow in paint using 6 straight lines (each color of the rainbow) and loop it until it reaches the end of the page. I've tried using the For and step commands but my lines would just overwrite on top of each other. Please give me guidance! Much appreciated.

My work thus far: 

#include <AutoItConstants.au3>
$pxls = InputBox("Height", "How many pixels in height?", "200")
$pixel_height = Int($pxls)
Run("mspaint.exe")
WinWaitActive("Untitled - Paint")
MouseClick($MOUSE_CLICK_LEFT, 1434, 94, 1)
MouseClick($MOUSE_CLICK_LEFT, 170, 83, 1)
MouseClickDrag($MOUSE_CLICK_LEFT, 230, 200, 205, 200)
Send($pxls)
MouseClick($MOUSE_CLICK_LEFT, 140, 485, 1)
MouseClick($MOUSE_CLICK_LEFT, 590, 110, 1)
MouseClick($MOUSE_CLICK_LEFT, 610, 256, 1)
MouseClick($MOUSE_CLICK_LEFT, 776, 62, 1)
MouseClickDrag($MOUSE_CLICK_LEFT, 90, 190, 1150, 190,0)
MouseClick($MOUSE_CLICK_LEFT, 799, 61, 1,0)
MouseClickDrag($MOUSE_CLICK_LEFT, 90, 195, 1150, 195,0)
MouseClick($MOUSE_CLICK_LEFT, 821, 61, 1,0)
MouseClickDrag($MOUSE_CLICK_LEFT, 90, 200, 1150, 200,0)
MouseClick($MOUSE_CLICK_LEFT, 844, 60, 1,0)
MouseClickDrag($MOUSE_CLICK_LEFT, 90, 205, 1150, 205,0)
MouseClick($MOUSE_CLICK_LEFT, 863, 59, 1,0)
MouseClickDrag($MOUSE_CLICK_LEFT, 90, 210, 1150, 210,0)
MouseClick($MOUSE_CLICK_LEFT, 906, 62, 1,0)
MouseClickDrag($MOUSE_CLICK_LEFT, 90, 215, 1150, 215,0)
WinClose("Untitled - Paint")
WinWaitActive("Paint", "Save")
Send("{ENTER}")
WinWaitActive("Save As")
Sleep(5000)
MouseClick($MOUSE_CLICK_LEFT, 390, 240, 2)
MouseClick($MOUSE_CLICK_LEFT, 708, 526, 1)

Posted

Another related question is how do I use multiple variables for the for-next command? 

As an example I want 2 variables: 

For $a = 1 to 10 step + 2 

How would I input another variable? i.e $b? 

Posted (edited)

Are you using Windows 7 Paint?

If so I can use AutoIt Window Info Tool to find the control_Ids then ControlSend, ControlClick which will access the controls much better than pointing and clicking.

 

50 minutes ago, bchu25 said:

Another related question is how do I use multiple variables for the for-next command? 

Use arrays to index variables.

Local $x_max = 10, $y_max = 10, $z_max = 10
Local $array[$x_max][$y_max][$z_max]

For $z = 0 To $z_max - 1
    For $y = 0 To $y_max - 1
        For $x = 0 To $x_max - 1
            $array[$x][$y][$z] = $x & " " & $y & " " & $z
            $sLabel = "array[" & $x & "]" & "[" & $y & "]" & "[" & $z & "] = "
            ConsoleWrite($sLabel & $array[$x][$y][$z] & @CRLF)
        Next; x
    Next; y
Next; z

 

Also see: https://www.autoitscript.com/wiki/Arrays for a definitive look.

Edited by Xandy
Posted

why do you want to multiple click on mspaint? :P:P:P

ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

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
×
×
  • Create New...