End of text in asociated Notepad

Just starting out? Need help? Post your questions and find answers here.
Lubos
Enthusiast
Enthusiast
Posts: 167
Joined: Tue Feb 03, 2004 12:32 am
Contact:

End of text in asociated Notepad

Post 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?
Windows 7 Professional / Service Pack 1 - 32bit, PureBasic 5.46 LTS (x86)
My mother tongue is Czech. I have a Czech version of Windows.
Who is not afraid of GOTO, the one need not afraid any things!
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: End of text in asociated Notepad

Post 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_().
Image
Image
Lubos
Enthusiast
Enthusiast
Posts: 167
Joined: Tue Feb 03, 2004 12:32 am
Contact:

Re: End of text in asociated Notepad

Post by Lubos »

RSBasic wrote:Do you mean like this?
I am impressed! So fast and so perfect answer. Thank you.
Windows 7 Professional / Service Pack 1 - 32bit, PureBasic 5.46 LTS (x86)
My mother tongue is Czech. I have a Czech version of Windows.
Who is not afraid of GOTO, the one need not afraid any things!
Marc56us
Addict
Addict
Posts: 1479
Joined: Sat Feb 08, 2014 3:26 pm

Re: End of text in asociated Notepad

Post 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
User avatar
VB6_to_PBx
Enthusiast
Enthusiast
Posts: 625
Joined: Mon May 09, 2011 9:36 am

Re: End of text in asociated Notepad

Post 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)
 
PureBasic .... making tiny electrons do what you want !

"With every mistake we must surely be learning" - George Harrison
Lubos
Enthusiast
Enthusiast
Posts: 167
Joined: Tue Feb 03, 2004 12:32 am
Contact:

Re: End of text in asociated Notepad

Post 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.
Windows 7 Professional / Service Pack 1 - 32bit, PureBasic 5.46 LTS (x86)
My mother tongue is Czech. I have a Czech version of Windows.
Who is not afraid of GOTO, the one need not afraid any things!
Post Reply