viewtopic.php?f=76&t=106071
and have so far made it so that the notepad file will open in the background when the script runs, and then paste my clipboard into the notepad. But I'm having trouble getting control to save the file while its in the background, cus when the script goes to close the notepad window, I get a pop-up window asking me if I want to save it or not first before closing it, so clearly the ctrl+s command is not being sent.
edit: I need the latest content at the top, and oldest at the bottom. This is all needs to be done in the background or thru directly writing to the file.
Code: Select all
SetKeyDelay 0
SetTitleMatchMode, 2
FileEncoding, UTF-8
FileAppend,, found.txt
IFWinNotExist, % BackGround := "found.txt ahk_exe NotePad.exe"
Run, "NotePad.exe" "found.txt",, Min
sleep 500
ControlSend, Edit1, %clipboard%`n`n`n`n, %BackGround%
sleep 100
; ControlSend, {Ctrl Down}s{Ctrl Up}, %BackGround% ; <---cant get control to save the file while it's in background/minimized
ControlSend, Edit1, {Ctrl Down}s{Ctrl Up}, %BackGround% ; <--tried this too
sleep 200
if WinExist("found.txt - Notepad")
WinClose ; at this point it asks me if I want to save the file first before closing
ExitApp