Jump to content

Alpha/Numeric Manipulator - Text Case - Number Cruncher


gseller
 Share

Recommended Posts

Maybe...

#NoTrayIcon
#include <GUIConstants.au3>
#Include <String.au3>
#Include <GuiEdit.au3>


$AForm1 = GUICreate("gseller's Alpha/Numeric Manipulator", 375, 175, 193, 125)
$Input1=GUICtrlCreateEdit("",10,7,357,105,BitOR($ES_MULTILINE,$ES_AUTOVSCROLL,$WS_VSCROLL))
$Combo = GUICtrlCreateCombo("Select", 7, 140, 75, 25)
GUICtrlSetData($Combo, "#Crunch|Reset|UPPER CASE|lower case|Proper Case|Reverse|Binary|Binary2str|chr2ASCII|ASCII2chr|Unicode|Dec2Hex|Hex2Dec", "")
$Btn_Go = GUICtrlCreateButton("Undo",95, 140, 75, 25)
$dummy = ""
$dummy2 = ""
GUISetState(@SW_SHOW)

While 1
   $nMsg = GUIGetMsg()
   $bOut = GUICtrlRead($Combo)
   If StringInStr($bOut, "#") Then $bOut = StringReplace($bOut, "#", "")
   If StringInStr($bOut, " case") Then $bOut = StringReplace($bOut, " case", "")
   Switch $nMsg
      Case $GUI_EVENT_CLOSE
         Exit
     Case $Combo
         $dummy = GUICtrlRead($Input1)
         GUICtrlSetData($Input1,SetCase($bOut))
        Case $Btn_Go
         $dummy2 = GUICtrlRead($Input1)
         GUICtrlSetData($Input1, $dummy)
         $dummy = $dummy2
   EndSwitch
Wend


Func SetCase($sCaseType)
Local $r = GUICtrlRead($Input1), $o

Switch $sCaseType
  Case "Upper"
   $o = StringUpper($r)
  Case "Lower"
   $o = StringLower($r)
  Case "Crunch"
   $o = StringRegExpReplace(($r), "[^0-9]", "")
  Case "Reset"
   $o = StringRegExpReplace(($r), "[^ ]", "")
  Case "Proper"
   $o = _StringProper($r)
  Case "Reverse"
   $o = _StringReverse($r)
  Case "chr2ASCII"
   $o = Asc($r)
  Case "ASCII2chr"
   $o = Chr($r)   
  Case "Binary"
   $o = StringToBinary($r)
  Case "Binary2str"
   $o = BinaryToString($r)   
  Case "Unicode"
   $o = AscW($r)
  Case "Dec2Hex"
   $o = Hex($r)   
  Case "Hex2Dec"
   $o = Dec($r)   
EndSwitch
  Return $o
EndFunc

8)

OMGoodness.. You make this look too easy Vaulater.. LOL Thanks! :)

edit: Now on to the spellcheck.. That will make it Awesome!!

Edited by gesller
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...