Page 1 of 1

End of text in asociated Notepad

Posted: Wed Mar 21, 2018 2:01 pm
by Lubos
Using the RunProgram(GetCurrentDirectory () + B$ + ".txt") , I open the associated Notepad.exe. I would like it to open at the end of the text (so that the end of the text can be seen immediately). Is it possible to arrange?

Re: End of text in asociated Notepad

Posted: Wed Mar 21, 2018 2:08 pm
by RSBasic
Do you mean like this?

Code: Select all

EnableExplicit

Define Handle

RunProgram("notepad.exe", "D:\HTMLCode.txt", "", 0) ; <<< Change path
Delay(500)
Handle = FindWindow_("notepad", 0)
If Handle
  Handle = FindWindowEx_(Handle, 0, "Edit", 0)
  If Handle
    SendMessage_(Handle, #EM_SETSEL, $fffffff, $fffffff)
    SendMessage_(Handle, #EM_SCROLL, #SB_BOTTOM, 0)
  EndIf
EndIf
Instead of FindWindow_() you can also use EnumWindows_().

Re: End of text in asociated Notepad

Posted: Wed Mar 21, 2018 2:30 pm
by Lubos
RSBasic wrote:Do you mean like this?
I am impressed! So fast and so perfect answer. Thank you.

Re: End of text in asociated Notepad

Posted: Wed Mar 21, 2018 2:36 pm
by Marc56us
There is a very old function in NotePad, it's ability to serve as a log or memo.

To do this, you must:
- Write .LOG on the first line (and nothing else) (yes dot log)
- Save the file with the extension .log

At each opening, the notepad add the date and time and positions the cursor at the end (and not at the beginning).

Try:

Code: Select all

C:\>echo .LOG > "LogFile.log"
C:\>notepad LogFile.log
Write something, save and open again
(This is not relevant, but may be useful) :P

Re: End of text in asociated Notepad

Posted: Wed Mar 21, 2018 4:55 pm
by VB6_to_PBx
Marc56us wrote:There is a very old function in NotePad, it's ability to serve as a log or memo.

To do this, you must:
- Write .LOG on the first line (and nothing else) (yes dot log)
- Save the file with the extension .log

At each opening, the notepad add the date and time and positions the cursor at the end (and not at the beginning).

Try:

Code: Select all

C:\>echo .LOG > "LogFile.log"
C:\>notepad LogFile.log
Write something, save and open again
(This is not relevant, but may be useful) :P
thanks Marc56us , for this nice Trick ! 8)

Re: End of text in asociated Notepad

Posted: Wed Mar 21, 2018 6:04 pm
by Lubos
Marc56us wrote:There is a very old function in NotePad, it's ability to serve as a log or memo.............
That's a really nice trick. I will use it in my NotePad reminder. Thanks.