You are here: PSPad forum > English discussion forum > Getting complete word on caret via script

Getting complete word on caret via script

#1 Getting complete word on caret via script

Posted by: Crow | Date: 2014-03-06 16:51 | IP: IP Logged

Is there a method which would return complete word which is on caret? I've read the documentation but there seems to be just method which return selected text. I wan't to write script which works with whole word without need to select it first (similar to how Find function works in PSPad).

Options: Reply | Quote | Up ^


#2 Re: Getting complete word on caret via script

Posted by: pspad | Date: 2014-03-06 17:21 | IP: IP Logged

You are right, there is no direct possibility to select word under cursor.
You can partially replace ith with 2 editor commends: ecWordLeft and ecSelWordRight, but it will mark all up to begin of the next word.

I will add command to select word into scripting

Options: Reply | Quote | Up ^


#3 Re: Getting complete word on caret via script

Posted by: pspad | Date: 2014-03-06 17:42 | IP: IP Logged

Forgot the last answer.

The correct answer is to use editor command ecSelWord. I will update readme.rtf in the Script root, cause this command is missing there

set obj = NewEditor()
obj.assignActiveEditor()
obj.command("ecSelWord")

Options: Reply | Quote | Up ^






Editor PSPad - freeware editor, © 2001 - 2022 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR