Jump to content
Sign in to follow this  
sandman

Ay-eye-Pad

AIPad  

29 members have voted

  1. 1. Tabs : Top or Bottom?

    • Keep them at the bottom!
      12
    • I like the conventional top style better.
      17
  2. 2. Do you think this should literally replace notepad (overwriting the file)?

    • Yes, just back up the original Notepad, of course.
      10
    • No, I'd rather have it as just an alternative.
      19
  3. 3. Sacrifice showing hotkeys in menus for icons?

    • Yes
      5
    • No
      4


Recommended Posts

sandman

I'm no longer editing this topic for every update. Check the SourceForge site for the latest news instead. (The original topic contents, from version 1.1.4, remain below.)

Introducing...... AIPad!!

This simple text editor is planned to soar over the default XP Notepad application through better flexibility and features. Currently it only supports tabbed writing, but many more features are planned to come! (Feel free to suggest a feature).

Screenshot:Posted Image

And... the source:

#include <File.au3>
#include <GUIConstants.au3>
#include <GUIEdit.au3>
#include <GUITab.au3>
#include <String.au3>

Global $tabs = 1
Global $curtab = 0
Global $tabsheet[1][4]
Global $opendg, $savedg, $file, $read, $msgbox

#region LoadSettings
Global $tabpos = INIRead("settings.ini", "Layout", "tabpos", "top")
#endregion LoadSettings

HotKeySet("^n", "New")          ; Control+N
HotKeySet("^o", "Open")         ; Control+O
HotKeySet("^s", "Save")         ; Control+S
HotKeySet("^+s", "SaveAs")      ; Control+Shift+S
HotKeySet("^+x", "Close")       ; Control+Shift+X
HotKeySet("^p", "Print")        ; Control+P
HotKeySet("^f", "Find")         ; Control+F
HotKeySet("^h", "FindReplace")  ; Control+H

Opt("TrayIconHide", 1)

If $cmdline[0] > 0 Then
    $file = $cmdline[1]
    If Not FileExists($file) Then
        MsgBox(0, "AIPad", "That file doesn't exist!")
    Else
        $win = GUICreate("AIPad", 500, 460, -1, -1, $WS_SIZEBOX, $WS_EX_ACCEPTFILES)
        If $tabpos = "top" Then
            $tab = GUICtrlCreateTab(0, 0, 500, 400)
        ElseIf $tabpos = "bottom" Then
            $tab = GUICtrlCreateTab(0, 0, 500, 400, $TCS_BOTTOM)
        EndIf
        $tabsheet[0][0] = GUICtrlCreateTabItem(StringTrimLeft($file, StringInStr($file, "\", 0, -1)))
        $tabsheet[0][1] = GUICtrlCreateLabel("", 10, 10, 480, 360)
        If $tabpos = "top" Then
            $tabsheet[0][2] = GUICtrlCreateEdit("", 10, 32, 480, 360)
        ElseIf $tabpos = "bottom" Then
            $tabsheet[0][2] = GUICtrlCreateEdit("", 10, 12, 480, 360)
        EndIf
        GUICtrlSetState($tabsheet[0][1], $GUI_DROPACCEPTED)
        $tabsheet[0][3] = $file
        GUICtrlCreateTabItem("")
        $menufile = GUICtrlCreateMenu("File")
        $menufilenew = GUICtrlCreateMenuItem("New", $menufile)
        $menufileopen = GUICtrlCreateMenuItem("Open", $menufile)
        $menufilesave = GUICtrlCreateMenuItem("Save", $menufile)
        $menufilesaveas = GUICtrlCreateMenuItem("Save As", $menufile)
        $menufileclose = GUICtrlCreateMenuItem("Close Tab", $menufile)
        $menufilesep = GUICtrlCreateMenuItem("", $menufile)
        $menufileprint = GUICtrlCreateMenuItem("Print", $menufile)
        $menufilesep1 = GUICtrlCreateMenuItem("", $menufile)
        $menufileexit = GUICtrlCreateMenuItem("Exit", $menufile)
        $menuedit = GUICtrlCreateMenu("Edit")
        $menueditundo = GUICtrlCreateMenuItem("Undo", $menuedit)
        $menueditredo = GUICtrlCreateMenuItem("Redo", $menuedit)
        $menueditsep = GUICtrlCreateMenuItem("", $menuedit)
        $menueditcut = GUICtrlCreateMenuItem("Cut", $menuedit)
        $menueditcopy = GUICtrlCreateMenuItem("Copy", $menuedit)
        $menueditpaste = GUICtrlCreateMenuItem("Paste", $menuedit)
        $menueditdelete = GUICtrlCreateMenuItem("Delete", $menuedit)
        $menueditsep1 = GUICtrlCreateMenuItem("", $menuedit)
        $menueditfind = GUICtrlCreateMenuItem("Find", $menuedit)
        $menueditreplace = GUICtrlCreateMenuItem("Find And Replace", $menuedit)
        $menueditsep2 = GUICtrlCreateMenuItem("", $menuedit)
        $menueditselall = GUICtrlCreateMenuItem("Select All", $menuedit)
        $menueditsep3 = GUICtrlCreateMenuItem("", $menuedit)
        $menueditpref = GUICtrlCreateMenuItem("Preferences", $menuedit)
        $menuformat = GUICtrlCreateMenu("Format")
        $menuformatfont = GUICtrlCreateMenuItem("Font", $menuformat)
        $menuhelp = GUICtrlCreateMenu("Help")
        $menuhelpabout = GUICtrlCreateMenuItem("About", $menuhelp)
        GUICtrlSetResizing($tab, $GUI_DOCKAUTO)
        For $i = 0 To $tabs - 1 Step 1
            GUICtrlSetResizing($tabsheet[$i][0], $GUI_DOCKAUTO)
            GUICtrlSetResizing($tabsheet[$i][1], $GUI_DOCKAUTO)
            GUICtrlSetResizing($tabsheet[$i][2], $GUI_DOCKAUTO)
        Next
        GUISetState(@SW_SHOW)
        While 1
            Global $curtab = _GUICtrlTabGetCurFocus($tab)
            $nMsg = GUIGetMsg()
            Switch $nMsg
                Case $GUI_EVENT_CLOSE
                    Exit
                Case $menufilenew
                    New()
                Case $menufileopen
                    Open()
                Case $menufilesave
                    Save()
                Case $menufilesaveas
                    SaveAs()
                Case $menufileclose
                    Close()
                Case $menufileprint
                    Print()
                Case $menufileexit
                    Exit
                Case $menueditundo
                    Send("^z")
                Case $menueditredo
                    Send("^y")
                Case $menueditcut
                    Send("^x")
                Case $menueditcopy
                    Send("^c")
                Case $menueditpaste
                    Send("^v")
                Case $menueditdelete
                    Send("{DELETE}")
                Case $menueditfind
                    Find()
                Case $menueditreplace
                    FindReplace()
                Case $menueditselall
                    _GUICtrlEditSetSel($tabsheet[$curtab][1], 0, -1)
                Case $menueditpref
                    Preferences()
                Case $menuformatfont
                    ; Not yet implemented.
                Case $menuhelpabout
                    MsgBox(0, "AIPad :: About", "Created by me.")
            EndSwitch
        WEnd
    EndIf
EndIf

$win = GUICreate("AIPad", 500, 460, -1, -1, $WS_SIZEBOX, $WS_EX_ACCEPTFILES)
GUISetIcon("AIPad.exe", 4)
If $tabpos = "top" Then
    $tab = GUICtrlCreateTab(0, 0, 500, 400)
ElseIf $tabpos = "bottom" Then
    $tab = GUICtrlCreateTab(0, 0, 500, 400, $TCS_BOTTOM)
EndIf
$tabsheet[0][0] = GUICtrlCreateTabItem("Untitled")
$tabsheet[0][1] = GUICtrlCreateLabel("", 10, 10, 480, 360)
GUICtrlSetState($tabsheet[0][1], $GUI_DISABLE + $GUI_DROPACCEPTED)
If $tabpos = "top" Then
    $tabsheet[0][2] = GUICtrlCreateEdit("", 10, 32, 480, 360)
ElseIf $tabpos = "bottom" Then
    $tabsheet[0][2] = GUICtrlCreateEdit("", 10, 12, 480, 360)
EndIf
$tabsheet[0][3] = "%TEMP%"
GUICtrlCreateTabItem("")
$menufile = GUICtrlCreateMenu("File")
$menufilenew = GUICtrlCreateMenuItem("New   Ctrl+N", $menufile)
$menufileopen = GUICtrlCreateMenuItem("Open Ctrl+O", $menufile)
$menufilesave = GUICtrlCreateMenuItem("Save Ctrl+S", $menufile)
$menufilesaveas = GUICtrlCreateMenuItem("Save As    Ctrl+Shift+S", $menufile)
$menufileclose = GUICtrlCreateMenuItem("Close Tab   Ctrl+Shift+X", $menufile)
$menufilesep = GUICtrlCreateMenuItem("", $menufile)
$menufileprint = GUICtrlCreateMenuItem("Print   Ctrl+P", $menufile)
$menufilesep1 = GUICtrlCreateMenuItem("", $menufile)
$menufileexit = GUICtrlCreateMenuItem("Exit", $menufile)
$menuedit = GUICtrlCreateMenu("Edit")
$menueditundo = GUICtrlCreateMenuItem("Undo Ctrl+U", $menuedit)
$menueditredo = GUICtrlCreateMenuItem("Redo Ctrl+Y", $menuedit)
$menueditsep = GUICtrlCreateMenuItem("", $menuedit)
$menueditcut = GUICtrlCreateMenuItem("Cut   Ctrl+X", $menuedit)
$menueditcopy = GUICtrlCreateMenuItem("Copy Ctrl+C", $menuedit)
$menueditpaste = GUICtrlCreateMenuItem("Paste   Ctrl+V", $menuedit)
$menueditdelete = GUICtrlCreateMenuItem("Delete Backspace", $menuedit)
$menueditsep1 = GUICtrlCreateMenuItem("", $menuedit)
$menueditfind = GUICtrlCreateMenuItem("Find Ctrl+F", $menuedit)
$menueditreplace = GUICtrlCreateMenuItem("Find And Replace  Ctrl+H", $menuedit)
$menueditsep2 = GUICtrlCreateMenuItem("", $menuedit)
$menueditselall = GUICtrlCreateMenuItem("Select All Ctrl+A", $menuedit)
$menueditsep3 = GUICtrlCreateMenuItem("", $menuedit)
$menueditpref = GUICtrlCreateMenuItem("Preferences", $menuedit)
$menuformat = GUICtrlCreateMenu("Format")
$menuformatfont = GUICtrlCreateMenuItem("Font   Ctrl+Shift+F", $menuformat)
$menuhelp = GUICtrlCreateMenu("Help")
$menuhelpabout = GUICtrlCreateMenuItem("About", $menuhelp)
GUISetState(@SW_SHOW, $win)
GUICtrlSetResizing($tab, $GUI_DOCKAUTO)
For $i = 0 To $tabs - 1 Step 1
    GUICtrlSetResizing($tabsheet[$i][0], $GUI_DOCKAUTO)
    GUICtrlSetResizing($tabsheet[$i][1], $GUI_DOCKAUTO)
    GUICtrlSetResizing($tabsheet[$i][2], $GUI_DOCKAUTO)
Next

While 1
    Global $curtab = _GUICtrlTabGetCurFocus($tab)
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_DROPPED
            Open(@GUI_DRAGFILE)
        Case $menufilenew
            New()
        Case $menufileopen
            Open()
        Case $menufilesave
            Save()
        Case $menufilesaveas
            SaveAs()
        Case $menufileclose
            Close()
        Case $menufileprint
            Print()
        Case $menufileexit
            Exit
        Case $menueditundo
            Send("^z")
        Case $menueditredo
            Send("^y")
        Case $menueditcut
            Send("^x")
        Case $menueditcopy
            Send("^c")
        Case $menueditpaste
            Send("^v")
        Case $menueditdelete
            Send("{DELETE}")
        Case $menueditfind
            Find()
        Case $menueditreplace
            FindReplace()
        Case $menueditselall
            _GUICtrlEditSetSel($tabsheet[$curtab][1], 0, -1)
        Case $menueditpref
            Preferences()
        Case $menuformatfont
            ; Not yet implemented.
        Case $menuhelpabout
            MsgBox(0, "AIPad :: About", "Created by me.")
    EndSwitch
WEnd

Func Empty(ByRef $vVar)
    $vVar = ""
EndFunc   ;==>Empty

Func New()
    If WinGetState("AIPad") = 15 Then
        $tabs += 1
        ReDim $tabsheet[$tabs][4]
        $tabsheet[$tabs - 1][0] = GUICtrlCreateTabItem("Untitled")
        $tabsheet[$tabs - 1][1] = GUICtrlCreateLabel("", 10, 10, 480, 360)
        GUICtrlSetState($tabsheet[$tabs - 1][1], $GUI_DISABLE + $GUI_DROPACCEPTED)
        If $tabpos = "top" Then
            $tabsheet[$tabs - 1][2] = GUICtrlCreateEdit("", 10, 32, 480, 360)
        ElseIf $tabpos = "bottom" Then
            $tabsheet[$tabs - 1][2] = GUICtrlCreateEdit("", 10, 12, 480, 360)
        EndIf
        $tabsheet[$tabs - 1][3] = "%TEMP%"
        GUICtrlSetResizing($tabsheet[$tabs - 1][1], $GUI_DOCKAUTO)
        GUICtrlSetResizing($tabsheet[$tabs - 1][2], $GUI_DOCKAUTO)
    EndIf
EndFunc   ;==>New

Func Open($sFile = "")
    If WinGetState("AIPad") = 15 Then
        If $sFile = "" Then
            Empty($file)
            Empty($read)
            Empty($opendg)
            $opendg = FileOpenDialog("AIPad :: Open File", @MyDocumentsDir, "Text files (*.txt)|All files (*.*)", 1)
            $read = FileRead($opendg)
            $tabs += 1
            ReDim $tabsheet[$tabs][4]
            $tabsheet[$tabs - 1][0] = GUICtrlCreateTabItem(StringTrimLeft($opendg, StringInStr($opendg, "\", 0, -1)))
            $tabsheet[$tabs - 1][1] = GUICtrlCreateLabel("", 10, 10, 480, 360)
            GUICtrlSetState($tabsheet[$tabs - 1][1], $GUI_DISABLE + $GUI_DROPACCEPTED)
            If $tabpos = "top" Then
                $tabsheet[$tabs - 1][2] = GUICtrlCreateEdit($read, 10, 32, 480, 360)
            ElseIf $tabpos = "bottom" Then
                $tabsheet[$tabs - 1][2] = GUICtrlCreateEdit($read, 10, 12, 480, 360)
            EndIf
            $tabsheet[$tabs - 1][3] = $opendg
            GUICtrlSetResizing($tabsheet[$tabs - 1][1], $GUI_DOCKAUTO)
            GUICtrlSetResizing($tabsheet[$tabs - 1][2], $GUI_DOCKAUTO)
        ElseIf $sFile <> "" Then
            Empty($read)
            $read = FileRead($sFile)
            $tabs += 1
            ReDim $tabsheet[$tabs][4]
            $tabsheet[$tabs - 1][0] = GUICtrlCreateTabItem(StringTrimLeft($sFile, StringInStr($sFile, "\", 0, -1)))
            $tabsheet[$tabs - 1][1] = GUICtrlCreateLabel("", 10, 10, 480, 360)
            GUICtrlSetState($tabsheet[$tabs - 1][1], $GUI_DISABLE + $GUI_DROPACCEPTED)
            If $tabpos = "top" Then
                $tabsheet[$tabs - 1][2] = GUICtrlCreateEdit($read, 10, 32, 480, 360)
            ElseIf $tabpos = "bottom" Then
                $tabsheet[$tabs - 1][2] = GUICtrlCreateEdit($read, 10, 12, 480, 360)
            EndIf
            $tabsheet[$tabs - 1][3] = StringTrimLeft($sFile, StringInStr($sFile, "\", 0, -1))
            GUICtrlSetResizing($tabsheet[$tabs - 1][1], $GUI_DOCKAUTO)
            GUICtrlSetResizing($tabsheet[$tabs - 1][2], $GUI_DOCKAUTO)
        EndIf
    EndIf
EndFunc   ;==>Open

Func Save()
    If WinGetState("AIPad") = 15 Then
        Empty($savedg)
        Switch $tabsheet[$curtab][2]
            Case "%TEMP%"
                $savedg = FileSaveDialog("AIPad :: Save File", @MyDocumentsDir, "Text files (*.txt)|All files (*.*)", 16)
                $read = GUICtrlRead($tabsheet[$curtab][2])
                $open = FileOpen($savedg, 2)
                FileWrite($open, $read)
                FileClose($open)
                GUICtrlSetData($tabsheet[$curtab][0], StringTrimLeft($savedg, StringInStr($savedg, "\", 0, -1)))
            Case Else
                $read = GUICtrlRead($tabsheet[$curtab][1])
                $open = FileOpen($tabsheet[$curtab][3], 2)
                FileWrite($open, $read)
                FileClose($open)
        EndSwitch
    EndIf
EndFunc   ;==>Save

Func SaveAs()
    If WinGetState("AIPad") = 15 Then
        Empty($savedg)
        $savedg = FileSaveDialog("AIPad :: Save File As", @MyDocumentsDir, "Text files (*.txt)|All files (*.*)", 16)
        $read = GUICtrlRead($tabsheet[$curtab][2])
        $open = FileOpen($savedg, 2)
        FileWrite($open, $read)
        FileClose($open)
        GUICtrlSetData($tabsheet[$curtab][0], StringTrimLeft($savedg, StringInStr($savedg, "\", 0, -1)))
        $tabsheet[$curtab][3] = $savedg
    EndIf
EndFunc   ;==>SaveAs

Func Close()
    If WinGetState("AIPad") = 15 Then
        $read = GUICtrlRead($tabsheet[$curtab][2])
        $read2 = FileRead($tabsheet[$curtab][3])
        If $read <> $read2 Then
            $msgbox = MsgBox(4, "AIPad", "You have unsaved changes to this file. Would you like to save them before closing the file?")
            If $msgbox = 6 Then
                Save()
            EndIf
        EndIf
        GUICtrlDelete($tabsheet[$curtab][1])
        GUICtrlDelete($tabsheet[$curtab][2])
        $tabsheet[$curtab][3] = ""
        GUICtrlDelete($tabsheet[$curtab][0])
        $tabs -= 1
    EndIf
EndFunc   ;==>Close

Func Print()
    If WinGetState("AIPad") = 15 Then
        If $tabsheet[$curtab][3] = "%TEMP%" Then
            $read = GUICtrlRead($tabsheet[$curtab][2])
            $temp = _TempFile(@TempDir, "~", ".txt")
            FileWrite($temp, $read)
            _FilePrint($temp, @SW_HIDE)
            FileDelete($temp)
        Else
            $read = GUICtrlRead($tabsheet[$curtab][2])
            $read2 = FileRead($tabsheet[$curtab][3])
            If $read <> $read2 Then
                Empty($msgbox)
                $msgbox = MsgBox(4, "AIPad :: Confirm Overwrite", "You have unsaved changes to your text file. Are you sure you want AIPad to save the file?")
                If $msgbox = 6 Then
                    $open = FileOpen($tabsheet[$curtab][3], 2)
                    FileWrite($open, $read)
                    FileClose($open)
                    _FilePrint($tabsheet[$curtab][3], @SW_HIDE)
                    If @error Then MsgBox(0, "AIPad :: Print Error", "There was an error printing your file.")
                EndIf
            Else
                _FilePrint($tabsheet[$curtab][3], @SW_HIDE)
                If @error Then MsgBox(0, "AIPad :: Print Error", "There was an error printing your file.")
            EndIf
        EndIf
    EndIf
EndFunc   ;==>Print

Func Find()
    If WinGetState("AIPad") = 15 Then
        $winfind = GUICreate("AIPad :: Find", 372, 134, 248, 177, -1, $WS_EX_TOPMOST)
        $findlbl = GUICtrlCreateLabel("Search for:", 10, 10, 56, 17)
        $findinput = GUICtrlCreateInput("", 70, 10, 191, 21)
        $findfind = GUICtrlCreateButton("Find Next", 280, 10, 75, 25, 0)
        $finddirgroup = GUICtrlCreateGroup("Search Direction", 190, 50, 125, 65)
        $findttb = GUICtrlCreateRadio("Top-To-Bottom", 200, 70, 113, 17)
        GUICtrlSetState(-1, $GUI_CHECKED)
        $findbtt = GUICtrlCreateRadio("Bottom-To-Top", 200, 90, 113, 17)
        GUICtrlCreateGroup("", -99, -99, 1, 1)
        $findcase = GUICtrlCreateCheckbox("Case Sensitive", 30, 70, 97, 17)
        GUISetState(@SW_SHOW)
        Dim $pos = 0
        While 1
            $nnMsg = GUIGetMsg()
            Switch $nnMsg
                Case $GUI_EVENT_CLOSE
                    GUIDelete($winfind)
                    ExitLoop
                Case $findfind
                    If GUICtrlRead($findcase) = $GUI_CHECKED Then
                        $casesense = 1
                    ElseIf GUICtrlRead($findcase) = $GUI_UNCHECKED Then
                        $casesense = 0
                    EndIf
                    If GUICtrlRead($findttb) = $GUI_CHECKED Then
                        $direction = "ttb"
                    ElseIf GUICtrlRead($findttb) = $GUI_UNCHECKED Then
                        $direction = "btt"
                    EndIf
                    $key = GUICtrlRead($findinput)
                    GUISetState(@SW_RESTORE, $win)
                    Switch $direction
                        Case "ttb"
                            $pos += 1
                            $find = StringInStr(GUICtrlRead($tabsheet[$curtab][2]), $key, $casesense, $pos)
                            If $find <> 0 Then
                                _GUICtrlEditSetSel($tabsheet[$curtab][2], $find - 1, $find + StringLen($findinput))
                            ElseIf $find = 0 Then
                                MsgBox(0, "AIPad :: Find", "AIPad cannot find the string """ & $key & """ in the document.")
                            EndIf
                        Case "btt"
                            $pos -= 1
                            $find = StringInStr(GUICtrlRead($tabsheet[$curtab][2]), $key, $casesense, $pos)
                            If $find <> 0 Then
                                _GUICtrlEditSetSel($tabsheet[$curtab][2], $find - 1, $find + StringLen($findinput))
                            ElseIf $find = 0 Then
                                MsgBox(0, "AIPad :: Find", "AIPad cannot find the string """ & $key & """ in the document.")
                            EndIf
                    EndSwitch
            EndSwitch
        WEnd
    EndIf
EndFunc   ;==>Find

Func FindReplace()
    If WinGetState("AIPad") = 15 Then
        $winfindreplace = GUICreate("AIPad :: Find And Replace", 372, 167, 248, 177)
        $findlbl = GUICtrlCreateLabel("Search for:", 10, 10, 56, 17)
        $findinput = GUICtrlCreateInput("", 80, 10, 191, 21)
        $findfind = GUICtrlCreateButton("Replace Next", 280, 10, 75, 25, 0)
        $findreplaceall = GUICtrlCreateButton("Replace All", 280, 50, 75, 25, 0)
        $finddirgroup = GUICtrlCreateGroup("Search Direction", 190, 80, 125, 65)
        $findttb = GUICtrlCreateRadio("Top-To-Bottom", 200, 100, 113, 17)
        GUICtrlSetState(-1, $GUI_CHECKED)
        $findbtt = GUICtrlCreateRadio("Bottom-To-Top", 200, 120, 113, 17)
        GUICtrlCreateGroup("", -99, -99, 1, 1)
        $findcase = GUICtrlCreateCheckbox("Case Sensitive", 30, 100, 97, 17)
        $findreplace = GUICtrlCreateLabel("Replace with:", 10, 50, 69, 17)
        $findreplaceinput = GUICtrlCreateInput("", 80, 50, 191, 21)
        GUISetState(@SW_SHOW)
        Dim $pos = 0
        While 1
            $nMsg = GUIGetMsg()
            Switch $nMsg
                Case $GUI_EVENT_CLOSE
                    GUIDelete($winfindreplace)
                    ExitLoop
                Case $findfind
                    If GUICtrlRead($findcase) = $GUI_CHECKED Then
                        $casesense = 1
                    ElseIf GUICtrlRead($findcase) = $GUI_UNCHECKED Then
                        $casesense = 0
                    EndIf
                    If GUICtrlRead($findttb) = $GUI_CHECKED Then
                        Global $direction = "ttb"
                    ElseIf GUICtrlRead($findttb) = $GUI_UNCHECKED Then
                        Global $direction = "btt"
                    EndIf
                    $key = GUICtrlRead($findinput)
                    GUISetState(@SW_RESTORE, $win)
                    Switch $direction
                        Case "ttb"
                            $pos += 1
                            $find = StringInStr(GUICtrlRead($tabsheet[$curtab][2]), $key, $casesense, $pos)
                            If $find <> 0 Then
                                GUICtrlSetData($tabsheet[$curtab][2], StringReplace(GUICtrlRead($tabsheet[$curtab][2]), $key, GUICtrlRead($findreplaceinput), 1))
                            ElseIf $find = 0 Then
                                MsgBox(0, "AIPad :: Find", "AIPad cannot find the string """ & $key & """ in the document.")
                            EndIf
                        Case "btt"
                            $pos -= 1
                            $find = StringInStr(GUICtrlRead($tabsheet[$curtab][2]), $key, $casesense, $pos)
                            If $find <> 0 Then
                                GUICtrlSetData($tabsheet[$curtab][2], StringReplace(GUICtrlRead($tabsheet[$curtab][2]), $key, GUICtrlRead($findreplaceinput), 1))
                            ElseIf $find = 0 Then
                                MsgBox(0, "AIPad :: Find", "AIPad cannot find the string """ & $key & """ in the document.")
                            EndIf
                    EndSwitch
                Case $findreplaceall
                    $pos = 0
                    Dim $amt = 0
                    Switch $direction
                        Case "ttb"
                            Do
                                $pos += 1
                                $str = StringInStr(GUICtrlRead($tabsheet[$curtab][2]), $key, $casesense, $pos)
                                $amt += 1
                            Until $str = 0
                        Case "btt"
                            Do
                                $pos -= 1
                                $str = StringInStr(GUICtrlRead($tabsheet[$curtab][2]), $key, $casesense, $pos)
                                $amt += 1
                            Until $str = 0
                    EndSwitch
                    Dim $new
                    Local $replace = GUICtrlRead($findreplaceinput)
                    For $i = 1 To $amt Step 1
                        $new = StringReplace(GUICtrlRead($tabsheet[$curtab][2]), $key, $replace)
                    Next
                    GUICtrlSetData($tabsheet[$curtab][2], $new)
                    MsgBox(0, "AIPad :: Find And Replace", $amt & " cases of """ & $key & """ replaced with """ & $replace & """.")
            EndSwitch
        WEnd
    EndIf
EndFunc   ;==>FindReplace

Func Preferences()
    $winpref = GUICreate("AIPad :: Preferences", 316, 235, 331, 259)
    $winprefok = GUICtrlCreateButton("&OK", 225, 203, 75, 25, 0)
    Local $read = INIRead("settings.ini", "Layout", "tabpos", "top")
    $winpreftabbottom = GUICtrlCreateCheckbox("Show tabs at bottom of window", 10, 10, 177, 17)
    If $read = "bottom" Then
        GUICtrlSetState($winpreftabbottom, $GUI_CHECKED)
    ElseIf $read = "top" Then
        GUICtrlSetState($winpreftabbottom, $GUI_UNCHECKED)
    EndIf
    GUISetState(@SW_SHOW)
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            GUIDelete($winpref)
            ExitLoop
        Case $winprefok
            $rtabbottom = GUICtrlRead($winpreftabbottom)
            If $rtabbottom = $GUI_CHECKED Then
                INIWrite("settings.ini", "Layout", "tabpos", "bottom")
            ElseIf $rtabbottom = $GUI_UNCHECKED Then
                INIWrite("settings.ini", "Layout", "tabpos", "top")
            EndIf
            GUIDelete($winpref)
            ExitLoop
    EndSwitch
    WEnd
EndFunc
TODO (listed from highest to lowest priority):
  • Test print function 100%
  • Enable command line use 100%
  • Keyboard shortcuts 100%
  • Add "Close Tab" option 100%
  • Add file-dragging capability 100%
  • Add lots of preferences 5%
  • Create installer to replace NOTEPAD.EXE (backing the original up, of course)
  • Add "Edit with AIPad" to Explorer context menu
  • Create .aip file format
    • Implement font formatting
    • Optional encryption (Thanks Manadar / Antionio! :D )
  • General bugfixes
    • Cannot open Find dialog when Save As dialog is open.. and vice versa
    • Select All button doesn't work
    • When AIPad is sized differently than default, edits open with default size and do not dock to whole window
EditLog
  • Edit 1: A few bugfixes
  • Edit 2: Printing is a bit less obtrusive
  • Edit 3: Added command line ability (later to be used with Explorer context menu)
  • Edit 4: Complete rewrite. Almost everything converted to functions. Hotkeys added.
  • Edit 5: Added "Close Tab" to File menu. Shortcut is Control+Shift+X.
  • Edit 6: Even more bugfixes. It's a bit more flexible.
  • Edit 7: So many bugfixes, it's not even funny.
  • Edit 8: Begun preferences (choose tab position!) Prepped for drag-files feature
  • Edit 9: Bugfix (thanks JustinReno!) Try dragging a file into the control.
And... the download!

Current Release: 1.1.4

Posted Image AIPad.au3 (20.2K) Number of downloads: Posted Image

Posted Image AIPad.exe (535.6K) Number of downloads: Posted Image

View Entire AIPad Download Archive

Edited by sandman

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Share this post


Link to post
Share on other sites
Generator

Works great, i love the tab function :) . Just be aware there are some syntax error to fix, oh post the exe version as well.

Share this post


Link to post
Share on other sites
sandman

Works great, i love the tab function :) . Just be aware there are some syntax error to fix, oh post the exe version as well.

Thanks. I got the tab idea from working in Linux terminal... I thought, "Now why doesn't Notepad have tabs?"

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Share this post


Link to post
Share on other sites
gseller

I like it.. Very easy to use... Keep adding to it.. LOL Nery Nice!

Share this post


Link to post
Share on other sites
Draygoes

Great program!!!

One feature I think you should add is an optional word wrap.

Keep up the great work!!!


Spoiler

 

"If a vegetarian eats vegetables,What the heck does a humanitarian eat?"

"I hear voices in my head, but I ignore them and continue on killing."

"You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring."

An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist.

 

 

Share this post


Link to post
Share on other sites
sandman

Thanks everyone. I am now an expert on tabbed GUIs like this :)

Well, actually not, if I had events in each individual tab it would be a lot more complex.. you'd probably need a For loop inside the While loop.. sigh.

Maybe I'll find out how to add a little close button to each tab thingy at the bottom.

I've added two polls for features and changes.... I think the community's opinion is the best one!

Edited by sandman

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Share this post


Link to post
Share on other sites
Nahuel

I really like it! But yeah, there are a few things that in my opinion have to be fixed. Just details!

Oh, and I got this error trying to open a txt file.

Posted Image

Share this post


Link to post
Share on other sites
sandman

I really like it! But yeah, there are a few things that in my opinion have to be fixed. Just details!

Oh, and I got this error trying to open a txt file.

Posted Image

What version of AutoIt are you running? And is that Win2k or Win95?

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Share this post


Link to post
Share on other sites
Nahuel

Says here that I have Autoit 3.2.4.9 and I have Win98 :)

Share this post


Link to post
Share on other sites
sandman

Is anyone else getting this error? I'm not getting it.

BTW: 3.2.6.0 has been released, you might wanna grab that :)

But yeah, there are a few things that in my opinion have to be fixed. Just details!

Please tell me! I want to improve this in any way I can. Edited by sandman

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Share this post


Link to post
Share on other sites
JustinReno

I get it, I have the latest 3.2.6.0, Its because the Msgbox was formated wrong, too many commas and forgot & symbals

Share this post


Link to post
Share on other sites
sandman

I get it, I have the latest 3.2.6.0, Its because the Msgbox was formated wrong, too many commas and forgot & symbals

Sorry, but what did you mean there?? Please elaborate a bit.

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Share this post


Link to post
Share on other sites
JustinReno

Sorry :), I got the latest version of Autoit 3.2.6.0 and I still get the error. It says the message box has something wrong with it, too many commas and a couple & signs werent there..

CODE

E:\Autoit Scripts\test3.au3(483,110) : ERROR: syntax error

MsgBox(0, "AIPad :: Find And Replace", $amt & " cases of """ & $key """ replaced with """

The Messagebox should be replaced with this:

CODE

Msgbox(0, "AIPad :: Find And Replace """, ""&$amt&""" cases of """&$Key&""" replaced with """&$replace&""".")

But ther seems to be even more errors after that with the rest of the find and search but not with the message.

Share this post


Link to post
Share on other sites
sandman

Hmmm.. due to the pretty equalized positions in the polls, I'm probably just going to make the replacement an option too. (I've already made tab position an option, look it Edit>Preferences!)


[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Share this post


Link to post
Share on other sites
RazerM

Looks good. Could you add context menus on the tabs for closing etc

#386811


My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

Share this post


Link to post
Share on other sites
gseller

Oh Yeah!! I see you overcame the adding and removing tabs.. That is great work... I Like it!

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.