I've been using notepad as a temp text storage since no other programs starts faster. To save or backup the content of notepad instances, I wrote some AHK code. It's basically based on miroxlav's Answer, but I don't need to restore.
So here comes the code.
+!s:: ;Save all notepad instance
ClipSaved := ClipboardAll
LastClip := ""
WinGet, id, list, *Untitled - Notepad, ,, ;[1]
Loop, %id%
{
this_id := id%A_Index%
WinActivate, ahk_id %this_id%
Send ^A
Send ^C
Sleep 500
WinMinimize, ahk_id %this_id%
WinGetClass, this_class, ahk_id %this_id%
WinGetTitle, this_title, ahk_id %this_id%
LastClip = %LastClip% `r`n-------`r`n %ClipBoard% ;[2]
ToolTip , Saving All Untitled Notepad Instances `n%a_index% of %id%`nahk_id %this_id%`nahk_class %this_class%`n%this_title%`n
}
ClipBoard := LastClip
; ToolTip , %ClipBoard%
Run notepad.exe
Sleep 1000
Send ^V
Sleep 1000
Clipboard := ClipSaved
ClipSaved =
#Persistent
ToolTip, Done
SetTimer, RemoveToolTip, 2500
return
RemoveToolTip:
SetTimer, RemoveToolTip, Off
ToolTip
return
return
Save the code into an .ahk
file, run it, and after pressing Alt+Shift+S
, all untitled notepad instance's content should be merged into one new notepad window.
Note:
- [1] If you want all notepad instances to be saved, not only the untitled one, change the
*Untitled - Notepad
to ahk_exe notepad.exe
should do the job.
- [2] That's for seperate line.
Though this answer comes from 5 years later, I still hope this will be some help to you.