Posted by: Professor Bernd | Date: 2019-10-06 15:22 | IP: IP Logged
I would like to implement the highlighting function for identical words via VBScript. Therefore I could use "selText" to find the marked word and search for further occurrences. But how can I highlight the words?
See feature requests
Posted by: pspad | Date: 2019-10-06 15:50 | IP: IP Logged
Set curso to the start of the word and call SelStart() foolowed by SelLength(length_of_the_word)
Set cursor to start of the word and call editorCommand(ecSelWord)
Posted by: vbr | Date: 2019-10-06 18:24 | IP: IP Logged
Professor Bernd:I would like to implement the highlighting function for identical words via VBScript. Therefore I could use "selText" to find the marked word and search for further occurrences. But how can I highlight the words?
See feature requests
I think, this functionality is currently not supported - the mentioned script commands perform a selection - e.g. for copying text etc. - only one selection at a time is possible, multiple selected text portions are not supported with the current editor component.
Other kinds of marking string occurrences, such as font or background color cannot be set individually in this manner either, as far as I know. (only e.g. for syntax highlighters etc.)
Posted by: Professor Bernd | Date: 2019-10-07 20:15 | IP: IP Logged
What I meant was what vbr wrote: One word is marked and the other occurrences are highlighted. Here is a screenshot.
I'm working on an PSPad extension (VBScript) to use the highlighter for this purpose. In the highlighter (AutoIt3.ini) in the unused section "Key words 3" I set a font and background color. With VBScript I check if a word has been marked and write it temporarily into the section "Key words 3" of AutoIt3.ini. Then (almost) all occurrences of the word are highlighted.
If the word is unmarked, the entry in AutoIt3.ini is also deleted => all highlights are removed.
This might work, but there are some problems, e.g. that occurrences in comments are not highlighted. (see screenshot)
Is there a way to highlight words using VBScript?
Many thanks for the tip about the EditorCommands! I searched a little and found a good hint here. I searched the PSPad directory for a rtf and found the Scripting.rtf. Is there more information about EditorCommands? Is there a command to set the background color for identical words?