Hi Vic,

here's a little something you didn't ask for, but I'm sending in case it
helps.  it looks to me like you may be wanting to find and speak highlighted
text; I had a need to do this, but didn't want to hard-code in the
background color (allowing for changes in color themes).  I'm pretty sure
windows keeps this info somewhere, but since we can't easily get to it, I
wrote the below routine which analyzes text, assuming that one of them will
be highlighted; it determines what the background color being used is:

' count the various background color combinations used to find the one which
represents highlighted text
dim oBackgrounds
set oBackgrounds = createObject("scripting.dictionary")
dim sColorString 
dim i: i = 0
dim oCurClip
For Each oCurClip in oWindow.clips
if oCurClip.type = ctText Or oCurClip.type = ctFakeText then
sColorString = hex(oCurClip.backgroundColor.red) &
hex(oCurClip.backgroundColor.green) & hex(oCurClip.backgroundColor.blue)
if oBackgrounds.exists(sColorString) then
oBackgrounds(sColorString) = oBackgrounds(sColorString) + 1
else
i = i + 1
oBackgrounds.add sColorString, 1
end if
end if
next

dim s
for each s in oBackgrounds.keys
if oBackgrounds(s) = 1 then
' this is the highlight background
speak "found highlight color" ' temporary
sHighlightColor = s
exit sub
end if
next
speak "unable to find the highlight background color from " & i & " choices"

 

-----Original Message-----
From: Vic Beckley [mailto:[email protected]] 
Sent: Sunday, November 22, 2009 9:46 PM
To: [email protected]
Subject: Speaking clips of a certain color

Hi all,

 

I want to speak all clips with a blue background color of 242.  Below is my
code and the error I am getting.  What is wrong with my code?

 

Dim FocusEvent : FocusEvent = ConnectEvent(DesktopWindow,
"OnChildClipRendered", "OnChildClipRendered")

 

Sub OnChildClipRendered(myClip)

Speak "called"

If not myClip is nothing Then

If myClip.BackgroundColor.Blue = 242 Then

Speak "true"

Speak myClip.Text

End If

End If

End Sub

 

Error:  Description: Object required: 'myClip.BackgroundColor'

 

Please help!

 

Vic

 



__________ Information from ESET NOD32 Antivirus, version of virus signature
database 4628 (20091122) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


Reply via email to