Re: FW: [program-l] NVDA add-on development questions


James Scholes
 

Send a Windows WM_SETTEXT message to the field, assuming that it's a standard Win32 application.

import winUser
editBox = api.getFocusObject()
WM_SETTEXT = 0x000C
winUser.sendMessage(editBox.windowHandle, WM_SETTEXT, 0, "test")

You may also need to send an EM_SETSEL message to move the cursor after the text if required, because I think by default the cursor will remain at the start.

https://docs.microsoft.com/en-us/windows/win32/controls/em-setsel

Regards,

James Scholes

On 15/05/2020 at 1:44 pm, Adil Shaikh wrote:
thanks to everyone who answered my query.
I got that part of the add-on working. now, I am trying to add the selected text to a third party application.  initially, I  was considering to use clipboard to pass the selected text to third party application by just using simple copy and paste. but it doesn't feel quite right to me as it messes up with the clipboard content.
I've already tried this code:
editBox = api.getFocusObject ()
editBox.value = "some text
it's not working.
thanks josephly for forwarding my post to this mailing list.

Join nvda-addons@nvda-addons.groups.io to automatically receive all group messages.