!7 sS botName = "Dictation."; static JTextArea ta; static IVar text; static Splitter1 commandOrText; static JTextArea whatYouSay; p-subst { if (nempty(sendOpt(botName, "activate"))) { cleanKill(); ret; } commandOrText = persistentObject("Command or text splitter", Splitter1); text = persistentVar("Text"); swing { moveFrameTo(10, 10, showFrame("What you say", whatYouSay = jTextArea())); showFrame(ta = jtextArea(text!)); onUpdate(ta, r { text.set(getText(ta)) }); exitProgramOnFrameClose(ta); } bot(botName); prioMe(); hideConsole(); } svoid prioMe { sendOpt("Voice Actions", "prio bot *", botName); } svoid cleanMeUp { sendOpt("Voice Actions", "prio bot done *", botName); } answer { if "activate" { prioMe(); activateFrame(ta); ret "OK"; } if "user said *" { onUtterance($1); ret "OK"; } } svoid onUtterance(S s) { setText(whatYouSay, s); Either e = commandOrText(s); if (e.isA()) interpretCommand(e.a()); else { appendToTextArea(ta, e.b() + "\n"); requestFocus(ta); } } static Either commandOrText(S s) { if (eq(s, "dictation done")) ret eitherA(s); int i = commandOrText.get(s); if (i != 0) ret either(s, i); ret eitherB(s); } svoid interpretCommand(S s) { if "dictation done" { sendOpt("Voice Actions", "prio bot done *", botName); cleanKill(); } }