Jump to content

E4 Esketch bot


Billion
 Share

Recommended Posts

This Script allows you to read a picture from your screen, and have, Autoit draw it for you on Channel4's Esketch Website

(Esketch allows you to create Doodles with a simple drawing program which you can submit and have displayed between programs on E4, E4 is a UK cable/satelite Channel)

The script captures a region of screen using a modified version of the magnifier code then converts to grayscale then to a 2bit dithered version of original.

The script then using mousemove commands create a pixel accurate rendition to the Esketch application (This tends to be a very lenghthy process 45min to 1hour on My PC) You will need to compile using a beta copy of Autoit (that can handle Graphic functions)

ctrl-Alt-x Exits Script

Ctrl-Alt-z Breaks out of Lenghthy drawing routine without exit

hope someone finds it useful

HotKeySet("^!x", "MyExit")
HotKeySet("^!z", "Breakout")
$varbrkout = 0
#include <GuiConstants.au3>
#include <color.au3>
;// Magnifier variables
Const $SRCCOPY = 0x00CC0020
Const $xmagSIZE = 383;width & height
Const $ymagSIZE = 288
Global $picdata[$xmagSIZE][$ymagSIZE]
Global $drawx = 0
Global $drawy = 530
Global $currBrush = 0
$magXpos = 5
$magYpos = 5
$bMMState = 0
$decColor = 0
$nZoom = 20
#EndRegion

GUICtrlSetState(-1, $GUI_HIDE)

$HWND_1 = GUICreate("Esketch bot", 392, 345, (@DesktopWidth - 401) , (@DesktopHeight - 411), $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS, $WS_EX_TOPMOST)
$CTRL_btnMagnifier = GUICtrlCreateLabel("Left Click and Drag to Capture Picture", $magXpos - 1, $magYpos - 1, $xmagSIZE + 1, $ymagSIZE + 1, $SS_SUNKEN + $SS_CENTER)
GUICtrlSetBkColor(-1, 0xffffff)

$Button_dither = GUICtrlCreateButton("Read and Dither Picture", 5, 295, 120, 17)
$Button_esketch = GUICtrlCreateButton("Open Esketch Website", 137, 295, 120, 17)
$Button_drawpic = GUICtrlCreateButton("Scan to Esketch", 269, 295, 120, 17)
GUICtrlSetState($Button_drawpic,$GUI_DISABLE)
$prog_bar = GUICtrlCreateProgress (5,315,$xmagsize,10,$PBS_SMOOTH)
$prog_label = GUICtrlCreateLabel("",5,327,$xmagsize,17)
GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
            
        Case $msg = $CTRL_btnMagnifier
            While 1
                $gMInfo = GUIGetCursorInfo()
                $nMCoord = MouseGetPos()
                $pxColor = _CopyScreen($HWND_1)
                Sleep(20)
                
                If $gMInfo[2] <> 1 Then ExitLoop
            WEnd
            
        Case $msg = $Button_dither
            ReadPicfloyd()
        Case $msg = $Button_esketch
            OpenEsketch()
            
        Case $msg = $Button_drawpic
            drawpic()
    EndSelect
    
WEnd
Exit

Func preview()
    $pos = WinGetPos("Esketch bot")
    $prevX = $pos[0] 
    $prevY = $pos[1] + $magYpos +30
    
    $child = GUICreate("My Draw", $xmagSIZE, $ymagSIZE, $prevX, $prevY, $WS_POPUP, $WS_EX_TOOLWINDOW)
    $prevgraph = GuiCtrlCreateGraphic (0, 0, $xmagSIZE, $ymagSIZE)
    GUICtrlSetBkColor($prevgraph, 6684774)
    GUICtrlSetGraphic ($prevgraph, $GUI_GR_COLOR, 0xffffff)
    
    GUICtrlSetData($prog_label,"Rendering Picture - 0 percent")
    For $county = 0 To $ymagSIZE - 1
        For $countx = 0 To $xmagSIZE - 1
            $now = $picdata[$countx][$county]
            If $now = 1 Then GUICtrlSetGraphic ($prevgraph, $GUI_GR_PIXEL, $countx, $county)
        Next
        $yprogress = Int(($county / 285) * 100)
        GUICtrlSetData($prog_bar,$yprogress)
        GUICtrlSetData($prog_label,"Rendering Picture - " & $yprogress & "%")
    Next
    GUICtrlSetData($prog_bar,100)
    GUICtrlSetData($prog_label,"Rendering Picture - 100%")
    GUISetState()
    For $popX = $prevX To $prevX - $xmagSIZE Step - 5
        WinMove("My Draw", "", $popX, $prevY)
        Sleep(50)
    Next
    
EndFunc  ;==>preview
;****************************************************
; Magnifier - Tip base: Larry K. (http://www.hiddensoft.com/forum)
;****************************************************
Func _CopyScreen(ByRef $hWindow, $bWMode = 0)
    $MyHDC = DllCall("user32.dll", "int", "GetDC", "hwnd", $hWindow)
    
    If @error Then Return
    
    $DeskHDC = DllCall("user32.dll", "int", "GetDC", "hwnd", 0)
    If Not @error Then
        If Not IsDeclared( "nMCoord") Then
            If $bWMode = 0 Then
                $nMCoord = WinGetPos($hWindow)
            Else
                $nMCoord = MouseGetPos()
            EndIf
            
        EndIf
        
        $l = $nMCoord[0] - 190
        $t = $nMCoord[1] - 142
        
        DllCall("gdi32.dll", "int", "StretchBlt", "int", $MyHDC[0], "int", $magXpos, "int", $magYpos, "int", $xmagSIZE, "int", $ymagSIZE, "int", $DeskHDC[0], "int", _
                $l, "int", $t, "int", $xmagSIZE, "int", $ymagSIZE, "long", $SRCCOPY)
        
    EndIf
    
    DllCall("user32.dll", "int", "ReleaseDC", "int", $DeskHDC[0], "hwnd", 0)
    DllCall("user32.dll", "int", "ReleaseDC", "int", $MyHDC[0], "hwnd", $hWindow)
EndFunc  ;==>_CopyScreen

Func ReadPicfloyd()
    GUICtrlSetData($prog_label,"Reading Picture - 0 percent")
    Opt ("PixelCoordMode", 2)
    For $county = 0 To $ymagSIZE - 1
        For $countx = 0 To $xmagSIZE - 1
            
            $dcol = PixelGetColor($countx + $magXpos, $county + $magYpos)
        ; formula to convert to Gray scale= (222*Red+707*Green+71*Blue)/1000
            $red = _ColorGetRed($dcol);Dec(StringLeft(Hex($dcol, 6), 2))
            $grn = _ColorGetGreen($dcol);Dec(StringMid(Hex($dcol, 6), 3, 2))
            $blu = _ColorGetBlue($dcol);Dec(StringRight(Hex($dcol, 6), 2))
            $gray = Int(((222 * $red) + (707 * $grn) + (71 * $blu)) / 1000)
            If $gray > 255 Or $gray < 0 Then
                MsgBox(1, "Out of Range!", "Out of Range!")
            EndIf
            $picdata[$countx][$county] = $gray
        Next
        $yproress = Int(($county / 285) * 100)
        GUICtrlSetData($prog_bar,$yproress)
        GUICtrlSetData($prog_label,"Reading Picture - " & $yproress & "%")
    Next
    GUICtrlSetData($prog_bar,100)
    GUICtrlSetData($prog_label,"Reading Picture - 100%")
    Sleep(500)
        
    GUICtrlSetData($prog_label,"Dithering Picture - 0 percent")
    For $county = 0 To $ymagSIZE - 2
        
        
        For $countx = 0 To $xmagSIZE - 1
            $graylev = $picdata[$countx][$county]
            If $graylev >= 128 Then
                $picdata[$countx][$county] = 255
            Else
                $picdata[$countx][$county] = 0
            EndIf
            $errlev = $graylev - $picdata[$countx][$county]
            
            $erradd1 = 0.4375 * $errlev;7/16
            $erradd2 = 0.0625 * $errlev;1/16
            $erradd3 = 0.3125 * $errlev;5/16
            $erradd4 = 0.1875 * $errlev;3/16
            
            $cell3 = $picdata[$countx][$county + 1] + $erradd3
            If $cell3 > 255 Then $cell3 = 255
            If $cell3 < 0 Then $cell3 = 0
            $picdata[$countx][$county + 1] = $cell3
            
            
            If $countx < $xmagSIZE - 1 Then
                $cell1 = $picdata[$countx + 1][$county] + $erradd1
                If $cell1 > 255 Then $cell1 = 255
                If $cell1 < 0 Then $cell1 = 0
                $picdata[$countx + 1][$county] = $cell1
                
                $cell2 = $picdata[$countx + 1][$county + 1] + $erradd2
                If $cell2 > 255 Then $cell2 = 255
                If $cell2 < 0 Then $cell2 = 0
                $picdata[$countx + 1][$county + 1] = $cell2
            EndIf
            
            If $countx > 0 Then
                $cell4 = $picdata[$countx - 1][$county + 1] + $erradd4
                If $cell4 > 255 Then $cell4 = 255
                If $cell4 < 0 Then $cell4 = 0
                $picdata[$countx - 1][$county + 1] = $cell4
            EndIf
            If $picdata[$countx][$county] = 255 Then $picdata[$countx][$county] = 1
            
        Next
        
        $yproress = Int(($county / 285) * 100)
        GUICtrlSetData($prog_bar,$yproress)
        GUICtrlSetData($prog_label,"Dithering Picture - " & $yproress & "%")
    Next
    GUICtrlSetData($prog_bar,100)
    GUICtrlSetData($prog_label,"Dithering Picture - 100%")
    
    GUICtrlSetState($Button_dither, $GUI_DISABLE)
    GUICtrlSetState($Button_drawpic,$GUI_ENABLE)
    preview()
EndFunc  ;==>ReadPicfloyd


Func OpenEsketch()
    Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe http://www.channel4.com/esketch", "", @SW_MAXIMIZE)
EndFunc  ;==>OpenEsketch

Func drawpic()
    $varbrkout = 0
    WinActivate("channel4.com - E SKETCH - Microsoft Internet Explorer")
    Sleep(1000)
    Opt ("PixelCoordMode", 1)
    While PixelGetColor($drawx, $drawy) <> 6684774
        $drawx = $drawx + 1
        
    WEnd
    While PixelGetColor($drawx, $drawy) <> 10027161
        $drawy = $drawy - 1
        
    WEnd
    $drawy = $drawy + 1
    MouseMove($drawx, $drawy, 0)
    Sleep(2000)
; Start Sketching
    MouseMove($drawx + 36, $drawy + 327)
    MouseClick("Left")
    
; Clear Screen
    MouseMove($drawx + 425, $drawy + 273)
    MouseClick("Left")
    
    brush(0)
    For $county = 0 To $ymagSIZE - 1
        For $countx = 0 To $xmagSIZE - 1
            $now = $picdata[$countx][$county]
            
            If PixelGetColor($drawx + $countx, $drawy + $county) = 0x660066 Then
                $actual = 0
            Else
                $actual = 1
            EndIf
            If $now <> $actual Then
                If $now <> $currBrush Then brush($now)
                esketchDraw($countx, $county)
            EndIf
            If $varbrkout = 1 Then ExitLoop
        Next
        If $varbrkout = 1 Then ExitLoop
    Next
EndFunc  ;==>drawpic


Func esketchDraw($xpix, $ypix)
    
    If $currBrush = 0 Then
        MouseMove($xpix + $drawx + 3, $ypix + $drawy + 8, 2)
        MouseClick("Left")
    Else
        MouseMove($xpix + $drawx + 1, $ypix + $drawy + 2, 2)
        MouseClick("Left")
    EndIf
    
    MouseMove($xpix + $drawx +13, $ypix + $drawy + 18, 2)
EndFunc  ;==>esketchDraw




Func brush($sel)
    
    If $sel = 0 Then
    ;Select Eraser
        MouseMove($drawx + 425, $drawy + 222, 0)
        MouseClick("Left")
    Else
    ; Select Small Brush
        MouseMove($drawx + 425, $drawy + 28, 0)
        MouseClick("Left")
    EndIf
    $currBrush = $sel
EndFunc  ;==>brush
Func Breakout()
    $varbrkout = 1
EndFunc  ;==>Breakout
Func MyExit()
    Exit
EndFunc  ;==>MyExit
Edited by Billion
Link to comment
Share on other sites

  • 2 weeks later...

Interesting script but I found that the progress bar was appearing in my picture which was a bit of a pain. I commented out the progress bars and it seemed to work fine. I didn't try the redrawing to the website part though.

Couldn't you put the progress bar in the GUI itself just below the window and before the buttons?

Link to comment
Share on other sites

progress bar was appearing in my picture
yes mine too I have 1024x768. I couldnt get it to submit either :( I will keep trying cos its look cool!

I think it's great you made your own functions to dither it and all, but have you heard of the FreeImage library? It might help speed things up a bit (but then again, it may not :( )

Edited by steveR
AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.
Link to comment
Share on other sites

I've modified the code, the progress bar is now incorporated in the gui, sorry about that I have a 1920x1200 screen so had not seen this problem.

Also have had a look at using the Freeimage Library but have no experience with the DLLCall function or C++. Do you know of any examples of someone using Freeimage with Autoit?

Link to comment
Share on other sites

Getting this error after it reaches 100% of Read & Dither.

>Running: C:\Program Files\AutoIt3\AutoIt3.exe /ErrorStdOut "C:\Documents and Settings\ehrnft\My Documents\scripts\ectach.au3"

C:\Documents and Settings\ehrnft\My Documents\scripts\ectach.au3 (70) : ==> Variable used without being declared.:

GUICtrlSetGraphic ($prevgraph, $GUI_GR_COLOR, 0xffffff)

GUICtrlSetGraphic ($prevgraph, ^ ERROR

Any ideas?

Tim

Link to comment
Share on other sites

Getting this error after it reaches 100% of Read & Dither.

>Running: C:\Program Files\AutoIt3\AutoIt3.exe /ErrorStdOut  "C:\Documents and Settings\ehrnft\My Documents\scripts\ectach.au3"   

C:\Documents and Settings\ehrnft\My Documents\scripts\ectach.au3 (70) : ==> Variable used without being declared.:

GUICtrlSetGraphic ($prevgraph, $GUI_GR_COLOR, 0xffffff)

GUICtrlSetGraphic ($prevgraph, ^ ERROR

Any ideas?

Tim

<{POST_SNAPBACK}>

I think it might be that you are not using a Beta copy that supports the graphic functions or your GUIConstants.au3 Include file has the "$GUI_GR_COLOR" constant missing (probably wrong version)
Link to comment
Share on other sites

Have written a new version using the Freeimage Library available from here (thanks to SteveR for the suggestion) you will need to download the DLL and place it in the directory your running the script from.

The picture reading and dithering routines are now handled by the Freeimage Library, you can now also rescale the picture to suit.

Here's the code.

Comments are very welcome

#include <GuiConstants.au3>
HotKeySet("^!x", "MyExit")
HotKeySet("^!z", "Breakout")

Const $SRCCOPY = 0x00CC0020
Const $DIB_RGB_COLORS = 0
Const $FIF_JPEG = 2
Const $FreeImage_Allocate = "_FreeImage_Allocate@24"
Const $FreeImage_Unload = "_FreeImage_Unload@4"
Const $FreeImage_Load = "_FreeImage_Load@12"
Const $FreeImage_GetBits = "_FreeImage_GetBits@4"
Const $FreeImage_GetWidth = "_FreeImage_GetWidth@4"
Const $FreeImage_GetHeight = "_FreeImage_GetHeight@4"
Const $FreeImage_GetInfo = "_FreeImage_GetInfo@4"
Const $FreeImage_Dither = "_FreeImage_Dither@8"
Const $FreeImage_Rescale = "_FreeImage_Rescale@16"
Const $FILTER_LANCZOS3 = 5
Const $FID_FS = 0
Const $COLORONCOLOR = 3
Global $x100size, $y100size, $xsize, $ysize, $ydiff, $width, $height
Global $currBrush = 0, $drawx = 0, $drawy = 530
$varbrkout = 0
$hdc_dest = GUICreate("Esketch Bot v2", 500, 380, (@DesktopWidth - 509) , (@DesktopHeight - 446), $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS, $WS_EX_TOPMOST)
$sliderx = GUICtrlCreateSlider(25, 315, 393, 20, $TBS_TOP)
$slidery = GUICtrlCreateSlider(5, 15, 20, 298, $TBS_VERT)
$zmlabel = GUICtrlCreateLabel("Zoom", 430, 20, 50, 15)
$input = GUICtrlCreateInput("100", 430, 35, 50, 20)
$check = GUICtrlCreateCheckbox("Dither", 430, 60, 50, 15)
$updown = GUICtrlCreateUpdown($input, $UDS_ARROWKEYS)

$group_fit = GUICtrlCreateGroup("Fit to", 430, 280, 60, 56)
$radio_height = GUICtrlCreateRadio("Height", 435, 295, 50, 15)
$radio_width = GUICtrlCreateRadio("Width", 435, 315, 50, 15)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlSetState($radio_height, $GUI_CHECKED)

$butt_website = GUICtrlCreateButton("Open ESketch website", 32, 343, 180, 30)
$butt_scan = GUICtrlCreateButton("Draw to ESketch", 230, 343, 180, 30)

GUICtrlSetLimit($updown, 1000, 10)
GUICtrlSetData($input, 100)

GUISetState()

$dll = DllOpen("FreeImage.dll")

$dibblack = DllCall($dll,   "long", $FreeImage_Allocate, _
        "int", 383, _ 
        "int", 288, _ 
        "int", 1)

$dib = DllCall($dll,    "long", $FreeImage_Load, _
        "long", $FIF_JPEG, _ 
        "str", FileOpenDialog("Select a picture", "C:\", "Images (*.jpg)", 1 + 2), _ 
        "int", 0)

$width = DllCall($dll,  "long", $FreeImage_GetWidth, _
        "long", $dib[0])

$height = DllCall($dll, "long", $FreeImage_GetHeight, _
        "long", $dib[0])

fit()

zoom(1)
redraw($dib[0])
Sleep(2000)


While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $input
            zoom(GUICtrlRead($input) / 100)
            redraw($dib[0])
        Case $msg = $sliderx
            redraw($dib[0])
        Case $msg = $slidery
            redraw($dib[0])
        Case $msg = $check
            redraw($dib[0])
            
        Case $msg = $radio_height
            fit()
            zoom(1)
            GUICtrlSetData($input, 100)
            redraw($dib[0])
        Case $msg = $radio_width
            fit()
            zoom(1)
            GUICtrlSetData($input, 100)
            redraw($dib[0])
        Case $msg = $butt_website
            OpenEsketch()
        Case $msg = $butt_scan
            GUICtrlSetState($check, $GUI_CHECKED)
            redraw($dib[0])
            drawpic()
        Case Else
        ;;;
    EndSelect
WEnd

DllCall($dll,   "long", $FreeImage_Unload, _
        "long", $dib[0])

DllCall($dll,   "long", $FreeImage_Unload, _
        "long", $dibblack[0])

DllClose($dll)
Exit

Func zoom($zfactor)
    $xsize = $x100size * $zfactor
    $ysize = $y100size * $zfactor
    $xdiff = ($xsize - 383)
    $ydiff = ($ysize - 288)
    GUICtrlSetLimit($sliderx, $xdiff, 0)
    GUICtrlSetData($sliderx, $xdiff / 2)
    GUICtrlSetLimit($slidery, $ydiff, 0)
    GUICtrlSetData($slidery, $ydiff / 2)
EndFunc  ;==>zoom

Func redraw($origdib)
    $dib2 = DllCall($dll, "long", $FreeImage_Rescale, "long", $origdib, "int", $xsize, "int", $ysize, "long", $FILTER_LANCZOS3)
    $dispdib = $dib2[0]
    If GUICtrlRead($check) = $GUI_CHECKED Then
        $dib3 = DllCall($dll, "long", $FreeImage_Dither, "long", $dib2[0], "int", $FID_FS)
        $dispdib = $dib3[0]
    EndIf
    $width = DllCall($dll,  "long", $FreeImage_GetWidth, _
            "long", $dispdib)
    
    $height = DllCall($dll, "long", $FreeImage_GetHeight, _
            "long", $dispdib)
    
    $info = DllCall($dll,   "long", $FreeImage_GetInfo, _
            "long", $dispdib)
    
    $bits = DllCall($dll,   "long", $FreeImage_GetBits, _
            "long", $dispdib)
    
    $infob = DllCall($dll,  "long", $FreeImage_GetInfo, _
            "long", $dibblack[0])
    
    $bitsb = DllCall($dll,  "long", $FreeImage_GetBits, _
            "long", $dibblack[0])
    
    $xoff = 30
    $yoff = 20
    If $width[0] < 383 Then $xoff = 30 + ((383 - $width[0]) / 2)
    If $height[0] < 288 Then $yoff = 20 + ((288 - $height[0]) / 2)
    
    $MyHDC = DllCall("user32.dll", "int", "GetDC", "hwnd", $hdc_dest)
    DllCall("gdi32.dll",    "int", "SetStretchBltMode", _
            "int", $MyHDC[0], _ 
            "int", $COLORONCOLOR)
    
    If $width[0] < 383 Or $height[0] < 288 Then DllCall("gdi32.dll",    "int", "StretchDIBits", _
            "int", $MyHDC[0], _ 
            "int", 30, _ 
            "int", 20, _ 
            "int", 383, _ 
            "int", 288, _ 
            "int", 0, _ 
            "int", 0, _ 
            "int", 383, _ 
            "int", 288, _ 
            "int", $bitsb[0], _ 
            "int", $infob[0], _ 
            "int", $DIB_RGB_COLORS, _ 
            "int", $SRCCOPY)
    
    DllCall("gdi32.dll",    "int", "StretchDIBits", _
            "int", $MyHDC[0], _ 
            "int", $xoff, _ 
            "int", $yoff, _ 
            "int", 383, _ 
            "int", 288, _ 
            "int", GUICtrlRead($sliderx), _ 
            "int", $ydiff - GUICtrlRead($slidery), _ 
            "int", 383, _ 
            "int", 288, _ 
            "int", $bits[0], _ 
            "int", $info[0], _ 
            "int", $DIB_RGB_COLORS, _ 
            "int", $SRCCOPY)
    
    DllCall($dll,   "long", $FreeImage_Unload, _
            "long", $dib2[0])
    
    If GUICtrlRead($check) = $GUI_CHECKED Then DllCall($dll, "long", $FreeImage_Unload, _
            "long", $dib3[0])
    
EndFunc  ;==>redraw
Func fit()
    
    $xper = 383 / $width[0]
    $yper = 288 / $height[0]
    
    If GUICtrlRead($radio_width) = $GUI_CHECKED Then
        $y100size = $xper * $height[0]
        $x100size = 383
    Else
        $x100size = $yper * $width[0]
        $y100size = 288
    EndIf
EndFunc  ;==>fit

Func OpenEsketch()
    Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe http://www.channel4.com/esketch", "", @SW_MAXIMIZE)
EndFunc  ;==>OpenEsketch

Func drawpic()
    
    $varbrkout = 0
    WinActivate("channel4.com - E SKETCH - Microsoft Internet Explorer")
    Sleep(1000)
    
    While PixelGetColor($drawx, $drawy) <> 6684774
        $drawx = $drawx + 1
        
    WEnd
    While PixelGetColor($drawx, $drawy) <> 10027161
        $drawy = $drawy - 1
        
    WEnd
    $drawy = $drawy + 1
    MouseMove($drawx, $drawy, 0)
    Sleep(2000)
; Start Sketching
    MouseMove($drawx + 36, $drawy + 327)
    MouseClick("Left")
    
; Clear Screen
    MouseMove($drawx + 425, $drawy + 273)
    MouseClick("Left")
    
    brush(0)
    For $county = 0 To 287 - 1
        For $countx = 0 To 382 - 1
        ;WinActivate("Esketch Bot v2")
        ;Opt ("PixelCoordMode", 0)
            $now = PixelGetColor((@DesktopWidth - 475) + $countx , (@DesktopHeight - 396) + $county)
            If $now > 0 Then $now = 1
        ;;WinActivate("channel4.com - E SKETCH - Microsoft Internet Explorer")
        ;Opt ("PixelCoordMode", 0)
            If PixelGetColor($drawx + $countx, $drawy + $county) = 0x660066 Then
                $actual = 0
            Else
                $actual = 1
            EndIf
            If $now <> $actual Then
                If $now <> $currBrush Then brush($now)
                esketchDraw($countx, $county)
            EndIf
            If $varbrkout = 1 Then ExitLoop
        Next
        If $varbrkout = 1 Then ExitLoop
    Next
EndFunc  ;==>drawpic


Func esketchDraw($xpix, $ypix)
    If $currBrush = 0 Then
        MouseMove($xpix + $drawx + 3, $ypix + $drawy + 8, 2)
        MouseClick("Left")
    Else
        MouseMove($xpix + $drawx + 1, $ypix + $drawy + 2, 2)
        MouseClick("Left")
    EndIf
    
    MouseMove($xpix + $drawx + 13, $ypix + $drawy + 18, 2)
EndFunc  ;==>esketchDraw




Func brush($sel)
    
    If $sel = 0 Then
    ;Select Eraser
        MouseMove($drawx + 425, $drawy + 222, 0)
        MouseClick("Left")
    Else
    ; Select Small Brush
        MouseMove($drawx + 425, $drawy + 28, 0)
        MouseClick("Left")
    EndIf
    $currBrush = $sel
EndFunc  ;==>brush
Func Breakout()
    $varbrkout = 1
EndFunc  ;==>Breakout
Func MyExit()
    Exit
EndFunc  ;==>MyExit
Link to comment
Share on other sites

  • 4 years later...

it keeps saying that the variable $MS is not declared, i looked at the source, and i dont think it is! yes, i do have the beta version of autoit. please tell me what is wrong!

J00 571ll RUL3! H0p3 4Ll 1Z w3ll, n1m41d.

This statement is a lie.˙uʍop-ǝpısdn sı ǝuo sıɥʇ ʇnq 'ǝıl ɐ ǝq ʎɐɯ ʇuǝɯǝʇɐʇs snoıʌǝɹd ǝɥʇ¡6u15nɟu0) ʎ||43ɹ 51 51ɥ7

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