Jump to content

TypePad + Addons


ashley
 Share

Recommended Posts

*Updated* *V.2.2.0* *08/06/06*

What's supported at this moment is :

1) Quick close button (ESC)

2) Save hotkey (^S) now in menu

3) open hotkey (^O) now in menu

4) print hotkey (^P)

5) linecount hotkey(broken) (^L)

6) lock and unlock - stop people form seeing what your typing... when your away for your pc (lock F9, unlock F10) (broken... don't svae whats been typed)

Here is script V.1.0.0

;~# includes
#include <GUIConstants.au3>
#include <file.au3>
;~# includes end


;~# hotkeys
HotKeySet("{esc}", "close")
HotKeySet("^s", "save")
HotKeySet("^o", "open")
HotKeySet("^p", "print")
HotKeySet("^l", "linecount")
;~# hotkeys end





#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("TypePad-  By Ashley", 633, 447, 206, 117)
WinSetOnTop("TypePad-  By Ashley", "", 1)
GUISetCursor(0)
GUISetFont(8, 400, 0, "Arial Black")
GUISetBkColor(0x0000FF)
$edit = GUICtrlCreateEdit("", 8, 8, 617, 409)
GUICtrlSetColor(-1, 0xFF0000)
$Label2 = GUICtrlCreateLabel("To open a file press Ctrl + O", 152, 424, 181, 19, BitOR($SS_CENTER, $WS_BORDER), $WS_EX_STATICEDGE)
GUICtrlSetColor(-1, 0xFF0000)
$Label3 = GUICtrlCreateLabel("To print a file press Crtl + P", 336, 424, 172, 19, $WS_BORDER, $WS_EX_STATICEDGE)
GUICtrlSetColor(-1, 0xFF0000)
$Label1 = GUICtrlCreateLabel("To save press Ctrl + S", 3, 425, 146, 19, BitOR($SS_CENTER, $WS_BORDER), $WS_EX_STATICEDGE)
GUICtrlSetColor(-1, 0xFF0000)
$Label4 = GUICtrlCreateLabel("Typepad By Ashley", 512, 424, 119, 19, BitOR($SS_SUNKEN, $WS_BORDER))
GUICtrlSetColor(-1, 0xFF0000)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd



Func Save()
    

    FileSaveDialog("Save", "", "TypePad- files  (*.TYP)", 1)

    
EndFunc   ;==>Save


Func Open()
    
    FileOpenDialog("Open", "", "TypePad- files  (*.TYP)", 1)

EndFunc   ;==>Open

Func print()
    $file = FileOpenDialog("Print File", "", "TypePad- files (*.TYP)", 1)
    If @error Then Exit

    $print = _FilePrint($file)
    If $print Then
        MsgBox(0, "Print", "The file was sent to the printer.")
    Else
        MsgBox(0, "Print", "Error: " & @error & @CRLF & "The file was not sent to printer.")
    EndIf
EndFunc   ;==>print


Func linecount()
    $CountLines = _FileCountLines("TypePad.au3")
    MsgBox(64, "Lines in file", "There are " & $CountLines & " in this file")
EndFunc   ;==>linecount

Func close()
    Exit
EndFunc   ;==>closeƒoÝŠ÷ ÙÊ%¢º4ÓM4ÒÊZžËr•ƒoÝŠ÷ ÙÊ%¢º4ÓM4ÒÊZžËr•oÝ÷ ÙÊ%¢º4ÓM4ÒÊZËroÝ÷ ÙÊ%¢º4ÓM4ÒÊZËroÝ÷ ÙÊ%¢º4ÓM4ÒÊZËroÝ÷ ÙÊ%¢º4ÓM4ÒÊZËroÝ÷ Úȳz¬¥©ì·)^oÝ÷ ÙÊ%¢ºM4ÒÊZËr

If you find any errors please report them to me... (if you can fix them please do and post the edited bit back)

ToDo list

1) Make .TXT converter 100%

2) Make Rich text format (.RTF) Converter 100%

3) Make Word Document Converter 100%

Edited by ashley
Link to comment
Share on other sites

  • Developers

True, but you could consider just posting the latest version and removing the rest to avoid confusion .....

And we live in 2007 not 2006 ...

:whistle:

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Well, I was playin around with it and the Insert Date and Time didn't work for me. I changed it to:

Case $InsDT   
$Time = Send(@HOUR & ":" & @MIN & " " & @MDAY & "/" & @MON & "/" & @YEAR & " ")

and it worked fine. Not sure if its just me though?

Also, this is just me but I like to have Print, Open, etc under the File menu so I put it under there. Also, when you go to print it exits if you don't select a file, I added a MsgBox instead of exiting. you don't need to have it like that, but I just find that more useful instead of it exiting without warning on me. I also change the image directory from the full name to just @DesktopDir & "Typepad\bartop.bmp" as it automatically gets the users desktop location. Easier and tidier!

The only way I could think of the Line Count to work is to make is so when you use the Hotkey it presents an FileOpenDialog where you select the *.TYP file to count and then it counts it. It works, but they have to save the file first :S

;~# includes
#include <GUIConstants.au3>
#include <file.au3>
#NoTrayIcon
;~# includes-end

$Version = "Version 2.1.0"

;~# hotkeys
HotKeySet("{esc}", "close")
HotKeySet("^p", "print")
Hotkeyset("^l", "linecount")
HotKeySet("{F9}", "lock" )
HotKeySet("{F10}", "UnLock")
;~# hotkeys-end

;at start

;at start-end

#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Windows\Desktop\koda\Forms\typepad v.2.2.0.kxf
$Main = GUICreate("TypePad - By Ashley", 650, 498)
GUISetCursor (0)
GUISetFont(8, 400, 0, "Arial Black")
GUISetBkColor(0xFFFFFF)
$Edit = GUICtrlCreateEdit("", 16, 48, 617, 401)
$Label4 = GUICtrlCreateLabel("Typepad By Ashley", 496, 456, 127, 19, BitOR($SS_SUNKEN,$WS_BORDER))
$Funcbar = GUICtrlCreateProgress(296, 456, 198, 17, BitOR($PBS_SMOOTH,$WS_BORDER))
GUICtrlSetColor(-1, 0xFF0000)
$Quicklist = GUICtrlCreateCombo("QUICKLIST", 16, 448, 273, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL,$CBS_SORT,$CBS_UPPERCASE))
GUICtrlSetData(-1, "TO COUNT LINE IN A FILE PRSS CRTL + L|TO OPEN A FILE PRESS CTRL + O|TO PRINT A FILE PRESS CTRL + P|TO QUIT PRESS ESC|TO SAVE PRESS CTRL + S")
GUICtrlSetTip(-1, "All the Quick keys are listed here")
$topbar = GUICtrlCreatePic(@DesktopDir & "\Typepad\bartop.bmp", 16, 24, 617, 20, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$File = GUICtrlCreateMenu("File")
$Open = GUICtrlCreateMenuItem("Open...", $File)
$Save = GUICtrlCreateMenuItem("Save as...", $File)
$PrintFile = GUICtrlCreateMenuItem("Print...", $File)
$Exit = GUICtrlCreateMenuItem("Exit", $File)
$Addins = GUICtrlCreateMenu("Addins")
$InsDT  = GUICtrlCreateMenuItem("&Insert Date + Time", $Addins)
$Developer = GUICtrlCreateMenu("&Developer")
$FileSize  = GUICtrlCreateMenuItem("File Size", $Developer)
GUICtrlSetState(-1, $GUI_DISABLE)
$Help   = GUICtrlCreateMenu("&Help")
$About  =  GUICtrlCreateMenuItem ("&About", $Help)
GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Open
            $open_dialog = FileOpenDialog("Open...", "", "TypePad-files  (*.TYP)")
            GUICtrlSetData($Edit, FileRead($open_dialog))
        Case $Save
            $save_dialog = FileSaveDialog("Save as...", "", "TypePad-files  (*.TYP)")
            FileWrite($save_dialog & ".typ", GUICtrlRead($Edit))
        Case $PrintFile
            print()
        Case $Exit
            Exit
        Case $InsDT   
            $Time = Send(@HOUR & ":" & @MIN & " " & @MDAY & "/" & @MON & "/" & @YEAR & " ") ; Sends the current Date and Time to the Editbox        
        Case $About
            MsgBox(0, "About", "TypePad " & $Version & " Created by: Ashley." & @CRLF &  "Thanks to everybody that helped" & @CRLF & "An easy to use text editor" & @CRLF & "Email us at ashww@aol.com")
    EndSwitch
WEnd

;gui-end


; Func list

Func print()
    $file = FileOpenDialog("Print File", "", "TypePad- files (*.TYP)", 1)
If @error Then 
    MsgBox(48, "Print", "You did not select a file to print!")
EndIf

$print = _FilePrint($file)
If $print Then
    MsgBox(0, "Print", "The file was sent to the printer.")
Else
    MsgBox(0, "Print", "Error: " & @error & @CRLF & "The file was not sent to printer.")
EndIf   
EndFunc


Func linecount()
$CurrentFile = FileOpenDialog("Select a file to count", @DesktopDir, "Typepad Files (*.TYP)") ; Select the File you want to count the lines of
$CountLines = _FileCountLines($CurrentFile) ; Counts the lines of the chosen file
MsgBox(64, "Lines in file", "There are " & $CountLines & " in this file.") ; Outputs the result
EndFunc

Func close()
    Exit
EndFunc

Func UnLock ()
    MsgBox(262160, "Unlocked", " Unlocked... ")
    GUISetState($Main, @SW_ENABLE)
;~  GUISetState($Main, @SW_SHOW)
EndFunc

Func lock()
    MsgBox(262160, "Locked", " Locked... ")
    GUISetState($Main, @SW_DISABLE)
;~  GUISetState($Main, @SW_HIDE)
EndFunc
; Func list-end

Other than that pretty good job. Nice and small.

alien13

[Edit]: Just found out why none of the things were working you didn't have $Edit infront of:

GUICtrlCreateEdit("", 16, 48, 617, 401)

Oh well. My way works too :whistle:

Edited by alien13
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...