Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 3 down vote accepted

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:

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

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

share|improve this answer
@john - I want to set path manually in script code and only file name should be asked by dialog-box and extension should be fixed (.txt) with current date as a suffix of file like Filename-currentDate.txt. i want to give only filename and saving file would be like this estillproject-20/jan/10.txt – metal gear solid Jan 20 '10 at 17:10
John T - Where are you? – metal gear solid Jan 21 '10 at 7:38
@Jitendra I was asleep then at school, sorry. From what it looks like you want it to also make directories? Or am I mistaken? I've edited the code so you can put the path at the top, where it says path=, files will be saved in the format Filename-Jan-21-2010.txt if that's what you're after? – John T Jan 21 '10 at 18:29
sorry it's working i had not created a folder. You are my lifesaver. You are awesome. – metal gear solid Jan 21 '10 at 18:55
You're welcome :) – John T Jan 21 '10 at 19:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.