Hi David,

    I had first mentioned the replace and then the split features. Now below is 
my properties inside my Sapi class. Note that these 2 properties can easily be 
changed to functions instead of properties.
    I also use a dictionary of words to look for and that to can be changed to 
what you wanted to replace the word with. Or do a search for any word with n in 
it. But I think this would work just as good.

    Also, the swap feature can also send in a second parm that is the match 
feature that Ron spoke about using that method. In other words besides using 
the alphabet for words you could use any test values. Now some words do have 
hyphens and underlines in them and you could add that to the list along with 
the alphabet.

    Below is to sort out a word in a sentence and I think it was something you 
did not want to do, but here it is anyway. 

        Sincerely
        Bruce




Dim Dict
        Set Dict = CreateObject("Scripting.Dictionary")

    Private Property Get 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 Property

    Public Property get 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 Property

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."

Reply via email to