Hope people will understand me.....
I would like to keep a log of all the copying text i collect with ctrl+c..... i've read a ton of examples but didn't find anyone which can do this... so for example:
Some site, some text, i select the text i want to copy, press ctrl+c, from then on i would like the selected copied text to be in a file somewhere on the harddrive AND still must be in the buffer (copied text) so i can use it like i always do...
I've also examed the clipboard scripts but i'm not that good to make an own script
Write content of the clipboard to a log file (eg .txt) Topic is solved
Re: Write content of the clipboard to a log file (eg .txt)
The built-in function OnClipboardChange() seems to be made for this:
Change the file path of the text file to one that suits you.
Note that if you copy a file in explorer, it's file path will also be saved to the text file, although it will paste the actual file (one of the quirks of the built-in clipboard variable) - if you don't want this, you will have to check the contents of clipboard each time before saving and throw strings out that look like file paths ...
Code: Select all
#Persistent
OnClipboardChange("ClipChanged") ; place in script's auto-execute section
return
ClipChanged(Type) {
If (type = 1) ; is (new) text in the clipboard?
FileAppend, % Clipboard "`n", C:\Users\g\Desktop\clip.txt ;then append it to text file
}
Note that if you copy a file in explorer, it's file path will also be saved to the text file, although it will paste the actual file (one of the quirks of the built-in clipboard variable) - if you don't want this, you will have to check the contents of clipboard each time before saving and throw strings out that look like file paths ...
Re: Write content of the clipboard to a log file (eg .txt)
ah great thanx! it works
i would like to have a date in front of the output in the txt file i've tried :
added:
this works:
#Persistent
OnClipboardChange("ClipChanged") ; place in script's auto-execute section
return
FormatTime, TimeString,, MMddyyyy
ClipChanged(Type) {
If (type = 1) ; is (new) text in the clipboard?
FileAppend, % Clipboard "`n ", C:\aa\%A_YYYY%-%A_MM%-%A_DD%clip.txt ;then append it to text file
}
this makes an new file every other day...
i only want to add time in each of the txt files
i would like to have a date in front of the output in the txt file i've tried :
added:
this works:
#Persistent
OnClipboardChange("ClipChanged") ; place in script's auto-execute section
return
FormatTime, TimeString,, MMddyyyy
ClipChanged(Type) {
If (type = 1) ; is (new) text in the clipboard?
FileAppend, % Clipboard "`n ", C:\aa\%A_YYYY%-%A_MM%-%A_DD%clip.txt ;then append it to text file
}
this makes an new file every other day...
i only want to add time in each of the txt files
Last edited by loek3000 on 23 Jun 2018, 04:17, edited 2 times in total.
-
- Posts: 112
- Joined: 06 Jun 2016, 21:32
Re: Write content of the clipboard to a log file (eg .txt)
date=%a_yyyy%-%a_mm%-%a_dd%
Fileappend % clipboard "`n" date "`n", C:\aa\clip.txt
Fileappend % clipboard "`n" date "`n", C:\aa\clip.txt
Re: Write content of the clipboard to a log file (eg .txt)
@MonuKashyap thanx but can you review my post above?
Re: Write content of the clipboard to a log file (eg .txt)
Maybe it's not clear, it works for now, but to add: i want to add a timestamp (only hours and minutes) in front of any line in the txt file....
thanx alot for the help so far
thanx alot for the help so far
Re: Write content of the clipboard to a log file (eg .txt)
Code: Select all
#NoEnv
#Persistent
OnClipboardChange("ClipChanged")
Return
ClipChanged(type) {
FormatTime, date, A_Now, yyyy'-'MM'-'dd
if (type == 1)
FileAppend, % Format("{}: {}`n", date, Clipboard), % Format("C:\aa\{}clip.txt", date)
}
Re: Write content of the clipboard to a log file (eg .txt)
thanx swagfag
but instead of a date can i do a time: hours minutes?
but instead of a date can i do a time: hours minutes?
Re: Write content of the clipboard to a log file (eg .txt)
you absolutely can, formattime supports besides date formats, well, time formats, as the name would imply.
for a list of available formats, consult the docs.
for a list of available formats, consult the docs.
Re: Write content of the clipboard to a log file (eg .txt)
yeah but i don't know how to do this....
the file only the date, in the file just the time...
the file only the date, in the file just the time...
Re: Write content of the clipboard to a log file (eg .txt)
I now have:
#NoEnv
#Persistent
OnClipboardChange("ClipChanged")
Return
ClipChanged(type) {
FormatTime, date, A_Now, yyyy-MM-d (ddd)
if (type == 1)
FileAppend, % Format("{}: {}`n", date, Clipboard), % Format("C:\aa\{} clip.txt", date)
}
which resulted in a file called the date and the first 2 letters of the day (za)
tho i wished IN the text file ONLY the time was visible and NOT the year, month and day...
#NoEnv
#Persistent
OnClipboardChange("ClipChanged")
Return
ClipChanged(type) {
FormatTime, date, A_Now, yyyy-MM-d (ddd)
if (type == 1)
FileAppend, % Format("{}: {}`n", date, Clipboard), % Format("C:\aa\{} clip.txt", date)
}
which resulted in a file called the date and the first 2 letters of the day (za)
tho i wished IN the text file ONLY the time was visible and NOT the year, month and day...
Re: Write content of the clipboard to a log file (eg .txt) Topic is solved
just define another format and youre good to go
Code: Select all
#NoEnv
#Persistent
OnClipboardChange("ClipChanged")
Return
ClipChanged(type) {
now := A_Now
FormatTime, date, now, yyyy-MM-dd
FormatTime, time, now, HH:mm:ss
if (type == 1)
FileAppend, % Format("[{}] {}`n", time, Clipboard), % Format("C:\aa\{}clip.txt", date)
}
Re: Write content of the clipboard to a log file (eg .txt)
yeah i struggled to make this but every time it wasn't exactly what i wanted, this IS, have to make some changes, but i manage
thanx alot!
thanx alot!
Who is online
Users browsing this forum: No registered users and 136 guests