Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 04, 2016, 02:14:41 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Clipboard to text file  (Read 646 times)

rgdot

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 1,879
    • View Profile
    • Donate to Member
Clipboard to text file
« on: October 25, 2016, 04:09:54 PM »
This I guess is not a request but a noob question  :-[

Running AHK, compiled a exe, what is missing from

#Persistent
OnClipboardChange:
FileAppend, %clipboard%, ‪C:\Users\RG\Desktop\clip1.txt
return

to keep all copied text in the text file?



skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 4,664
    • View Profile
    • Donate to Member
Re: Clipboard to text file
« Reply #1 on: October 26, 2016, 01:58:45 AM »
It works here for me.  However, you're trying to write to a UAC-protected folder so you will have to have either have admin rights or run the executable with admin rights.  Alternately, you could write to a non-UAC-protected folder.  Also, I'd add a CRLF when writing out the clipboard contents like this:

Code: Autohotkey [Select]
  1. FileAppend, %clipboard%`r`n, ‪C:\Users\RG\Desktop\clip1.txt

rgdot

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 1,879
    • View Profile
    • Donate to Member
Re: Clipboard to text file
« Reply #2 on: October 26, 2016, 09:42:00 AM »
Desktop is UAC protected?  Moved it to Documents and doesn't work either.

Strange.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 4,664
    • View Profile
    • Donate to Member
Re: Clipboard to text file
« Reply #3 on: October 26, 2016, 01:25:04 PM »
Did you try running it with admin rights?

rgdot

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 1,879
    • View Profile
    • Donate to Member
Re: Clipboard to text file
« Reply #4 on: October 26, 2016, 01:39:26 PM »
Yes I did, not really sure what is going on, I will try other ready made scripts and see if I can get any hints. My fault for spending more time on windows again  :P

rgdot

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 1,879
    • View Profile
    • Donate to Member
Re: Clipboard to text file
« Reply #5 on: October 26, 2016, 01:43:33 PM »
For example something as simple as this works fine

Capslock::Shift
return

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,277
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Clipboard to text file
« Reply #6 on: October 26, 2016, 03:48:13 PM »
This I guess is not a request but a noob question  :-[

Running AHK, compiled a exe, what is missing from

#Persistent
OnClipboardChange:
FileAppend, %clipboard%, ‪C:\Users\RG\Desktop\clip1.txt
return

to keep all copied text in the text file?




I don't know if it makes any difference but the thing I notice where your script differs from the example is the example has a Return directly after the #Persistent directive.  Also I would probably use the A_EventInfo to find out if the clipboard data is of type text.


rgdot

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 1,879
    • View Profile
    • Donate to Member
Re: Clipboard to text file
« Reply #7 on: October 26, 2016, 09:56:05 PM »
I believ %Clipboard% is already Text type %ClipboardAll% would be other formats

rgdot

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 1,879
    • View Profile
    • Donate to Member
Re: Clipboard to text file
« Reply #8 on: October 26, 2016, 10:29:56 PM »
As expected something trivial was needed

:down:
Code: Autohotkey [Select]
  1. FileAppend, %clipboard%`r`n, ‪C:\Users\RG\Desktop\clip1.txt

:up:
Code: Autohotkey [Select]
  1. FileAppend, %clipboard%`r`n, %A_WorkingDir%\clip1.txt

Thanks guys :)

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,277
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Clipboard to text file
« Reply #9 on: October 27, 2016, 07:22:08 AM »
I believ %Clipboard% is already Text type %ClipboardAll% would be other formats

True.  Also you can test %ClipBoard% for blank.  I think there is an unwritten rule stuff cannot work the first time.  Once you get things fixed they often look pretty close to what you started with.  :)