Jump to content
Sign in to follow this  
layer

simplist text editor

Recommended Posts

layer

i made a text editor, very very plain, i will add more soon though, i just wanted to let you all know im still alive :idiot:

EDIT: please check below for source!!

Edited by layer

FootbaG

Share this post


Link to post
Share on other sites
sykes

Maybe you could add an "Exit" to the File Menu? Other than that it looks good. Nice work layer :idiot:


We have enough youth. How about a fountain of SMART?

Share this post


Link to post
Share on other sites
MHz

A Very simple and cool editor, Layer.

Good effort. :idiot:

Share this post


Link to post
Share on other sites
layer

thanks for the support guys! :idiot: i added the "Exit" option! the code is updated


FootbaG

Share this post


Link to post
Share on other sites
Nova

I get an error when I run it

Line 13:

$readedit= GUICtrlRead ($edit)

Think it should be

$readedit= GUIRead ($edit)

Other than that, good effort, im sure it will evolve into a great txt editor.

Edited by Nova

Share this post


Link to post
Share on other sites
layer

you have to get the LATEST unstable version of autoit... they updated the syntax... some of it like this: GUIRead () is now GUICtrlRead ()

:D

EDIT: also, when you update autoit, update scite too! :idiot:

Edited by layer

FootbaG

Share this post


Link to post
Share on other sites
Nova

Cool I didnt know the santax had been changed already, my mistake,ill download the new version post haste.

Nova

Share this post


Link to post
Share on other sites
layer

hmmm, strange, i can't open any files with it anymore... let me fix that

EDIT: fixed :idiot:

Edited by layer

FootbaG

Share this post


Link to post
Share on other sites
DirtyBanditos

hmmm, strange, i can't open any files with it anymore... let me fix that

EDIT: fixed :idiot:

<{POST_SNAPBACK}>

Hi layer i have this prob wis your Textiditor, i run your textiditor the i click to open then i click cancel then i can't open any files with it anymore!This is big problem on your code and my code on the ohter tread!Self Prob Gui Tread

Wat i make wrong to use this right=? :D

Edited by DirtyBanditos

Share this post


Link to post
Share on other sites
layer

well, i added a lot more but it is still really buggy so i have to fix all of it... ill give you the script if you want it... NOTE: SOME FUNCTIONS MAY NOT WORK PROPERLY DUE TO SOME BUGS.:

i will update it when i have a chance to take out the bugs... enjoy

EDIT: check below for code

Edited by layer

FootbaG

Share this post


Link to post
Share on other sites
DirtyBanditos

well, i added a lot more but it is still really buggy so i have to fix all of it... ill give you the script if you want it... NOTE: SOME FUNCTIONS MAY NOT WORK PROPERLY DUE TO SOME BUGS.:

#include <GUIConstants.au3>
GUICreate ("Ryan's Text Editor", 500, 400)
GUISetState ()
$menu_1= GUICtrlCreateMenu ("&File")
$menu_item1= GUICtrlCreateMenuItem ("Save", $menu_1)
$menu_item2= GUICtrlCreateMenuItem ("Open", $menu_1) 
$menu_item4= GUICtrlCreateMenuItem ("Exit", $menu_1)
$Menu= GUICtrlCreateMenu ("&Edit")
$menu_item= GUICtrlCreateMenuItem ("Copy & Ctrl+C", $Menu)
$menu_item3= GUICtrlCreateMenuItem ("Paste & Ctrl+P", $menu)
$menu2= GUICtrlCreateMenu ("&View")
$menu_item5= GUICtrlCreateMenuItem ("Word Wrap", $menu2)
$edit_styles= BitOR ($ES_WANTRETURN, $WS_VSCROLL, $ES_AUTOVSCROLL)
$edit= GUICtrlCreateEdit ("", -1, -1, 500, 400, $ES_WANTRETURN)
Func Save ()
$save= FileSaveDialog ("Save...", @DesktopDir, "Text (*.txt)")
$readedit= GUICtrlRead ($edit)
FileWrite ($save & ".txt", $readedit)
EndFunc

Func Open ()
$open= FileOpenDialog ("Open...", @DesktopDir, "Text (*.txt)")
$readfile= FileOpen ($open, 0)
While 1
  $line = FileReadLine($readfile)
  If @error = -1 Then ExitLoop
  GUICtrlSetData ($edit, $line, 1)
Wend
Return $readfile
FileClose($readfile)
EndFunc

Func WordWrapOn ()
   Local $edit_styles= BitOR ($ES_WANTRETURN, $WS_VSCROLL, $ES_AUTOVSCROLL)
$edit= GUICtrlCreateEdit ("", -1, -1, 300, 400, $edit_styles)
GUICtrlSetState ($menu_item5, $GUI_CHECKED)
EndFunc

Func WordWrapOff ()
ToggleWordWrap ()
EndFunc

Func ToggleWordWrap ()
   $read5= GUICtrlRead ($menu_item5)
   if $read5= $GUI_CHECKED Then
      WordWrapOn ()
      EndIf
   If $read5= $GUI_UNCHECKED Then
      WordWrapOff ()
      EndIf
EndFunc
   
HotKeySet ("{TAB}", "Tab")
  Func Tab ()
  GUICtrlSetData  ($edit,"           ",1)                                                                                              
EndFunc
While 1
$get=GUIGetMsg ()
Select
Case $get= -3
$saveor= MsgBox (3, "Save?", "Save unfinished work?")
If $saveor= 6 then
 Save ()
EndIf
If $saveor= 2 then

EndIf
If $saveor= 7 Then
exit
EndIf
Case $get= $menu_item4
 Exit
Case $get= $menu_item1
Save ()
Exit
Case $get= $menu_item
Send ("^c")
Case $get= $menu_item3
Send ("^p")
Case $get= $menu_item2
Open ()
    Case $get = $menu_item5
        If BitAnd(GUICtrlRead($menu_item5),$GUI_CHECKED) = $GUI_CHECKED then
            GUICtrlSetState($menu_item5, $GUI_UNCHECKED)
            WordWrapOff ()
        Else
            GUICtrlSetState($menu_item5, $GUI_CHECKED)
            WordWrapOn ()
        EndIf
Endselect
wend

i will update it when i have a chance to take out the bugs... enjoy

<{POST_SNAPBACK}>

;) Ok Layer i Check the New version !Good look for Updating your Tool :D

I have testet look great but self bug ( :lol: I hope you fix it :idiot:

Edited by DirtyBanditos

Share this post


Link to post
Share on other sites
layer

Omg, I'm gonna update this... I was looking back on my old scripts and found this. I think I can add a bit more now... I'm at my cousins now, so I'll wait till' I get home too... I've been really busy wtih my first year of highschool too so I don't have much time for computer ;) And I'll fix the indentation for the script MHz... :P


FootbaG

Share this post


Link to post
Share on other sites
ioliver

Great job with this Layer!

Ian


"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Share this post


Link to post
Share on other sites
Insolence

Tidy this beast!

EDIT: Good job ;)

Edited by Insolence

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.

Share this post


Link to post
Share on other sites
layer
EDIT: Check my post on the next page for code... ;) Edited by layer

FootbaG

Share this post


Link to post
Share on other sites
Insolence

Strange, it didn't retain any formatting you had on it.

I'm hitting the sack right now, so I'll keep it short: good work.


"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.

Share this post


Link to post
Share on other sites
layer

open trough commandline.

Nevermind, here it is... It should work... More feedback people!! ;)

#include <GUIConstants.au3>
#include <GUIEdit.au3>
#include <Misc.au3>
#include <File.au3>

GUICreate("Ryan's Text Editor", 600, 417)
$menu_1 = GUICtrlCreateMenu("&File")
$menu_item1 = GUICtrlCreateMenuItem("Save", $menu_1)
$menu_item2 = GUICtrlCreateMenuItem("Open", $menu_1)
GUICtrlCreateMenuItem("", $menu_1)
$menu_item9 = GUICtrlCreateMenuItem("Print", $menu_1)
GUICtrlCreateMenuItem("", $menu_1)
$menu_item4 = GUICtrlCreateMenuItem("Exit", $menu_1)
$Menu = GUICtrlCreateMenu("&Edit")
$menu_item = GUICtrlCreateMenuItem("Copy & Ctrl+C", $Menu)
$menu_item3 = GUICtrlCreateMenuItem("Paste & Ctrl+P", $Menu)
GUICtrlCreateMenuItem("", $Menu)
$menu_item8 = GUICtrlCreateMenuItem("Undo", $Menu)
$menu2 = GUICtrlCreateMenu("&View")
$menu_item5 = GUICtrlCreateMenuItem("Word Wrap", $menu2)
GUICtrlCreateMenuItem("", $menu2)
$menu_item6 = GUICtrlCreateMenuItem("Font...", $menu2)
$menu_item7 = GUICtrlCreateMenuItem("Font color...", $menu2)
$edit_styles = BitOR($ES_WANTRETURN, $ES_MULTILINE, $WS_TABSTOP, $WS_VSCROLL, $ES_AUTOVSCROLL)
$edit = GUICtrlCreateEdit("", -1, -1, 600, 400)

If $CMDLine[0] = 0 Then
;;
ElseIf $CMDLine[0] = 1 Then
 $readfile = FileOpen($CMDLine[1], 0)
 While 1
  $line = FileReadLine($readfile)
  If @error = -1 Then ExitLoop
  GUICtrlSetData($edit, $line, 1)
 WEnd
 FileClose($readfile)
Else
;;
EndIf

$wrap = 0

GUISetState()

Func _Save()
$save = FileSaveDialog("Save...", @DesktopDir, "Text (*.txt)")
$readedit = GUICtrlRead($edit)
FileWrite($save & ".txt", $readedit)
EndFunc;==>_Save

Func _Open()
$open = FileOpenDialog("Open...", @DesktopDir, "Text (*.txt)")
$readfile = FileOpen($open, 0)
While 1
$line = FileReadLine($readfile)
If @error = -1 Then ExitLoop
GUICtrlSetData($edit, $line, 1)
WEnd
Return $readfile
FileClose($readfile)
EndFunc;==>_Open

Func _WordWrapOn()
Local $edit_styles = BitOR($ES_WANTRETURN, $WS_VSCROLL, $ES_MULTILINE, $WS_TABSTOP)
Local $data = GUICtrlRead($edit)
GUICtrlDelete($edit)
$edit = GUICtrlCreateEdit("", -1, -1, 600, 400, $edit_styles)
GUICtrlSetData($edit, $data, 1)
GUICtrlSetState($menu_item5, $GUI_CHECKED)
EndFunc;==>_WordWrapOn

Func _WordWrapOff()
Local $data = GUICtrlRead($edit)
GUICtrlDelete($edit)
$edit = GUICtrlCreateEdit("", -1, -1, 600, 400, $GUI_SS_DEFAULT_EDIT)
GUICtrlSetData($edit, $data, 1)
GUICtrlSetState($menu_item5, $GUI_UNCHECKED)
EndFunc;==>_WordWrapOff

HotKeySet("{TAB}", "_Tab")

Func _Tab()
GUICtrlSetData($edit, @TAB, 1)
EndFunc;==>_Tab

While 1
$get = GUIGetMsg()
Select
Case $get = -3
If GUICtrlRead($edit) = "" Then Exit
$saveor = MsgBox(3, "Ryan's Text Editor", "Save unfinished work?")
If $saveor = 6 Then
_Save()
EndIf
If $saveor = 2 Then
ContinueLoop
EndIf
If $saveor = 7 Then
Exit
EndIf
Case $get = $menu_item4
Exit
Case $get = $menu_item1
_Save()
Exit
Case $get = $menu_item
Send("^c")
Case $get = $menu_item3
GUICtrlSetData($edit, ClipGet(), 1)
Case $get = $menu_item2
_Open()
Case $get = $menu_item5
If $wrap = 1 Then
GUICtrlSetState($menu_item5, $GUI_UNCHECKED)
$wrap = 0
_WordWrapOff()
ElseIf $wrap = 0 Then
GUICtrlSetState($menu_item5, $GUI_CHECKED)
$wrap = 1
_WordWrapOn()
EndIf
Case $get = $menu_item6
$font = _ChooseFont ()
If @error Then ContinueLoop
GUICtrlSetFont($edit, $font[3], $font[4], $font[1], $font[2])
GUICtrlSetColor($edit, $font[7])
Case $get = $menu_item7
$color = _ChooseColor ()
If @error Then ContinueLoop
GUICtrlSetColor($edit, $color)
Case $get = $menu_item8
_GUICtrlEditUndo ($edit)
Case $get = $menu_item9
$file = FileOpenDialog("Ryan's Text Editor... Choose file to print", @DesktopDir, "Text (*.txt)")
_FilePrint ($file, @SW_SHOW)
Case Else
ContinueLoop
EndSelect
WEnd
Edited by layer

FootbaG

Share this post


Link to post
Share on other sites
this-is-me

Nice to meet you Ryan Layer. ;)


Who else would I be?

Share this post


Link to post
Share on other sites
layer

My last name isn't Layer ;) lol. But my first name yes, is Ryan :P

Nice yo meet you too me. :mad2:


FootbaG

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  

×