Advertisement
basictomonokai

音声メモ帳のBASIC!プログラム

Jun 21st, 2016
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.37 KB | None | 0 0
  1. console.title "音声メモ帳"
  2.  
  3. cls
  4.  
  5. !print "音声メモ帳です。\n録音ボタンを押せば録音します。\n読み上げボタンをおせば読み上げします。"
  6. !console.save "stttts.txt"
  7.  
  8.  
  9. grabfile hokan$,"stttts.txt",1
  10. grabfile outhtml$,"stttts1.htm",1
  11.  
  12. allstart:
  13. console.title "音声メモ帳"
  14.  
  15.  
  16. outhtmlx$=replace$(outhtml$,"@@@1@@@",hokan$)
  17.  
  18. nxttest:
  19.  
  20. HTML.OPEN
  21.  
  22. HTML.LOAD.string outhtmlx$
  23.  
  24. xnextUserAction:
  25.  
  26. ! loop until data$ is not ""
  27.  
  28. DO
  29. HTML.GET.DATALINK data$
  30. UNTIL data$ <> ""
  31.  
  32. type$ = LEFT$(data$, 4)
  33.  
  34. data$ = MID$(data$,5)
  35.  
  36. ! Act on the data type
  37. ! Shown are all the current data types
  38.  
  39. SW.BEGIN type$
  40.  
  41. ! Back Key hit.
  42. ! if we can go back then do it
  43. SW.CASE "BAK:"
  44. PRINT "BACK key: " + data$
  45. popup "終了します",0,0,0
  46. pause 2000
  47. end
  48. SW.BREAK
  49.  
  50. ! A hyperlink was clicked on
  51. SW.CASE "LNK:"
  52. PRINT "Hyperlink selected: "+ data$
  53. popup "リンク先をロード中",0,0,1
  54. ! HTML.LOAD.URL data$
  55. browse data$
  56.  
  57.  
  58. SW.BREAK
  59.  
  60. ! An error occured
  61. SW.CASE "ERR:"
  62. PRINT "Error: " + data$
  63. popup "エラーが発生しました 終了します",0,0,0
  64. pause 2000
  65. exit
  66. SW.BREAK
  67.  
  68. ! User data returned
  69. SW.CASE "DAT:"
  70. PRINT "User data: " + data$
  71.  
  72. ! Check for Exit
  73. IF data$ = "//x//" then
  74. PRINT "User ended demo."
  75. HTML.CLOSE
  76. popup "終了します",0,0,0
  77. pause 5000
  78. exit
  79. else
  80. msx$=data$+"←データの内容"
  81. popup msx$,0,0,0
  82. if left$(data$,5)="//b//" then
  83. spwk$=mid$(data$,6)
  84. tts.init
  85. tts.speak spwk$
  86. tts.stop
  87. goto xnextUserAction
  88. endif
  89.  
  90. if left$(data$,5)="//y//" then
  91. popup "ファイル保存開始",0,0,1
  92. svwk$=mid$(data$,6)
  93. cls
  94. print svwk$
  95. console.save "stttts.txt"
  96. pause 1000
  97. print "◆◆◆ 上記内容を保存しました"
  98. popup "ファイル保存終了",0,0,1
  99. goto xnextUserAction
  100. endif
  101.  
  102.  
  103. if left$(data$,5)="//a//" then
  104. html.close
  105. console.title "録音準備中"
  106. pause 4000
  107. spwk2$=mid$(data$,6)
  108.  
  109. console.title "録音開始"
  110. cls
  111. print "録音を開始しました"
  112. recstart:
  113. stt.listen
  114. stt.results thelist
  115. list.size thelist,thesize
  116. print "選択候補の出力"
  117. for k=1 to thesize
  118. list.get thelist,k,thetext$
  119. print str$(k);":";thetext$
  120. next k
  121.  
  122. List.add thelist,"exit"
  123.  
  124. Dialog.select selx,thelist,"選択してください"
  125.  
  126. list.get thelist,selx,seltext$
  127.  
  128. print "選択結果: ";
  129. print seltext$
  130.  
  131. list.clear thelist
  132.  
  133. if seltext$="exit" then
  134. console.title "録音完了→更新開始"
  135. hokan$=spwk2$
  136. goto allstart
  137. else
  138. console.title "録音継続中"
  139. spwk2$=spwk2$+"\n"+seltext$+"。"
  140. goto recstart
  141. endif
  142.  
  143. goto allstart
  144. endif
  145.  
  146.  
  147.  
  148. html.close
  149. pause 5000
  150. ! run data$
  151. goto nxttest
  152. ENDIF
  153. SW.BREAK
  154.  
  155. ! Form data returned.
  156. ! Note: Form data returning
  157. ! always exits the html.
  158.  
  159. SW.CASE "FOR:"
  160. PRINT "Form data: "+data$
  161. popup "終了します",0,0,0
  162. pause 2000
  163. exit
  164. SW.BREAK
  165.  
  166.  
  167.  
  168. SW.DEFAULT
  169. PRINT "Unexpected data type:", type$ + data$
  170. popup "終了します",0,0,0
  171. pause 2000
  172. exit
  173.  
  174. SW.END
  175.  
  176. GOTO xnextUserAction
  177.  
  178.  
  179. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement