lavascript Posted February 28, 2012 Share Posted February 28, 2012 I started building my first GUI app, a little util that could convert text to UPPERCASE, lowercase, or Initial Caps. (Primarily the latter, since the first two are built into SciTE. It works fine and it does exactly what I needed, but my only input and output is copy/paste. So I added a File menu, with Open, Save, etc. As I was going through it, I realized that I was basically building Notepad. So I was thinking that building Notepad would be a really great introduction to AutoIt GUI tools, because it's simple, yet there are elements (menus, edit control, the window itself) that would be used in lots of other GUI situations. And you could customize it, add a Tools menu, and do any sort of text manipulations you wanted to code. I thought that surely someone had done this, but I couldn't find anything. So I guess my questions are: (a) Does this, or something similar, exist? and ( If not, does anyone think it's a good enough idea to do it? I thought about doing it myself, but I'm new to AutoIt, and I'm probably not using best practices all the time. Link to comment Share on other sites More sharing options...
Realm Posted February 28, 2012 Share Posted February 28, 2012 (edited) If you have a need for it, and the time to invest into writing it, then it is never a bad idea to do. However with the array of text editors available for free on the internet (ie. Notepad, Notepad++, and Scite just to name a few) there really isn't much need for more, unless I don't understand what it is that you need and those three don't offer. As for setting text to all Uppercase, or Lowercase, or even something to give proper punctuation to text files. I would simply create a script to read the text file into a variable, split the variable into an array to modify the characters, before concatenating the array into a string and saving it to the file. Just for example, and probably not the best example either: expandcollapse popup#include <Array.au3> $string = 'This is a Test String. This is only a test.' MsgBox( 0, 'String before set to all Uppercase', $string ) ;Perform all characters into uppercase $split_string = StringSplit( $string, '', 2 ) For $i = 0 To UBound($split_string) -1 $asc = Asc($split_string[$i]) If $asc >= 97 And $asc <= 122 Then $split_string[$i] = Chr($asc-32) Next $string = _ArrayToString( $split_string, '' ) MsgBox( 0, 'String after all letters set to Uppercase', $string ) ;Perform all characters into lowercase $split_string = StringSplit( $string, '', 2 ) For $i = 0 To UBound($split_string) -1 $asc = Asc($split_string[$i]) If $asc >= 65 And $asc <= 90 Then $split_string[$i] = Chr($asc+32) Next $string = _ArrayToString( $split_string, '' ) MsgBox( 0, 'String after all letters set to Lowercase', $string) ;Perform proper punctuation. $split_string = StringSplit( $string, '', 2 ) For $i = 0 To UBound($split_string) -1 $asc = Asc($split_string[$i]) If $i = 0 And $asc >= 97 And $asc <= 122 Then $split_string[$i] = Chr($asc-32) ElseIf $i > 2 And Punctuation(Asc($split_string[$i-2])) And Asc($split_string[$i-1]) = 32 Then $split_string[$i] = Chr($asc-32) Else If $asc >= 65 And $asc <= 90 Then $split_string[$i] = Chr($asc+32) EndIf Next $string = _ArrayToString( $split_string, '' ) MsgBox(0, 'String after proper Letter casment when proper punctuation is present.', $string) Func Punctuation($iAsc) If $iAsc = 33 Then Return 1 ; If '!' If $iAsc = 46 Then Return 1 ; If '.' If $iAsc = 63 Then Return 1 ; If '?' Return 0 EndFunc However, and out of boredom, I have written many redundant scripts and projects just to add that one or two small elements that made it more to my taste. Again, nothing is a bad idea, as long as you have the time to invest, and a need for the result! Happy Coding! Edited February 28, 2012 by Realm My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. Link to comment Share on other sites More sharing options...
Dasttann777 Posted April 18, 2012 Share Posted April 18, 2012 I am keenly interested, tell me how it goes! Check out my new site!Current Projects:[list][*]Hunter Console - A Small Gadget[*]HunterPad - Basic Notepad aimed at Programmers[*]Betters UP! - Betting Game[/list] Link to comment Share on other sites More sharing options...
AlmarM Posted April 18, 2012 Share Posted April 18, 2012 Notepad example? Take a look in my signature! Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now