Sign in to follow this  
Followers 0
alienkillaz

convert pictures to text

1 post in this topic

ok what this does is take a picture with a black background redraw it in a 2-toned text picture.. not terribly usefull but its neat

#include <GUIConstants.au3>

$outer = IniRead("gen.ini", "gen", "outer", "")
$inner = IniRead("gen.ini", "gen", "inner", "")
GUICreate(" My GUI input acceptfile", 320, 120, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, "", 0x00000018)

$file = GUICtrlCreateInput("drag the pic here", 10, 5, 300, 20);,"",$WS_EX_ACCEPTFILES)
GUICtrlSetState(-1, $GUI_ACCEPTFILES)
$btn = GUICtrlCreateButton("OK", 110, 45, 90, "", $BS_DEFPUSHBUTTON)
$outercon=GUICtrlCreateInput($outer,0,35)
$innercon=GUICtrlCreateInput($inner,0,57)

GUISetState(@SW_SHOW)     ; will display an empty dialog box

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    If $msg = $btn Then
        $inner=GUICtrlRead($outercon)
        IniWrite("gen.ini", "gen", "outer", $inner)
        $outer=GUICtrlRead($innercon)
        Iniwrite("gen.ini", "gen", "outer", $outer)
        $file1 = GUICtrlRead($file)
        GUISetState(@SW_HIDE)
        IniWrite("gen.ini", "gen", "coord1", "")
        IniWrite("gen.ini", "gen", "coord2", "")
        paint()
        $coord3 = @DesktopWidth
        $coord3 = $coord3 / 2
        
        $coord1 = IniRead("gen.ini", "gen", "coord1", "")
        $coord1 = $coord1 / 2
        $coord3 = $coord3 - $coord1; left
        
        
        $coord4 = @DesktopHeight
        $coord4 = $coord4 / 2
        $coord2 = IniRead("gen.ini", "gen", "coord2", "") / 2
        $coord4 = $coord4 - $coord2; top
        $coord5 = $coord3 + $coord1 + $coord1; right
        $coord6 = $coord4 + $coord2 + $coord2; bottom
    ;MsgBox(1,"",$coord4 & ","  & $coord6 &","  &$coord5 &","  & $coord3)
        
    ;MsgBox(1,"",$coord3 &","& $coord4)
        
        ExitLoop
    EndIf
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd




Sleep(4000)

$height = IniRead("gen.ini", "gen", "coord2", "")
$width = IniRead("gen.ini", "gen", "coord1", "")
;$outer = "@"
;$inner = "."
;
$a = 1
Do
    IniWrite("gen.ini", "gen", "line" & $a, "")
    $a = $a + 1
Until $a = 50
$height = $height / 17
$height = Round($height, 0)
$width = $width / 7
$width = Round($width, 0)
$left = $coord3
$top = $coord4
$right = $coord5
$bottom = $coord6
$line = 0
$counter = 0
;MsgBox(1,"",$left &","& $top)
Do
    $x = PixelGetColor($left, $top)
    
    $left = $left + 7
    If $left > $right Then
        $left = $coord3
        
        $top = $top + 17
        $counter = $counter + 1
        
    EndIf
    If $x = 0 Then
        
        $line = $outer
    ElseIf $x <> 0 Then
        $line = $inner
        
    EndIf
    $read = IniRead("gen.ini", "gen", "line" & $counter, "")
    ClipPut($line)
    IniWrite("gen.ini", "gen", "line" & $counter, $read & $line)
Until $counter > $height
$read1 = IniRead("gen.ini", "gen", "line1", "")
$read2 = IniRead("gen.ini", "gen", "line2", "")
$read3 = IniRead("gen.ini", "gen", "line3", "")
$read4 = IniRead("gen.ini", "gen", "line4", "")
$read5 = IniRead("gen.ini", "gen", "line5", "")
$read6 = IniRead("gen.ini", "gen", "line6", "")
$read7 = IniRead("gen.ini", "gen", "line7", "")
$read8 = IniRead("gen.ini", "gen", "line8", "")
$read9 = IniRead("gen.ini", "gen", "line9", "")
$read10 = IniRead("gen.ini", "gen", "line10", "")
$read11 = IniRead("gen.ini", "gen", "line11", "")
$read12 = IniRead("gen.ini", "gen", "line12", "")
$read13 = IniRead("gen.ini", "gen", "line13", "")
$read14 = IniRead("gen.ini", "gen", "line14", "")
$read15 = IniRead("gen.ini", "gen", "line15", "")
$read16 = IniRead("gen.ini", "gen", "line16", "")
$read17 = IniRead("gen.ini", "gen", "line17", "")
$read18 = IniRead("gen.ini", "gen", "line18", "")
$read19 = IniRead("gen.ini", "gen", "line19", "")
$read20 = IniRead("gen.ini", "gen", "line20", "")
$read21 = IniRead("gen.ini", "gen", "line21", "")
$read22 = IniRead("gen.ini", "gen", "line22", "")
$read23 = IniRead("gen.ini", "gen", "line23", "")
$read24 = IniRead("gen.ini", "gen", "line24", "")
$read25 = IniRead("gen.ini", "gen", "line25", "")
$read26 = IniRead("gen.ini", "gen", "line26", "")
$read27 = IniRead("gen.ini", "gen", "line27", "")
$read28 = IniRead("gen.ini", "gen", "line28", "")
$read29 = IniRead("gen.ini", "gen", "line29", "")
$read30 = IniRead("gen.ini", "gen", "line30", "")
$read31 = IniRead("gen.ini", "gen", "line31", "")
$read32 = IniRead("gen.ini", "gen", "line32", "")
$read33 = IniRead("gen.ini", "gen", "line33", "")
$read34 = IniRead("gen.ini", "gen", "line34", "")
$read35 = IniRead("gen.ini", "gen", "line35", "")
$read36 = IniRead("gen.ini", "gen", "line36", "")
$read37 = IniRead("gen.ini", "gen", "line37", "")
$read38 = IniRead("gen.ini", "gen", "line38", "")
$read39 = IniRead("gen.ini", "gen", "line39", "")
$read40 = IniRead("gen.ini", "gen", "line40", "")
$read41 = IniRead("gen.ini", "gen", "line41", "")
$read42 = IniRead("gen.ini", "gen", "line42", "")
$read43 = IniRead("gen.ini", "gen", "line43", "")
$read44 = IniRead("gen.ini", "gen", "line44", "")
ClipPut($read1 & @CRLF & $read2 & @CRLF & $read3 & @CRLF & $read4 & @CRLF & $read5 & @CRLF & $read6 & @CRLF & $read7 & @CRLF & $read8 & @CRLF & $read9 & @CRLF & $read10 & @CRLF & $read11 & @CRLF & $read12 & @CRLF & $read13 & @CRLF & $read14 & @CRLF & $read15 & @CRLF & $read16 & @CRLF & $read17 & @CRLF & $read18 & @CRLF & $read19 & @CRLF & $read20 & @CRLF & $read21 & @CRLF & $read22 & @CRLF & $read23 & @CRLF & $read24 & @CRLF & $read25 & @CRLF & $read26 & @CRLF & $read27 & @CRLF & $read28 & @CRLF & $read29 & @CRLF & $read30 & @CRLF & $read31 & @CRLF & $read32 & @CRLF & $read33 & @CRLF & $read34 & @CRLF & $read35 & @CRLF & $read36 & @CRLF & $read37 & @CRLF & $read38 & @CRLF & $read39 & @CRLF & $read40 & @CRLF & $read41 & @CRLF & $read42 & @CRLF & $read43 & @CRLF & $read44 & @CRLF)

MouseClick("left")


Func paint()
    Run("mspaint.exe")
    WinWaitActive("untitled - Paint")
;sleep(1000)
    Send("{ctrlDOWN}" & "o" & "{ctrlup}")
    Sleep(1000)
    Send($file1 & "{enter}")
    Sleep(100)
    Send("{ALTDOWN}" & "i" & "{altup}" & "a")
;ClipPut("")
;sleep(100)
    Send("{ctrldown}" & "c" & "{ctrlup}")
    $coord1 = ClipGet()
    IniWrite("gen.ini", "gen", "coord1", $coord1)
    
    Send("{tab}")
    Send("{ctrldown}" & "c" & "{ctrlup}")
    $coord2 = ClipGet()
    IniWrite("gen.ini", "gen", "coord2", $coord2)
    
    Send("{enter}")
    Send("{ctrldown}" & "f" & "{ctrlup}")
    
    
    
;Send("{ALTDOWN}")
;   send("f")
;   send("{altup}" & "{up}")
;   sleep(100)
;   send("{enter}")
EndFunc  ;==>paint

Untitled_1.zip

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