rem Make a list that will have all the characters that can be used...
list create,9
list loadtext,9
"A=/\-
"B=|//
"C=/|\
"D=|\/
"E=-|-
"F=|-/
"G=/-|
"H=|/|
"I=|||
"J=-|/
"K=|/\
"L=|--
"M=/\/
"N=|\|
"O=\-/
"P=||\
"Q=||/
"R=||-
"S=-\-
"T=--|
"U=|-|
"V=\\/
"W=\/\
"X=/-\
"Y=\//
"Z=-/-
" =---
"?=-/|

  DIALOG CREATE,Mousewriter,-1,0,437,432
  DIALOG ADD,STYLE,STYLE1,Courier New,8,,,
  DIALOG ADD,STYLE,STYLE2,Courier New,18,BC,SILVER,
  DIALOG ADD,GROUP,GROUP5,6,30,296,296
  DIALOG ADD,GROUP,GROUP4,104,226,100,100
  DIALOG ADD,GROUP,GROUP1,202,128,100,100
  DIALOG ADD,GROUP,GROUP2,6,128,100,100
  DIALOG ADD,GROUP,GROUP3,104,30,100,100
  DIALOG ADD,EDIT,EDIT1,312,30,296,92,,MULTI,WRAP,STYLE1
  DIALOG ADD,TEXT,TEXT1,312,332,100,92,@cr()START,,CLICK,STYLE2
  DIALOG ADD,EDIT,EDIT2,408,30,402,19,,,STYLE1
  DIALOG ADD,LIST,LIST1,6,332,100,296,,STYLE1
  DIALOG SHOW
list assign,list1,9
%%start = 1

:Evloop
wait event
goto @event()

:Text1click
if @equal(%%start,1)
  dialog set,text1,@cr()STOP
  %%start = 0
  wait 1
  beep
  beep
  beep
  %%characters = "   "
rem This is the minimum off pixels you must move before the script recognizes it...
  %%Space = 50
rem The wait time between 2 moves...
  %%Wait = 1
rem Name of the EDIT where the text must be in...
  %%Edit1name = EDIT1
rem Name of the EDIT where the characters must be in. You must use a proper one for this,
rem otherwise the script doesn't work... You can make this EDIT hidden...
  %%Edit2name = EDIT2

  goto Typeloop
  else
  %%start = 1
  dialog set,text1,@cr()START
  end
goto evloop
  
:Close
exit


rem ----------------------------------------
rem - Must be included in every program... -
rem ----------------------------------------
:Typeloop
gosub Firstcheck
wait %%wait

rem If you remove the rem on the next line, you can only write
rem if you have pressed you left mouse button.
rem if @mousedown(l)

gosub Secondcheck

if @equal(%%dotcount,2)
  if @not(@equal(@dlgtext(%%Edit2name),"   "))
    %%characters = "   "
    dialog set,%%Edit2name,%%characters
    beep
    beep
    end
  end

if @equal(%%char,.)
  %%dotcount = @succ(%%dotcount)
  else
  %%dotcount = 0
  %%characters = %%characters%%char
  dialog set,%%Edit2name,%%characters
  end

gosub Checkcharacter

end

%%event = @event()
if @not(@null(%%event))  
  goto %%event
  end
  
goto Typeloop

:Firstcheck
%%firstx = @mousepos(x)
%%firsty = @mousepos(y)
exit

:Secondcheck
%%secondx = @mousepos(x)
%%secondy = @mousepos(y)
rem If you want to call the Checkstuff yourselve, remove the next line and
rem place it in another place in your script...
gosub Checkmovement
exit

:Checkcharacter
list seek,9,0
rem %%var2 = @substr(%%characters,@diff(@len(%%characters),2),@len(%%characters))
if @match(9,@substr(%%characters,@diff(@len(%%characters),2),@len(%%characters)))
  %%text = %%text@substr(@substr(@item(9),1,1))
  dialog set,%%Edit1name,%%text
  %%characters = "   "
  dialog set,%%Edit2name,%%characters
  wait "0,5"
  beep
  wait "0,2"
  beep
  beep
  end
exit

:Checkmovement
if @both(@greater(%%firstx,@fadd(%%secondx,%%space)),@greater(%%firsty,@fadd(%%secondy,%%space)))@both(@greater(@diff(%%secondx,%%space),%%firstx),@greater(@diff(%%secondy,%%space),%%firsty))
  %%char = \
  exit
  end
if @both(@greater(@diff(%%secondx,%%space),%%firstx),@greater(@diff(%%firsty,%%space),%%secondy))
  %%char = /
  exit
  end
 if @both(@greater(%%firstx,@fadd(%%secondx,%%space)),@greater(%%secondy,@fadd(%%firsty,%%space)))
  %%char = /
  exit
  end
if @greater(@diff(%%secondx,%%space),%%firstx)@greater(%%firstx,@fadd(%%secondx,%%space))
  %%char = -
  exit
  end
if @greater(@diff(%%secondy,%%space),%%firsty)@greater(%%firsty,@fadd(%%secondy,%%space))
  %%char = |
  exit
  end
%%char = .
exit
