Results 1 to 4 of 4

Thread: Creating a text file with clipboard data

  1. #1

    Default Creating a text file with clipboard data

    I'm looking for ideas on the simplest way to create a .txt file containing whatever is in the clipboard? could this be done through a script as i'd like to avoid using mouse, window or keyboard emulation.

    IE, if clipboard contents is "this is a test", I'd like a script that would create
    C:\test.txt
    which would contain a single line: this is a test

    Any help is greatly appreciated,

  2. #2

    Default

    anyone? Thx

  3. #3
    Join Date
    May 2004
    Location
    Cardigan, UK
    Posts
    9,278

    Default

    Well, you can get the text that is in the clipboard using win.ClipboardGetText()

    So all you need to do then is write that to a file e.g.

    Code:
    local text = win.ClipboardGetText()
    local handle = io.open([[c:\test.txt]], "w+")
    handle:write(text)
    handle:close()
    --Rob

  4. #4

    Default

    Works great, thank you!

Posting Permissions

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