' b+ modification of Ken code, replace with Steve's Speak sub because Steve's Speak sub removes stumbling characters.
Dim information$
, nl$
, sentence$
, again$
' nl$ is common variable name for Next Line signal with Control Char.
start:
Print "CTRL-V to paste text and then press Enter to read through your speakers: " ExtendedInput information$
' Kem here we figure out what separtes lines in big copy/paste to input 3 choices
' now figure out if information has line delimiters either Chr$(10) or Chr$(13) or both?
' test with copy of first 2 lines here! nl$ = Chr$(13) + Chr$(10 for Basic IDE
'Print Len(nl$), Asc(nl$, 1)
'End
' Ken now we know how to split that massive input into single lines
ReDim text
(1 To 1) As String ' set up dynamice array with REDIM instead on DIM
'now we can split out all the lines in info to single lines
Split information$, nl$, text() ' splits to an array of text strings, single sentences usually
' Now that we have out sentences, we will read them one at a time until we finish or the user says Enough!
' How many sentences do we have?
' going through the sentences, press escape to exit th eread
For textIndex
= 1 To nSentences
sentence$ = text(textIndex)
speak sentence$, 0, 1
'go again?
_KeyClear ' for some reason regualar input is not working???? Input "Would you like to do another reading, y for yes "; again$
message = text
'some symbols and such can't be used with Powershell like this, as they're command symbols
'we need to strip them out of our text. (Like apostrophes!)
remove$
= "'" + Chr$(34) 'add to remove$ here, if more symbols need to be removed as future testing showcases problems out$
= "Powershell -Command " + Chr$(34) out$
= out$
+ "Add-Type -AssemblyName System.Speech; " out$
= out$
+ "$Speech = New-Object System.Speech.Synthesis.SpeechSynthesizer; " If Speaker
= 0 Then out$
= out$
+ "$Speech.SelectVoice('Microsoft David Desktop'); " If Speaker
= 1 Then out$
= out$
+ "$Speech.SelectVoice('Microsoft Zira Desktop'); " out$
= out$
+ "$Speech.Speak('" + message
+ "');" + Chr$(34)
Dim As Long A
, X
, Y
, CP
, OldCP
, AltDown
, k
, AltWasDown
, v
, blink
CP = 0: OldCP = 0 'Cursor Position
Select Case k
'ignore all keypresses except ALT-number presses Case 48 TO 57: AltWasDown
= -1: alt$
= alt$
+ Chr$(k
) Select Case k
'without alt, add any keypresses to our input oldIn$ = in$
If CP
> 0 Then OldCP
= CP: CP
= CP
- 1 in$
= Left$(in$
, CP
) + Mid$(in$
, CP
+ 2) 'backspace to erase input oldIn$ = in$
in$
= Left$(in$
, CP
) + Space$(4) + Mid$(in$
, CP
+ 1) 'four spaces for any TAB entered OldCP = CP
CP = CP + 4
oldIn$ = in$
'CTRL-V leaves cursor in position before the paste, without moving it after.
'Feel free to modify that behavior here, if you want it to move to after the paste.
'CP = CP + LEN(_CLIPBOARD$)
oldIn$ = in$
in$
= Left$(in$
, CP
) + Chr$(k
) + Mid$(in$
, CP
+ 1) 'add input to our string OldCP = CP
CP = CP + 1
CP = 0
oldIn$ = in$
CP = CP - 1
CP = CP + 1
alt$ = "": AltWasDown = 0
blink
= (blink
+ 1) Mod 30
curpos
= 1: arrpos
= LBound(loadMeArray
): LD
= Len(delim
) dpos
= InStr(curpos
, SplitMeString
, delim
) loadMeArray
(arrpos
) = Mid$(SplitMeString
, curpos
, dpos
- curpos
) arrpos = arrpos + 1
curpos = dpos + LD
dpos
= InStr(curpos
, SplitMeString
, delim
) loadMeArray
(arrpos
) = Mid$(SplitMeString
, curpos
)