Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

48
LINES

< > BotCompany Repo | #1008219 // Get recognized text from phone on same subnet (#1008218)

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Libraryless. Click here for Pure Java version (6179L/43K).

1  
!7
2  
3  
static int delay = 1000;
4  
5  
static JLabel lblText;
6  
sS phoneIP, lineFromBot;
7  
8  
p {
9  
  makeBot("Forwarded Recognizer.");
10  
  swing {
11  
    setText_opt = false;
12  
    setConsoleWidth(400);
13  
    setConsoleHeight(500);
14  
    consoleFrame().setLocation(100, 100);
15  
    consoleFont(sansSerif(40));
16  
    wordWrapConsole();
17  
    consoleMaxChars(1000);
18  
  }
19  
  while licensed {
20  
    phoneIP = waitForPhone();
21  
    if (phoneIP == null) ret;
22  
    setConsoleTitle(phoneIP);
23  
    S last = "";
24  
    swing {
25  
      manualConsole();
26  
      lblText = jcenteredlabel();
27  
      lblText.setFont(sansSerif(40));
28  
      replaceComponent(consoleTextArea(), lblText);
29  
    }
30  
    repeat with ms sleep delay {
31  
      S s = lineFromBot = sendToPublicCommBot/*Silently*/(phoneIP, forward("Recognizer.", "text"));
32  
      s = substring(s, smartIndexOf(s, ":")+1);
33  
      last = s;
34  
      if (nempty(last)) {
35  
        L<S> tokens = javaTokC(s);
36  
        setText_htmlencode(lblText, joinLines(tokens));
37  
        setConsoleTitle(or2(join(" ", takeLast(2, tokens)), "[Speech]") + " - " + phoneIP);
38  
        awt {
39  
          lblText.scrollRectToVisible(new Rectangle(0, 10000, 1, 1));
40  
        }
41  
      }
42  
    }
43  
  }
44  
}
45  
46  
answer {
47  
  if "text" ret lineFromBot;
48  
}

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: #1008219
Snippet name: Get recognized text from phone on same subnet (#1008218)
Eternal ID of this version: #1008219/48
Text MD5: 853c01ba0ca4ee9fa616e086cccde242
Transpilation MD5: a5f3674c511e4f873b5acc4e5cdf26f4
Author: stefan
Category: javax / speech recognition
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-05-03 14:30:18
Source code size: 1233 bytes / 48 lines
Pitched / IR pitched: No / No
Views / Downloads: 662 / 1614
Version history: 47 change(s)
Referenced in: [show references]