Jump to content

mspaint(er)


Recommended Posts

Hello,

While I was reading through the really old example scripts I came across one of Richard's which could draw a picture in mspaint. I was trying to set it up so that you could choose the file to draw but you can't have variables in the include function. Is there another way possible where I could set this up?

CODE

$file = FileOpenDialog("Open...", "", "AutoIt Template Files (*.apt)")

Opt("MouseCoordMode", 2)

If MsgBox(4, "Face", "Are you ready to draw the face? Your mouse and keyboard will not work until the face is drawn. Press Control+Alt+Delete to reactivate the mouse and keyboard in an emergency situation.") = 7 Then Exit

BlockInput(True)

Run("mspaint.exe")

WinWait("untitled - Paint")

WinSetState("untitled - Paint", "", @SW_MAXIMIZE)

Send("^e")

WinWait("Attributes")

;-------------Moved to picture.apt---------------

;ControlSetText("Attributes", "", "Edit1", "47")

;ControlSetText("Attributes", "", "Edit2", "35")

;ControlClick("Attributes", "", "Button11")

;---------------------------------------------------

#include "picture.apt"

BlockInput(False)

MsgBox(0, "Done!", "Enjoy!")

Func ChangeColor($r, $g, $:)

$pos = ControlGetPos("untitled - Paint", "", "AfxWnd42u1")

MouseClick("left", 38, $pos[1] + 14, 2)

WinWait("Edit Colors")

ControlClick("Edit Colors", "", "Button1")

ControlSetText("Edit Colors", "", "Edit4", String($r))

ControlSetText("Edit Colors", "", "Edit5", String($g))

ControlSetText("Edit Colors", "", "Edit6", String($:))

ControlClick("Edit Colors", "", "Button2")

EndFunc

Func Draw($x, $y)

$pos = ControlGetPos("untitled - Paint", "", "Afx:1000000:81")

MouseClick("left", $x + $pos[0] + 3, $y + $pos[1] + 3)

EndFunc

Prove, and I will believe...
Link to comment
Share on other sites

Hello,

While I was reading through the really old example scripts I came across one of Richard's which could draw a picture in mspaint. I was trying to set it up so that you could choose the file to draw but you can't have variables in the include function. Is there another way possible where I could set this up?

CODE

$file = FileOpenDialog("Open...", "", "AutoIt Template Files (*.apt)")

Opt("MouseCoordMode", 2)

If MsgBox(4, "Face", "Are you ready to draw the face? Your mouse and keyboard will not work until the face is drawn. Press Control+Alt+Delete to reactivate the mouse and keyboard in an emergency situation.") = 7 Then Exit

BlockInput(True)

Run("mspaint.exe")

WinWait("untitled - Paint")

WinSetState("untitled - Paint", "", @SW_MAXIMIZE)

Send("^e")

WinWait("Attributes")

;-------------Moved to picture.apt---------------

;ControlSetText("Attributes", "", "Edit1", "47")

;ControlSetText("Attributes", "", "Edit2", "35")

;ControlClick("Attributes", "", "Button11")

;---------------------------------------------------

#include "picture.apt"

BlockInput(False)

MsgBox(0, "Done!", "Enjoy!")

Func ChangeColor($r, $g, $:)

$pos = ControlGetPos("untitled - Paint", "", "AfxWnd42u1")

MouseClick("left", 38, $pos[1] + 14, 2)

WinWait("Edit Colors")

ControlClick("Edit Colors", "", "Button1")

ControlSetText("Edit Colors", "", "Edit4", String($r))

ControlSetText("Edit Colors", "", "Edit5", String($g))

ControlSetText("Edit Colors", "", "Edit6", String($:))

ControlClick("Edit Colors", "", "Button2")

EndFunc

Func Draw($x, $y)

$pos = ControlGetPos("untitled - Paint", "", "Afx:1000000:81")

MouseClick("left", $x + $pos[0] + 3, $y + $pos[1] + 3)

EndFunc

The instructions on what to draw and how must be in picture.apt so you need to understand how that works and modify it so that you can use another file for the drawing. Without knowing what picture.apt is we can't really help.
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

The instructions on what to draw and how must be in picture.apt so you need to understand how that works and modify it so that you can use another file for the drawing. Without knowing what picture.apt is we can't really help.

The .apt file is just an .au3 file with a different file extension. This is what the contents look like:

CODE

;MSPainter Instruction file

;Picture - HybridTheory

ControlSetText("Attributes", "", "Edit1", "200")

ControlSetText("Attributes", "", "Edit2", "200")

ControlClick("Attributes", "", "Button11")

ChangeColor(7, 0, 0)

Draw(0, 0)

Draw(26, 0)

Draw(65, 0)

Draw(70, 0)

Draw(72, 0)

Draw(76, 0)

Draw(80, 0)

Draw(82, 0)

Draw(85, 0)

Draw(90, 0)

Draw(99, 0)

...

The entire file is huge so I just put the first couple lines up. The rest would just consist of Draw and ChangeColor

The picture.apt file is the instructions on how to draw the picture. ChangeColor and Draw are both functions in the main script.

What I want to do is set it up so that you can choose the file to read "instructions" from.

Prove, and I will believe...
Link to comment
Share on other sites

To tell the truth, I don't even know if my script still works. I tried running it the other day and MS Paint just sat there. It may have been a missed mouse click though. I only ran it once and didn't bother looking into it.

Also, I kinda like that name, mspainter.

I'll take a look at the script and see if there's an easy way to rewrite it to allow different included files.

Edited by Richard Robertson
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...