Here is the appleScript that would achieve what you are looking for:
do shell script "screencapture -W ~/tmp"
tell application "System Events"
set frontApp to name of first application process whose frontmost is true
tell application frontApp
if the (count of windows) is not 0 then
set window_name to name of front window
set screenShotName to do shell script "date +%Y%m%d_%H%M%S_"
set screenShotName to screenShotName & window_name
do shell script "mv ~/tmp ~/\"" & screenShotName & "\".png"
Copy and paste the above into appleScript editor then save it as an app, you can name it whatever you want.
Double click the app icon select the window you want screenshoted and then make sure that you click that window to ensure it is the front one.