Home » Questions » Computers [ Ask a new question ]

How to select any text and save that text directly in a .txt file in pre-specified folder?

How to select any text and save that text directly in a .txt file in pre-specified folder?

How to select any text and save that text directly in a .txt file in specified folder(in script like D:/backup/) and file name (filename.txt) should be asked upon pressing keyboard shortcut.

Asked by: Guest | Views: 106
Total answers/comments: 1
Guest [Entry]

"Many ways to go about doing this. The easiest would probably be to send Ctrl + c to store it in the clipboard, then write the clipboard contents to a text file:

^!p::
path= C:\
ClipSaved := ClipboardAll
Send ^c
clipwait
InputBox, location, save, Enter a filename:
FormatTime, TimeString,,MMM-dd-yyyy
FileAppend, %clipboard%, %path%\%location%-%TimeString%.txt
Clipboard := ClipSaved
ClipSaved=
return

Ctrl + Alt + p will trigger this. Let me know how it works I just hacked it together quickly."