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.

metal gear solid asked Jan 20, 2010 at 3:53 metal gear solid metal gear solid 8,954 57 57 gold badges 120 120 silver badges 183 183 bronze badges

1 Answer 1

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.