Sign in to follow this  
Followers 0
0Ethan0

How to pass line breaks to the clipboard in a variable?

5 posts in this topic

Hello fellow AutoIt users :)

The short story of what I'm trying to achieve is this:

$SomeVariable = "some text with @CRLF so when I copy it to the clipboard it will create a new line while pasting"
ClipPut($SomeVariable)
WinActivate("Whatever Notepad WIndow")
WinWaitActive("Whatever Notepad WIndow")
Send{"^v"}

So I'm trying to find a way to mkae AutoIt understand that a @CRLF character in the variable is a line break.

Is there a way to send a line break via a variable?

Thanks for any input!

Cheers and happy AutoIt-ing ;) !

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Thanks for the answer AdmiralAlkex ;) but the thing is that the text in the variable is a result from some text extraction function (from HTML code) and there's sometime one <div> tag there that I wish to make as a new line.

I know I can do it by manipulating the string/ breaking it into two and than doing what you suggested but was just wondering if there is a way to use ClipPut("@CRLF") or some other wayt so when pasting it'll create a new line; just like when I copy text with line breaks in windows I get line breaks when I paste it.

This entire thing lead me to wonder how to pass TAB and other instances of this sort using ClipPut and pasting - if it's doable at all.

Edited by 0Ethan0

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

$SomeVariable = "some text with @CRLF so when I copy it to the clipboard it will create a new line while pasting"
$SomeVariable = StringReplace($SomeVariable, '@CRLF', Chr(13) & Chr(10))
ClipPut($SomeVariable)
WinActivate("Whatever Notepad WIndow")
WinWaitActive("Whatever Notepad WIndow")
Send{"^v"}

EDIT: Don't use bold text this way!!

Edited by Zedna

Share this post


Link to post
Share on other sites

Thanks Zedna - it works!

I'm terribly sorry about the bolded text (not sure how it happened, probably when I pasted something), I'll make sure it won't happen again.

Thanks again!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0