Jump to content

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


Recommended Posts

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 ;) !

Link to comment
Share on other sites

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
Link to comment
Share on other sites

$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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...