CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Writing a new line to Clipboard to paste into plaintext format

 



abhiomkar
New User

Apr 1, 2008, 2:36 AM

Post #1 of 5 (664 views)
Writing a new line to Clipboard to paste into plaintext format Can't Post

Hi,

I am beginner to perl,

I am using Win32::Clipboard, to set the clipboard content using perl.


Program:

use Win32::Clipboard;
Win32::Clipboard::Set("FirstName\nLastName");


When i run the above porgram, it 'll set the clipboard content to
FirstName followed by newline and followed by LastName.

If i paste the clipboard content into the notepad. The box appears (shown in the screenshot attached) instead of the newline, i don't know why. But, when i paste it into the word document the FirstName and LastName appears in two lines (it is normal).



How can i get the new line instead of box (as shown in the screenshot attached) when i paste the clipboard into notepad (or any plaintext editor) ?

Plz, Can anybody help ?

Thank you.


KevinR
Veteran


Apr 1, 2008, 10:37 AM

Post #2 of 5 (657 views)
Re: [abhiomkar] Writing a new line to Clipboard to paste into plaintext format [In reply to] Can't Post

try:

"FirstName\r\nLastName"
-------------------------------------------------


abhiomkar
New User

Apr 1, 2008, 9:51 PM

Post #3 of 5 (655 views)
Re: [KevinR] Writing a new line to Clipboard to paste into plaintext format [In reply to] Can't Post

Hi KevinR,

Its working now :)

btw, what \r does ?


KevinR
Veteran


Apr 1, 2008, 10:11 PM

Post #4 of 5 (653 views)
Re: [abhiomkar] Writing a new line to Clipboard to paste into plaintext format [In reply to] Can't Post

Windows uses \r\n as the record seperator for plaintext files, which is carraige return (\r) - newline (\n). Notepad must require that they are both there to format the document properly. Other applications, like Word, seem to be able to handle just \n.
-------------------------------------------------


abhiomkar
New User

Apr 2, 2008, 1:44 AM

Post #5 of 5 (652 views)
Re: [KevinR] Writing a new line to Clipboard to paste into plaintext format [In reply to] Can't Post

Thanks KevinR :)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives