Hi Again David,
This is the function version and I had posted all of this on line back on
July 11 I think,
Note: you could use a match for this call using
this Prototype for the swap function below
Dim match: match = "abcdefghijklmnopqrstuvwxyz"
Function swapTxt( match, txt)
if InStr( match, LCase( mid( txt, i, 1)))
Dim Dict: Set Dict = CreateObject("Scripting.Dictionary")
Function swapTxt( txt)
dim i, b, w
dim txt2
txt2 = ""
w = 0
for i = 1 to len( txt)
if InStr( "abcdefghijklmnopqrstuvwxyz", LCase( mid( txt, i, 1)))
then
if w=0 then
w=1
b=i
End If
else
if w=1 then
w=0
txt2 = txt2 & getMisSpell( LCase( mid( txt, b, i-b)))
txt2 = txt2 & mid( txt, i, 1)
Else
txt2 = txt2 & mid( txt, i, 1)
End If
End If
next
if w=1 then
w=0
txt2 = txt2 & getMisSpell( LCase( mid( txt, b)))
End If
' txt2 = txt
swapTxt = txt2
End Function
Sub setMisSpell( oldword, newword)
'CONVERTING OLDWORD INTO LOWERCASE FOR UNIVERSAL SPELLING!
Dict.Add LCase(oldword), newword
End Sub
Function getMisSpell( oldword)
'IF OLD WORD KEY IS NOT IN DICTIONARY, THE ORIGINAL OLD WORD IS
RETURNED!
if Dict.Exists( LCase(oldword)) then
getMisSpell = Dict( LCase(oldword))
else
getMisSpell = oldword
End If
End Function
Sent: Saturday, August 20, 2011 6:23 PM
Subject: Re: Guess I am on the wrong Event?
Oops, the snip I send, had an error in it. Here is the correct line, but it
doesn't work:
If InStr(OriginalString, "/") Then OriginalString = "Fractional, " &
OriginalString
Speak "Fractional, is running."
----- Original Message -----
From: David
To: [email protected]
Sent: Sunday, August 21, 2011 12:18 AM
Subject: Guess I am on the wrong Event?
Hi scripters,
I am trying to make an app that handles fractional numbers. That is, have it
speak the word "Fractional", when it reaches numbers like 1/4. Below is a snip
of my code. My thought was to connect to the Speech/OnSpeak event, and simply
check if there is a SLASH in the original string. But that seems not to work.
When things like 1/2, 2/3 or 3/4 occurs, it seems that the OnSpeak string is
broken into two seperate strings, by Window-Eyes. Not sure why GW would do such
a thing, but that seems to be the case. In other words, the 1/3, will be broken
into two strings: "1", and "3". This causes, far as I can see, Window-Eyes not
to ever 'see' the slash inbetween; hence my code never works.
Am I connecting to the wrong event? Is there a better approach to the matter?
---Snip of code---
ConnectEvent Speech, "OnSpeak", "MOnSpeak"
Function MOnSpeak( OriginalString )
If InStr(OriginalString, "4") Then OriginalString = "Fractional, " &
OriginalString
MOnSpeak = OriginalString
End Function 'MOnSpeak.
----End of snip----
Speak "Fractional, is running."