Oxin8 Posted January 15, 2006 Share Posted January 15, 2006 (edited) Last night I wanted to make something fun that drew pixels onscreen and SprayPaint is the result of that. Open paint and then draw an image of any size(but make note of it) then run SprayPaint.au3. It prompts for the width, height, and file name, then it activates the paint window and reads the pixels. Then it writes an autoit script with the specified filename. The script also has an $ignorecolor (defaultly white) so it doesn't draw any pixels of that color and it looks better. If you set it to -1 it should draw everything. After it indicates that it's done, you can press ctrl+s to spray or ctrl+e to exit. The resulting autoit script draws the image at the current mouse coords every 200 milliseconds. I've included an example result so you can see. (btw, requires beta) EDIT: ctrl+e quits the second script For the lazy people that won't download just to see a script: expandcollapse popupOpt("PixelCoordMode",0) Opt("WinTitleMatchMode",2) Opt("ColorMode",1) $width = InputBox("SprayPaint", "Width:") $height = InputBox("SprayPaint", "Height:") $fname = InputBox("SprayPaint", "File Name:") $ignorecolor=0xFFFFFF Dim $spray[$width][$height] WinActivate("- Paint") WinWaitActive("- Paint") For $x = 65 to (64 + $width) For $y = 47 to (46 + $height) $spray[$x-65][$y-47] = PixelGetColor($x,$y) Next Next MsgBox(0,"SprayPaint","Spray Retrieved") $myfile = FileOpen($fname, 2) FileWrite($myfile, 'Opt("ColorMode",1)'& @CRLF) FileWrite($myfile, 'HotKeySet("^e","quit")'& @CRLF) FileWrite($myfile, "While 1" & @CRLF & "$pos= MouseGetPos()" & @CRLF & "pict($pos[0],$pos[1])" & @CRLF & _ "Sleep(200)" & @CRLF & "WEnd" & @CRLF) FileWrite($myfile, 'Func quit()'& @CRLF & "Exit" & @CRLF & "EndFunc" & @CRLF) FileWrite($myfile, 'Func drawpix($dc,$x,$y,$color)' & @CRLF & _ 'DllCall ("gdi32.dll", "long", "SetPixel", "long", $dc[0], "long", $x, "long", $y, "long", $color)' _ & @CRLF & "EndFunc" & @CRLF) FileWrite($myfile, "Func pict($x,$y)" & @CRLF & '$dc= DllCall ("user32.dll", "int", "GetDC", "hwnd", "")' & @CRLF) For $x = 0 to ($width-1) For $y = 0 to ($height-1) If $spray[$x][$y] <> $ignorecolor Then FileWrite ( $myfile, "drawpix($dc,$x+" & $x & ",$y+" & $y & ",0x" & hex($spray[$x][$y]) & ")" & @CRLF) Next Next FileWrite($myfile,'DllCall ("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $dc[0])' & @CRLF & "EndFunc") FileClose($myfile) MsgBox(0,"SprayPaint","Spray Written To " & $fname) waiting() Func waiting() HotKeySet("^s","spray") HotKeySet("^e","quittime") While 1 Sleep(50) WEnd EndFunc Func quittime() Exit EndFunc Func spray() $dc= DllCall ("user32.dll", "int", "GetDC", "hwnd", "") $pos= MouseGetPos () For $x = 0 to ($width-1) For $y = 0 to ($height-1) If $spray[$x][$y] <> $ignorecolor Then DllCall ("gdi32.dll", "long", "SetPixel", "long", $dc[0], "long", $pos[0] + $x, "long", $pos[1] + $y, "long", "0x" & hex($spray[$x][$y])) Next Next DllCall ("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $dc[0]) EndFunchearts.au3spraypaint.au3 Edited January 15, 2006 by Oxin8 ~My Scripts~ *********_XInput UDF for Xbox 360 ControllerSprayPaint_MouseMovePlus Link to comment Share on other sites More sharing options...
cdkid Posted January 15, 2006 Share Posted January 15, 2006 nice AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide! Link to comment Share on other sites More sharing options...
GrungeRocker Posted January 15, 2006 Share Posted January 15, 2006 wow thats fun =) [font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font] Link to comment Share on other sites More sharing options...
BigDod Posted January 15, 2006 Share Posted January 15, 2006 A person can have some fun with this. It may be worth building in a hotkey to stop the second script. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
Oxin8 Posted January 15, 2006 Author Share Posted January 15, 2006 A person can have some fun with this. It may be worth building in a hotkey to stop the second script. done. ~My Scripts~ *********_XInput UDF for Xbox 360 ControllerSprayPaint_MouseMovePlus Link to comment Share on other sites More sharing options...
cppman Posted February 25, 2006 Share Posted February 25, 2006 lol. pretty cool. Miva OS Project Link to comment Share on other sites More sharing options...
jaenster Posted February 25, 2006 Share Posted February 25, 2006 funny -jaenster Link to comment Share on other sites More sharing options...
AlmarM Posted October 4, 2007 Share Posted October 4, 2007 How it works ??? I think im doing anything wrong... I've started Spraypaint filled in the inputboxes and then ?? Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now