Sign in to follow this  
Followers 0
SlimShady

Notepad Next Generation

22 posts in this topic

#1 ·  Posted (edited)

I made a text editor with AutoIt3.

I called it Notepad NG because I couldn't think of a better name...

It has many features:

- Open file

- Save file

- Reload file

- Execute file

- Find

- Replace

- Go To Line

- Auto indent

- Bookmark lines

- Send tabs as spaces (you can configure how many spaces equal to 1 tab)

- Set font (Note: you can't change the color of the text box)

- Word Wrap

- line numbers on the left

- Remember search queries (is configurable)

- a status bar that shows you info: current line, total lines, selected chars, filename

These features are coming:

- recent files

Post any problems, suggestions you have.

You need the latest beta version of AutoIt to use it.

See here

Else you can use the executable I added to the zip.

Download the script below:

http://www.autoitscript.com/fileman/users/public/SlimShady/NotepadNG.zip

History:

v1.0

- Initial release

v1.01

- fixed: caret jumping to the beginning of the line

- added: command line support

you can run NotepadNG with a text file or drop a text file on the executable

- added: forgot to update the menu items with shortcut keys (Find, Replace, Word Wrap)

- added: Run file you can execute the file you're editing

v1.1

- changed: all send functions are replaced with GUISendMsg

- changed: the way "Go To Line" works

- added: when you scroll, the line bar updates itself

- added: error message when user enters an invalid line number (Go To Line)

- minor things

v1.2

- changed: how "Replace once" works, it uses GUISendMsg now

- changed: "Find" and "Replace" function; You can now search using new-line chars!

- fixed: reloading when there's no file open showed -1

- fixed: "enter" not working on message boxes and dialogs

- added: tabs as spaces; when you press TAB, spaces are sent (as many as you want, default 3).

- added: auto indent

- added: select all using shortcut key Ctrl+A

- added: unindent using Shift+TAB

- added: save search queries

- added: line bookmarks (needs testing)

Edited by SlimShady

Share this post


Link to post
Share on other sites



Nice. I like the Font Dialog. :)

Remarks:

When you update the 'linebar' in a CR, this go to first line.(normally it's the next or current line)

I think you forgot include the file: @ScriptDir & '\images\PickColor.bmp'

Good Luck! :)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

@Slim, why don't you use the new oneventmode? Also, could the line numbers on the word wrap reflect the lines in the file, and not the visible lines? Perhaps you could split the edit's output with @CRLF and parse line #'s by that.

Edited by this-is-me

Who else would I be?

Share this post


Link to post
Share on other sites

Allright, feedback...

@josbe:

1. Thank you.

2. I don't understand the 1st sentence very much. You shouldn't update the line bar manually.

3. You don't need the PickColor.bmp because you can't change the text color of an edit box anyways.

@this-is-me:

I was thinking about that, but after I created the 2nd and 3rd dialog, I was wondering: "Does the OnEvent option/mode work only for 1 dialog or all of them?"

And I don't want to use OnEvent option/mode for all the dialogs.

@CyberSlug:

To match the line bar with the lines of the edit box, I can only update by sending the "up arrow" and "down arrow" keys.

And that can cause unexpected behaviour.

The "Go To Line" function is made 50% using Windows API messages and the other half by sending arrow keys.

For Word Wrap I couldn't find a Windows control message that I could send.

I think I can use DllCall for that, but I need time to understand that function.

If you're interested, I found some information that may be useful:

http://msdn.microsoft.com/library/default....rdbreakproc.asp

As you did with your AutoPad, I made 2 edit boxes and that works well (here at least)

Meanwhile I fixed your problem and added some things.

See first post.

Share this post


Link to post
Share on other sites

@SlimShady

I think many of us would love to have a better Notepad functions compare to

MS Notepad.

Do you mind to have screenshot of your program ? :)

That would be easier for other to take a look of the preview before download.

Thanks.... Keep the good work up ! :)

Share this post


Link to post
Share on other sites

OK... Just downloaded and tested a while.... I'm not sure if this is a bug or what.

The current line is "1", and I test for the "Go To Line" feature.

Right now, I enter LINE "3". Nothing happens as LINE 3 yet does not exist.

After I did this, the program goes wrong, where I'm unable to close the

program or do anything else....

When I click back on Internet Explorer (I'm browsing while testing your program),

the IE automatically scroll down to Page 3 where this was from NotepadNG.

Please check it out....

Side Note : Why not name it "Intelli NotePad".... just a suggestion :)

Share this post


Link to post
Share on other sites

The problem you had with "Go To Line" happens because I used Send() functions.

In the latest version I replaced them all with GUISendMsg().

Share this post


Link to post
Share on other sites

Updated. See first post.

Share this post


Link to post
Share on other sites

Simple and functional.

Starting to look alittle like notepad2. :)

Possible bug?

The reload function, restarts with a -1 in line 1 ?

Share this post


Link to post
Share on other sites

I don't have that problem.

Can you tell me what you did so I can reproduce the problem? Thanks.

Share this post


Link to post
Share on other sites

And I don't want to use OnEvent option/mode for all the dialogs

Not sure what you mean by this, but the oneventmode lets you bind a function to a button or control, no matter whether it is in one gui or another.


Who else would I be?

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

As you said in the other topic:

You can't have AutoItSetOption("GUIOnEventMode", 1) and a GuiGetMsg loop, I don't think. I believe it is one or the other.

<{POST_SNAPBACK}>

And Jon confirmed.

That means if you have multiple GUIs in one script and you enable GUIOnEventMode, you can't use GUIGetMsg in any of the other GUIs.

At least that's my theory. And I don't feel like making a function of every action.

Edited by SlimShady

Share this post


Link to post
Share on other sites

Nice one SlimShady .

Share this post


Link to post
Share on other sites

I don't have that problem.

Can you tell me what you did so I can reproduce the problem? Thanks.

<{POST_SNAPBACK}>

All I do is start your program. Press F5 and I get -1 in line 1. Same if I use menu to Reload.

Share this post


Link to post
Share on other sites

2. I don't understand the 1st sentence very much. You shouldn't update the line bar manually.

The same thing like CyberSlug said... :)

3. You don't need the PickColor.bmp because you can't change the text color of an edit box anyways.

You're right. :)

Share this post


Link to post
Share on other sites

I changed and added many things.

Can someone please test all the features?

Share this post


Link to post
Share on other sites

I haven't tested NNG so much, but it looks pretty good !

Nice work, SlimShady !

Share this post


Link to post
Share on other sites

Thank you.

I'm proud of it myself :)

I'm currently trying to make a nice "Recent Files" dialog.

With icons if I'm lucky.

Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

I failed to create a Recent files dialog with icons.

So I created one like Notepad2 has, without icons.

Here's my latest to do list:

To do list:

- about dialog

- Always On Top: Alt+T

- settings dialog

   * Remember windows size and position on exit

- Tabs so you can edit multiple files

- Tools menu which you can configure, so you can run Tidy instantly or compile the current file

Do you have ideas or suggestions? Please post them. Edited by SlimShady

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0