;Needed On Next Version: ;2nd GUI with options ;Speed ;Colors ;Eraser ;Shapes (Later Version?) ;Text Selection (Range) ;Text Selection (Specific Text) ;Focus Check Gui +Resize +ToolWindow Gui, Show, w200 h200 Gui, Color, FFFFFF return MButton:: Loop { GetKeyState, Down, MButton, P if Down = D { Random, Rand, 97, 122 Transform, Rand, Chr, %Rand% MouseGetPos, X, Y x:=x-10, y:=y-25 Gui, Add, Text, x%X% y%Y%, %Rand% Sleep, 50 } } return GuiClose: ExitApp
Fake ASCII art
Started by
purloinedheart
, Jul 06 2008 10:59 PM
6 replies to this topic
Now you can pretend to be an ASCII artist!
#1
-
Posted 06 July 2008 - 10:59 PM
Dont mean to crash your party, but I saw a big problem with your approach.
You will not be able to copy it, and then paste it as text file, since you did not use rows and columns.
Took your code and changed it a little so it can now copy, and you can also erase characters as you go (right click)
Hows this?
EDIT:
You can call it AHKscii...
(Pronounced A.H.K.ski)
EDIT2:
Updated the code, with more functions and some fixes
Now you can copy any text beforehand, and "edit" it with AHKscii
You will not be able to copy it, and then paste it as text file, since you did not use rows and columns.
Took your code and changed it a little so it can now copy, and you can also erase characters as you go (right click)
Hows this?
/* ª ª _ Ñ x { { x Ñ _ ë Õ g š ¾RßJ:‰AKõõKA‰:JßR¾ š g Õ ë T  œ÷ÔÐRÑslë o+•ýö~øIIø~öý•+o ëlsÑRÐÔ÷œ  T ~ûµQç`°÷e϶Ûq{uîófQÀO¹™íÓ?8qÞ]ºèÖÖèº]Þq8?Ó홹OÀQfóîu{qÛ¶Ïe÷°`çQµû~ P§ÇDq$9 9$qDǧP çªBhwi OUrea ME?do ead E?doY adM iwhBªç µÀJ— YOUread E?doY adM ?doYO dME —JÀµ ^‹˜ YOUreadM ?doYO dME doYOU ME? 1.2 ˜‹^ E² YOUre dME doYOU ME? oYOUr E?d ²E Ñ” oYOUre ME? oYOUr E?d YOUre E?d readME? oYOUre dME ead ”Ñ å doYOUre E?d YOUre ?do OUrea ?do e Y E d å ‡ doYOUreadME?do OUreadME?doY UreadME?d adME?do O ? M ‡ ‡ ?doYOUre doY Uread oYO readM oYO Y U d E ‡ å ?doYOUr oYO readM YOU eadME OUr ME?doYO readME doY E?d å ÄÍ YOU OUr rea ÍÄ b OUr Ure ead b T}OB¹Ë re ea dM ˹BO}T —Š?†(/ a d E /(†?Š— ÇI| Ü›eþ þe›ÂÜ |IÇ P§W ®Â3YˆaN³j2¢ ¢2j³NaˆY3® W§P ~ûµï`¬’e϶Ûq{uîófQÀO¹™íÓ?8qÞ]ºèÖÖèº]Þq8?Ó홹OÀQfóîu{qÛ¶Ïe’¬`ïµû~ œ÷ÔÐRÑslë o+•ýö~øIIø~öý•+o ëlsÑRÐÔ÷œ ¾RßJ:‰AKõõKA‰:JßR¾ Left Click = Draw Right Click = Erase Ctrl+C = Copy Ctrl+Shift+C = Copy Inverted Escape = Copy and Close Del = Clear All F12 = Toggle Mirror X F11 = Toggle Mirror Y F10 = Toggle Fixed Word (On/Off) You may copy any text to the clipboard before running this script in order to copy it to the matrix */ #SingleInstance Force ; Configuration ---------------------------------------------------------------- FIXED_CHAR := "doYOUreadME?" ; Set to any word or character. blank for random MATRIX_WIDTH = 80 ; How many columns MATRIX_HEIGHT = 40 ; How many rows FONT_SIZE = 9 ; Configuration ---------------------------------------------------------------- Gosub Init Return Init: FixedLen := StrLen( FIXED_CHAR ) FixedChar := FIXED_CHAR ; Reset all cell values to " " Loop %MATRIX_HEIGHT% { i := A_Index Loop %MATRIX_WIDTH% { j := A_Index Cell_%i%_%j% := " " } } ; If we have something in the clipboard, put it inside our cells If( Clipboard <> "" ) { StringSplit Row_, Clipboard, `n, `r Loop %Row_0% StringSplit Cell_%A_Index%_, Row_%A_Index% } Gui Color, FFFFFF Gui Font, s%FONT_SIZE%,Lucida Console ; Monospace font needed here Gui Margin, 0, 0 ; Create the GUI matrix Loop %MATRIX_HEIGHT% { i := A_Index Loop %MATRIX_WIDTH% { j := A_Index ;Gui Add, Text, x%X% y%Y% vCell_%i%_%j%, % Cell_%i%_%j% Gui Add, Text, % "x" . ( A_Index = 1 ? "0" : "+0" ) . "y" . ( A_Index = 1 ? "+0" : "p" ) . " vCell_" . i . "_" . j, % Cell_%i%_%j% } } Gui Show,,ASCII Return GuiEscape: GuiClose: Gosub ^c ExitApp Return GetChar( X, Y ) { Global FixedChar, FixedLen If( FixedChar = "" ) Result := GetRandChar() Else { SubChar := Mod( X+Mod( Y, FixedLen ), FixedLen )+1 Result := SubStr( FixedChar, SubChar, 1 ) } Return Result } GetRandChar() { Random Result, 33, 255 If( Result = 38 ) or ( Result = 127 ) or ( Result = 129 ) or ( Result = 141 ) or ( Result = 143 ) or ( Result = 144 ) or ( Result = 157 ) Result := GetRandChar() Transform, Result, Chr, %Result% If( Result = "" ) Result := GetRandChar() Return Result } Draw( erase=false ) { Global MirrorX, MirrorY, MATRIX_WIDTH, MATRIX_HEIGHT MouseGetPos MX, MY, WinID, MControl WinGetTitle WinTitle, ahk_ID %WinID% If( WinTitle <> "ASCII" ) Return GuiControl Focus, %MControl% GuiControlGet GuiVarName, FocusV If( InStr( GuiVarName, "Cell" ) ) { GuiControlGet GuiValue,, %GuiVarName% StringSplit Token, GuiVarName, _ OriginalX := Token3 OriginalY := Token2 MirroredX := MATRIX_WIDTH-OriginalX+1 MirroredY := MATRIX_HEIGHT-OriginalY+1 ThisChar := erase ? " " : GetChar( OriginalX, OriginalY ) %GuiVarName% := ThisChar GuiControl,,%GuiVarName%, % %GuiVarName% If( MirrorX ) { MirrorVarName = Cell_%OriginalY%_%MirroredX% %MirrorVarName% := ThisChar GuiControl,,%MirrorVarName%, % %MirrorVarName% } If( MirrorY ) { MirrorVarName = Cell_%MirroredY%_%OriginalX% %MirrorVarName% := ThisChar GuiControl,,%MirrorVarName%, % %MirrorVarName% If( MirrorX ) { MirrorVarName = Cell_%MirroredY%_%MirroredX% %MirrorVarName% := ThisChar GuiControl,,%MirrorVarName%, % %MirrorVarName% } } } } GetControlUnderMouse( ByRef X, ByRef Y ) { MouseGetPos MX, MY, WinID, MControl WinGetTitle WinTitle, ahk_ID %WinID% If( WinTitle <> "ASCII" ) Return GuiControl Focus, %MControl% GuiControlGet GuiVarName, FocusV If( InStr( GuiVarName, "Cell" ) ) { StringSplit Token, GuiVarName, _ X := Token3 Y := Token2 } } MyTooltip( text ) { Tooltip %text% SetTimer RemoveTooltip, -1000 } RemoveTooltip: Tooltip Return #IfWinActive ASCII ~RButton:: Loop { Draw( true ) If( Not GetKeyState( "RButton", "D" ) ) Break } Return ~LButton:: Loop { Draw() If( Not GetKeyState( "LButton", "D" ) ) Break } Return ^c:: ^+c:: Result := "" Loop %MATRIX_HEIGHT% { i := A_Index Loop %MATRIX_WIDTH% { j := A_Index Result .= A_ThisHotkey <> "^+c" ? Cell_%i%_%j% : ( Cell_%i%_%j% = " " ? GetChar( i, j ) : " " ) } Result .= "`r`n" } Clipboard = %Result% MyTooltip( "Copied" . ( A_ThisHotkey = "^+c" ? " (Inverted)" : "" ) ) Return Del:: Loop %MATRIX_HEIGHT% { i := A_Index Loop %MATRIX_WIDTH% { j := A_Index Cell_%i%_%j% := " " GuiControl,,Cell_%i%_%j%, % " " } } Return F12:: MirrorX := !MirrorX MyTooltip( "Mirror X is " . ( MirrorX ? "ON" : "OFF" ) ) Return F11:: MirrorY := !MirrorY MyTooltip( "Mirror Y is " . ( MirrorY ? "ON" : "OFF" ) ) Return F10:: TempFixedChar1 := FixedChar FixedChar := TempFixedChar2 TempFixedChar2 := TempFixedChar1 Return ; Debug: Loop for copying all ascii table to clipboard Debug: String := "" Loop 255 { If( A_Index > 32 ) { String .= A_Index . ":" Transform, ThisChar, Chr, %A_Index% String .= ThisChar . "`n" } } Clipboard = %String% Return
EDIT:
You can call it AHKscii...
(Pronounced A.H.K.ski)
EDIT2:
Updated the code, with more functions and some fixes
Now you can copy any text beforehand, and "edit" it with AHKscii
#2
-
Posted 07 July 2008 - 08:11 AM
Sector-Seven - Freeware tools built with AutoHotkey
Glad you like it, I thought you might get mad...
#4
-
Posted 07 July 2008 - 03:42 PM
Sector-Seven - Freeware tools built with AutoHotkey
Posted an updated version - now allows you to copy inverted result.
Plus some fixes and efficiency modifications.
Plus some fixes and efficiency modifications.
#5
-
Posted 07 July 2008 - 04:46 PM
Sector-Seven - Freeware tools built with AutoHotkey
Version 1.2 - now allows to use a fixed word or character as the drawing "color"
#7
-
Posted 12 July 2008 - 08:50 AM
Sector-Seven - Freeware tools built with AutoHotkey