08-08-2006, 03:58 PM
More examples.
Function SpeakSelection.
Trigger CAs (Ctrl+Alt+S)
Function SpeakSelection2.
Trigger CSs (Ctrl+Shift+S)
Function SpeakSelection.
Trigger CAs (Ctrl+Alt+S)
if(getopt(nthreads)>1) key D; 0.3
AddTrayIcon "sound.ico"
int+ __speak_sel_info
str si=
;This function speaks selected text, one sentence at a time.
;Use these keys to control it:
;
;Left - repeat this sentence.
;Right - next sentence (in the selected text).
;Up - previous sentence.
;Down or other key - stop.
if(!__speak_sel_info) __speak_sel_info=1; mes si "" "i"
str s.getsel
if(!s.len) ret
ARRAY(str) a
tok s a -1 "[].;?!" ;;end-of-sentence characters
int i
for(i a.len-1 -1 -1) a[i].trim; if(!a[i].len) a.remove(i)
for i 0 a.len
,Speak a[i] 0 "" -1
,sel wait(0 KF)
,,case VK_RIGHT
,,case VK_LEFT i-1
,,case VK_UP i-iif(i 2 1)
,,case else SpeakStop; ret
,,
Function SpeakSelection2.
Trigger CSs (Ctrl+Shift+S)
if(getopt(nthreads)>1) key U; 0.3
int+ __speak_sel_info2
str si=
;This function speaks selected text.
;Use these keys to control it:
;
;Left - repeat this sentence.
;Right - next sentence (in the selected text).
;Up - previous sentence.
;Down - pause/resume.
;Other keys (eg Ctrl) - stop.
if(!__speak_sel_info2) __speak_sel_info2=1; mes si "" "i"
str s.getsel
if(!s.len) ret
s.findreplace("..." ".")
int paused
Speak s 0 "" -1
rep
,sel wait(0 KF)
,,case VK_LEFT __spvoice.Skip("Sentence" 0); continue
,,case VK_RIGHT __spvoice.Skip("Sentence" 1); continue
,,case VK_UP __spvoice.Skip("Sentence" -1); continue
,,case VK_DOWN paused^1; if(paused) __spvoice.Pause; else __spvoice.Resume
,,case else SpeakStop; ret