Ok i can't find a way to do this. I Have a program that is always rewriting to the same .txt file. This .txt file stayes open minamized for manual editing by the user when needed. when the user will run the script again it will write to the bottom of the .txt file which i want it to do. my problem is that we keep the .txt file open and not always saved before writing over it with the script. I have the script closing the window, writing the new data and the re-opening the .txt file. But if the .txt file is not saved it just opens a new window under the same name without saving any changes.
SO what i am looking for is a way to save the .txt file, Close the .txt file, then re-open it. I have the last 2 but can't seem to find a way to save the file before closing it.
Any help thanks
here is my script:
Let>workfile=c:\mydocs\test.txt
ifwindowopen>test.txt - Notepad
closewindow>test.txt - Notepad
else
endif
****run main script here****
writeln>workfile,r,newtext
end>workfile
exc>workfile
I have got around this by useing:
SetFocus>test.txt - Notepad
Press ctrl
send>s
closewindow>test.txt - Notepad
But i am looking for a way to save it with out using the setfocus since the .txt file is almost always minamized and am trying to prevent it from opening the window to save it.
How to save a file before closing it.
Moderators: JRL, Dorian (MJT support)
I don't know of a way to save the txt file while notepad is minimized, but have you thought about opening notepad then immediately moving it off screen. The most the user would see is a blip. When a window is moved off screen you can't send mouse related functions to it but it will accept keyboard related functions.But i am looking for a way to save it with out using the setfocus since the .txt file is almost always minamized and am trying to prevent it from opening the window to save it.
Try something like:
Code: Select all
IfWindowOpen>Notepad*
SetFocus>Notepad*
Wait>0.01
SetFocus>Notepad*
Wait>0.01
MoveWindow>Notepad*,-10000,-10000
Press Ctrl
Send>s
Release Ctrl
Wait>0.01
Press Alt
Send>f
Release Alt
Send>x
EndIf
Hope this is helpful,
Dick
OK, I see your script
If your text file is open, and the other program is writing to it, you should be able to close and reopen the txt file and it will be updated.
The only reason it would'nt be is if the other program was not writing to the file properly.
Is the other program written in MS or another language?
If MS I can post a script that will fix your problem.
If not MS, What language is the other program written in?
The only reason it would'nt be is if the other program was not writing to the file properly.
Is the other program written in MS or another language?
If MS I can post a script that will fix your problem.
If not MS, What language is the other program written in?
Aaron