Uses 3874K of libraries. Click here for Pure Java version (9232L/62K/216K).
!7 sS botName = "Dictation."; static JTextArea ta; static IVar<S> text; static Splitter1<S> 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<S> e = commandOrText(s); if (e.isA()) interpretCommand(e.a()); else { appendToTextArea(ta, e.b() + "\n"); requestFocus(ta); } } static Either<S> 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(); } }
Began life as a copy of #1009657
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1009702 | 
| Snippet name: | Dictation Bot with Splitter [dev.] | 
| Eternal ID of this version: | #1009702/6 | 
| Text MD5: | 6cc23f769d89f9fb803f29ec51115ab7 | 
| Transpilation MD5: | fb532283240b793739dead8cb4123e70 | 
| Author: | stefan | 
| Category: | javax / assistants | 
| Type: | JavaX source code | 
| Public (visible to everyone): | Yes | 
| Archived (hidden from active list): | No | 
| Created/modified: | 2017-08-14 16:55:45 | 
| Source code size: | 1457 bytes / 69 lines | 
| Pitched / IR pitched: | No / No | 
| Views / Downloads: | 686 / 808 | 
| Version history: | 5 change(s) | 
| Referenced in: | [show references] |