Friday, November 27, 2009

Re: character "\n" in SendKeys() parameter

On 02/11/09 16:04, anna wrote:
>
> Hi all,
>
> Is there a way to send a command containing a string "\n" via SendKeys
> () function through OLE.
> For example sending this following command.
> :let var="abc\ndef"
> Whenever I send a string containing character "\n". Only string before
> the character "\n" will be executed. So, here this command will be
> executed.
> :let var="abc
> And of course, it's a syntax error. Any suggestion how to send a
> string containing character "\n"?
> I have been trying to modify the number of backslashes.Yet, I haven't
> found any clue.
>
> Anna

IIUC, you want the \n to be converted to a carriage-return _after_ being
passed via SendKeys. So you must make sure that it is not converted too
early. Backslash-escaping the backslash might do it, or even passing the
string (with double quotes within single quotes)

:exe 'let var="abc\' . 'ndef"'

where the :execute command will put the \ and n together inside a
double-quoted string which :let will then evaluate.

Depending on how the "sending" application represents strings, there may
be an easier way of ensuring that the \n remains two characters until
the :let command evaluates the double-quoted string.


Best regards,
Tony.
--
"At least they're _EXPERIENCED_ incompetents"

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments: