Better answer still ?
Code:
;==================================================================
; active the AHK window spy and take a snapshot of the spy's date
;==================================================================
; if the spy is not already, open it. leave the spy open when done
;==================================================================
;==================================================================
; where to store the text data from AU3_Spy.exe
; The name of the file to be appended, which is assumed to be in
; %A_WorkingDir% if an absolute path isn't specified.
;==================================================================
datafile=text.txt
;==================================================================
delimiter=$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
ddelimiter:=delimiter delimiter "`n" delimiter delimiter "`n"
fileappend, %ddelimiter%, %datafile%
fileappend, `n`n`n, %datafile%
;msgbox %ddelimiter%
#singleinstance force
#Persistent
settitlematchmode 2
return
;==================================================================
; The snapshot is triggered by typing this hotkey
;==================================================================
#q:: ; use the Win-q hotkey, or modify as desired
;WinGetActiveTitle, Target
;msgbox %Target%
ifWinNotExist ahk_class AU3Reveal
{
Run, %A_AhkPath%\..\AU3_Spy.exe, , min
}
WinWait, ahk_class AU3Reveal,, 12
if (errorlevel<>0)
{
msgbox Couldn't start AU3_Spy.exe`n`nPress Ok to exit.
return
}
sleep, 500
; get the body of text that Window Spy has about current window
ControlGetText, OutputVar ,Edit1, ahk_class AU3Reveal
fileappend, %OutputVar%, %datafile%
fileappend, `n`n`n, %datafile%
fileappend, %ddelimiter%, %datafile%
fileappend, `n`n`n, %datafile%
;msgbox % OutputVar
;clipboard= %OutputVar%
;msgbox Data from AU3_Spy.exe copied to clipboard`n`nPress Ok to exit.
;msgbox % clipboard
return