How to Automate MsPaint type application Using Eggplant ?

Hi,

How to automate Ms Paint applications. I meant to , How can we automate the different tools functionality which are available in Ms paint application. For example in Ms paint we had Pencil tool where we can select that tool and can draw the picture in the white board available. How to automate this scenario like selecting the tool and drawing the picture.

Kindly reply back with some code snippet , its very urgent to me… plz plz

Please any one gimme the solution ASAP…its very urgent to me

What, specifically, are you unable to do? Scripting MS Paint or a similar application is no different than scripting any other application. Capture images of the various tools and use the “Click” command to select them. This is one time when I’d recommend using coordinates to actually draw with the tools, although to maintain reliability of the script, you calculate the coordinates based on the location of a screen element. If you have a specific difficulty, you’ll need to provide more details on the task.

My Problem is after selecting the tool, for example pen tool in Mspaint ,after selecting the pen tool i need to do some actions like writing down the some text or drawing picture. So how can we automate this continuos mosue operations. Can the same Click comman works.

For Clear understanding i have attached the screen shot . I kindly request you to open that image in MSpaint and i want to do the same with egg plant .

If you just want to draw something, and you don’t care what it is, you can use code like this:

 put ImageLocation("ULCorner") into UL
put ImageLocation("LRCorner") into LR
put (UL.x .. LR.x) into horizontalRange
put (UL.y .. LR.y) into verticalRange

MoveTo (any item of horizontalRange, any item of verticalRange)
MouseButtonDown 1
repeat 30 times
	MoveTo (any item of horizontalRange, any item of verticalRange)
end repeat
MouseButtonUp 1

Where “ULCorner” and “LRCorner” are images representing the upper-left and lower-right corners of the canvas.

If you want something repeatable, this would work:

set shape to ((1,1),(20,1),(20,12),(1,12))
set topLeft to imageLocation("TLCorner")
put topLeft + each item of shape into adjustedShape

repeat with each item of adjustedShape
    drag it
end repeat

drop the first item of adjustedShape

Which will make a closed shape.

Excellent Work…Thanks.This might accomplish my work it seems… any way i will try it out.
I have doubt in the code snippet given by u… u have mentioned in the below line…
Where “ULCorner” and “LRCorner” are images representing the upper-left and lower-right corners of the canvas.
How to capture those left and right corner images of canvas. and what exactly you mean by canvas?

Can you please explain

The canvas is what the drawing area is generally referred to. The image below should answer your questions.

Thanks a lot Matt… Excellant …gr8 :slight_smile: