John Salter
John Salter

Reputation: 182

Appending a .txt document with contents of clipboard using autohotkey

!w::
Sendinput ^c ; copy selection
Sleep 1000 ; gives time for the copy to work
FileAppend, `n`n%clipboard%, C:\Users\John Salter\ToAnki.txt; Add clipboard content to the end of a text file. Insert 2 new lines before inserting the clipboard with `n`n
Return

This is the script I've been trying to use. I was concerned about the space in between "John" and "Salter" so tried it in other locations but it still doesn't work.

I get no error messages.

The content of the the clipboard is altered, so the problem lies beneath the second line.

The use of FileAppend would seem to work looking at the help documentation.

Can anybody figure out what's going wrong?

Thanks!

Upvotes: 1

Views: 1123

Answers (1)

Relax
Relax

Reputation: 10568

A comment flag that appears on the same line as a command is not considered to mark a comment unless it has at least one space or tab to its left.

FileAppend, `n`n%clipboard%, C:\Users\John Salter\ToAnki.txt ; Add clipboard content to the end of a text file. Insert 2 new lines before inserting the clipboard with `n`n

Upvotes: 4

Related Questions