Sign in to follow this  
Followers 0
HypercamJ

mspaint(er)

10 posts in this topic

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...

Share this post


Link to post
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.

Share this post


Link to post
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...

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

It's a great script [Runs on XP Home] I'm thinking of having it run as an idle "decoration". Anyways, thanks for looking into that.


Prove, and I will believe...

Share this post


Link to post
Share on other sites

It'll have to wait. I'm at school and still trying to collect my old applications. AutoIt always downloads at about 800 bytes per second here at school so I gave up on ever downloading it here.

Once I get home and have a useful internet connection, I'll be able to download AutoIt and edit/test a new version.

Share this post


Link to post
Share on other sites

Sounds like a plan :)


Prove, and I will believe...

Share this post


Link to post
Share on other sites

You got back from school right?... :)


Prove, and I will believe...

Share this post


Link to post
Share on other sites

No. I died on the way home. Sorry, but I do have term papers and finals this week. I haven't had time. I do appreciate your interest in my silly little script though.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

If you get the chance I'd be overjoyed. It's a fun script; I ran it and walked out of the room. My dad walked in and was like WTF??

Edit: English error

Edited by HypercamJ

Prove, and I will believe...

Share this post


Link to post
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
Sign in to follow this  
Followers 0