>Is there a way to create a Notepad object ? I would like to open Notepad and show text. The next call to Notepad should use the same instance and just replace the text. I know you can make an object that references Word.Application. Can the same be done with Notepad ? If so, where can I get a list of the available commands/methods in Notepad ?
>
>If not Notepad, how about WordPad ? For my use, Word would be to much.
Notepad isn't a automation server. Some ideas
1) Copy the text file to and from an editbox on a form
Get the file:
THISFORM.edtJoe.VALUE = FILETOSTR("c:\evan.txt")
Save the file:
STRTOFILE(THISFORM.edtJoe.VALUE,"c:\evan.txt")
2) Use the Windows API to open a text file, thus opening notepad. The downside is you can't close notepad and the user would have to do it.
DECLARE INTEGER ShellExecute IN "Shell32.dll" ;
INTEGER hwnd, ;
STRING lpVerb, ;
STRING lpFile, ;
STRING lpParameters, ;
STRING lpDirectory, ;
LONG nShowCmd
shellexecute(0,"OPEN","c:\evan.txt","","",1)
3) Use word then you have a big, but full featured text editor that you can control. A simple example.
oWord = CREATEOBJECT("word.application")
oWord.visible = .T.
oDoc = oWord.Documents.Open("c:\evan.txt")
oDoc.Save()
oWord.Quit()
RELEASE oDoc
RELEASE oWord