Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Apr 2008
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation javascript:Copy the selected text to notepad automatically

    Hi everyone,

    I need to copy the selected text(in website) to Notepad automatically. The details as follows:

    (1) I select the particular paragraph or sentence or word in the website.

    (2) Then, I press the Ctrl+C

    (3) When, I open the Notepad or msword or wordpad, the copied text need to pasted in the notepad or msword or wordpad automatically. I need the javascript to do this.
    please help me.

    Thanks in Advance,

    J. Mohan

  • #2
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,184
    Thanks
    10
    Thanked 569 Times in 550 Posts
    you cannot control notepad or word with javascript.

    the best you can do is merely get the text on the clipboard, and even that requires browser-specific routines, and security config changes.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/1/19) IE7:0.2, IE8:6.7, IE11:7.4, IE9:3.8, IE10:4.4, FF:18.3, CH:43.6, SF:7.8, MOBILE:27.5

  • #3
    Regular Coder
    Join Date
    Apr 2008
    Location
    New Jersey
    Posts
    116
    Thanks
    0
    Thanked 29 Times in 29 Posts
    The closest you're going to be able to do to that is triggering a download of a text/plain document, which the user may have the option of opening in notepad or whatever, according to how their browser is configured to handle those.
    Chaos
    Lost Souls: text based RPG | MUDseek: MUD gaming search | MUDfind: MUD resource sites | Discordian Quotes

  • #4
    New Coder
    Join Date
    Apr 2008
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question

    Quote Originally Posted by rnd me View Post
    you cannot control notepad or word with javascript.

    the best you can do is merely get the text on the clipboard, and even that requires browser-specific routines, and security config changes.
    thanks for your reply,

    ok, How can I transfer the copied text(website) to Clipboard using Javascript.
    Then, How to transfer the clipboard to Notepad.

  • #5
    New Coder
    Join Date
    Apr 2008
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts
    how to transfer the selected text to clipboard, then how to transfer the clipboard data to notepad.

    thanks for your reply,

    J. Mohan

  • #6
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,184
    Thanks
    10
    Thanked 569 Times in 550 Posts
    i have some code for firefox and ie, but like i said, you will need security changes to use it.


    is this just for something you are working on, or is this for a public site that lots of strangers use?

    the code wouldn't be much good in the second scenario.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/1/19) IE7:0.2, IE8:6.7, IE11:7.4, IE9:3.8, IE10:4.4, FF:18.3, CH:43.6, SF:7.8, MOBILE:27.5

  • #7
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,730
    Thanks
    202
    Thanked 2,508 Times in 2,486 Posts
    You will find an IE-only solution here:-

    http://www.htmlgoodies.com/beyond/ja...le.php/3458851

    I have the idea that no clipboard script will work in Firefox or Mozilla unless
    - you make a signed script
    - the user has changed the security settings on the browser.


    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

  • #8
    New Coder
    Join Date
    Apr 2008
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile

    Quote Originally Posted by Philip M View Post
    You will find an IE-only solution here:-

    http://www.htmlgoodies.com/beyond/ja...le.php/3458851

    I have the idea that no clipboard script will work in Firefox or Mozilla unless
    - you make a signed script
    - the user has changed the security settings on the browser.


    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.
    ok , I have found the solution to transfer the data to clipboard as follows:


    var mIE= document.selection.createRange();

    mIE.execCommand("Copy");

    Now, I need to transfer the clipboard data to notepad using javascript. How?

    J.Mohan.

  • #9
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,730
    Thanks
    202
    Thanked 2,508 Times in 2,486 Posts
    Quote Originally Posted by jmohan View Post
    Now, I need to transfer the clipboard data to notepad using javascript. How?
    Not possible.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •