Hi Doug.

This is the Information i needed. Thanks a lot. Tell me, is it me beeing to stupid to understand the WE scripting manual or do i look under the wrong search strings :-) ?

Best wishes

Richard
----- Original Message ----- From: "Doug Geoffray" <[email protected]>
To: <[email protected]>
Sent: Tuesday, June 15, 2010 3:12 PM
Subject: Re: Getting attributes from text under systemcursor?


Richard,

I see others responded with good information but I thought I would just show you how to get what you wanted directly.

Lets say I have Wordpad open and my cursor is sitting in a word. I can then pop up Immed and type:

@print text.character(cursor.position.screenpoint).foregroundcolor.red

Notice the line starts with an @ (at sign). This is needed because you need Immed to put focus back to the previous application before executing the command. Otherwise it would use the crusor in Immed which is moving because you just hit enter...blah blah

This command will return the red RGB color of the text. You can do the same for green and blue.

If you wanted the background then instead of specifying "foregroundcolor" you would specify "backgroundcolor" That also has an RGB color

If you want the style you can do:

@print text.character(cursor.position.screenpoint).FontStyle

This would return a number which combines the italic, strikeout, underline, bold attributes. So if you wanted to know if it is bold for example you could do:

@if text.character(cursor.position.screenpoint).FontStyle and fsBold Then : print "it is bold" : else : print "it is not bold" : end if

Hope this helps.

Doug


Richard Emling wrote:
Hello Scripters.

Today i need to know how i can recaive the attributes of text under the systemcursor. I need the color, and if the text is fat or underlined. What do i have to type into Immed? By the way, where can i find a comprehensive reference for everything thats not listed in the WE scripting reference? I am thinking of the whole activewindow.* stuff. Microsofts pages don't say something about it.

Thanks

Richard


Reply via email to