gseller Posted October 3, 2007 Share Posted October 3, 2007 (edited) Edited October 3, 2007 by gesller Link to comment Share on other sites More sharing options...
martin Posted October 3, 2007 Share Posted October 3, 2007 Very good. 2 more buttons, 'undo' and 'hex to dec', 'dec to hex'? Well ok, three. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
GEOSoft Posted October 3, 2007 Share Posted October 3, 2007 (edited) Well done. You can even shorten it with Func SetCase($sCaseType) Local $r = GUICtrlRead($Input1) Switch $sCaseType Case "Upper" GUICtrlSetData($Input1, StringUpper($r)) Case "Lower" GUICtrlSetData($Input1, StringLower($r)) Case "Crunch" GUICtrlSetData($Input1, StringRegExpReplace(($r), "[^0-9]", "")) Case "Reset" GUICtrlSetData($Input1, StringRegExpReplace(($r), "[^ ]", "")) Case "Proper" GUICtrlSetData($Input1, _StringProper($r)) Case "Reverse" GUICtrlSetData($Input1, _StringReverse($r)) EndSwitch EndFunc Edit: Added Local scope Edited October 3, 2007 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
GEOSoft Posted October 3, 2007 Share Posted October 3, 2007 Or even easier Func SetCase($sCaseType) Local $r = GUICtrlRead($Input1), $o Switch $sCaseType Case "Upper" $o = $Input1, StringUpper($r) Case "Lower" $o = $Input1, StringLower($r) Case "Crunch" $o = $Input1, StringRegExpReplace(($r), "[^0-9]", "") Case "Reset" $o = $Input1, StringRegExpReplace(($r), "[^ ]", "") Case "Proper" $o = $Input1, _StringProper($r) Case "Reverse" $o = $Input1, _StringReverse($r) EndSwitch GUICtrlSetData($Input1, $o) EndFunc George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
GEOSoft Posted October 3, 2007 Share Posted October 3, 2007 (edited) OK let's really shorten it. expandcollapse popup#NoTrayIcon #include <GUIConstants.au3> #Include <String.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)) $Crunch = GUICtrlCreateButton("#Crunch", 7, 115, 49, 25) $Reset = GUICtrlCreateButton("Reset", 56, 115, 49, 25) $Upper = GUICtrlCreateButton("Upper Case", 105, 115, 65, 25) $Lower = GUICtrlCreateButton("Lower Case", 170, 115, 65, 25) $Proper = GUICtrlCreateButton("Proper Case", 235, 115, 65, 25) $Reverse = GUICtrlCreateButton("Reverse", 300, 115, 65, 25) $Binary = GUICtrlCreateButton("Binary", 7, 140, 49, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Crunch To $Binary $bOut = GUICtrlRead($nMsg) If StringInStr($bOut, "#") Then $bOut = StringReplace($bOut, "#", "") If StringInStr($bOut, " case") Then $bOut = StringReplace($bOut, " case", "") GUICtrlSetData($Input1,SetCase($bOut)) 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 "Binary" $o = StringToBinary($r) EndSwitch Return $o EndFunc Note that $Reset was moved up 1 line Edited October 3, 2007 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
gseller Posted October 3, 2007 Author Share Posted October 3, 2007 Sweet! Thanks All.. Altho post 4 and 5 don't seen to work for me.. Post 3 works great!! setting $r as a local is a sweet idea. I am looking thru the helpfile for more strigs to put in... meanwhile look at post 1 again, I will update with the string to binary I just found.. Link to comment Share on other sites More sharing options...
gseller Posted October 3, 2007 Author Share Posted October 3, 2007 Sorry, wouldn't let me edit my first post.. here is all is... Alpha_Numeric_Manipulator.au3Alpha-Numeric Manipulator.exeicon fileexpandcollapse popup#NoTrayIcon #include <GUIConstants.au3> #Include <String.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)) $Crunch = GUICtrlCreateButton("#Crunch", 7, 115, 49, 25) $Reset = GUICtrlCreateButton("Reset", 56, 115, 49, 25) $Upper = GUICtrlCreateButton("Upper Case", 105, 115, 65, 25) $Lower = GUICtrlCreateButton("Lower Case", 170, 115, 65, 25) $Proper = GUICtrlCreateButton("Proper Case", 235, 115, 65, 25) $Reverse = GUICtrlCreateButton("Reverse", 300, 115, 65, 25) $Binary = GUICtrlCreateButton("Binary", 7, 140, 49, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Crunch SetCase("Crunch") Case $Reset SetCase("Reset") Case $Upper SetCase("Upper") Case $Lower SetCase("Lower") Case $Proper SetCase("Proper") Case $Reverse SetCase("Reverse") Case $Binary SetCase("Binary") EndSwitch WEnd Func SetCase($sCaseType) Local $r = GUICtrlRead($Input1) Switch $sCaseType Case "Upper" GUICtrlSetData($Input1, StringUpper($r)) Case "Lower" GUICtrlSetData($Input1, StringLower($r)) Case "Crunch" GUICtrlSetData($Input1, StringRegExpReplace(($r), "[^0-9]", "")) Case "Reset" GUICtrlSetData($Input1, StringRegExpReplace(($r), "[^ ]", "")) Case "Proper" GUICtrlSetData($Input1, _StringProper($r)) Case "Reverse" GUICtrlSetData($Input1, _StringReverse($r)) Case "Binary" GUICtrlSetData($Input1, StringToBinary($r)) EndSwitch EndFunc Link to comment Share on other sites More sharing options...
GEOSoft Posted October 3, 2007 Share Posted October 3, 2007 (edited) I updated the code in post 5. It works now. I had left in the references to $input1 (SetCase function) when I was adjusting the script. Edit: This is an intentional edit to make sure edit is working. I'm seeing a lot of the "Couldn't edit my post" messages lately. When you click on the Edit button you are presented with a dropdown containing 2 choices Full Edit Quick Edit You must select one of those methods before you can edit the post. Quick Edit is usually sufficient. Edited October 3, 2007 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
gseller Posted October 4, 2007 Author Share Posted October 4, 2007 cool, post 5 works like a charm.. Yep, I tried a quick edit first and it only showed up as the .au3 file I had uploaded and then I tried full edit and it did the same. So I juet reposted it.. Link to comment Share on other sites More sharing options...
GEOSoft Posted October 4, 2007 Share Posted October 4, 2007 cool, post 5 works like a charm.. Yep, I tried a quick edit first and it only showed up as the .au3 file I had uploaded and then I tried full edit and it did the same. So I juet reposted it..You could play with it even more by using a Combo and only 1 button. $Combo = GUICtrlCreateCombo("", x, y, w, h) GUICtrlSetData($Combo, "#Crunch|UPPER CASE|lower case|Proper Case|Reverse|Binary", "#Crunch") $Btn_Go = GUICtrlCreateButton("Proceed",x, y, w, y) Then the idle loop becomes 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 $Btn_Go GUICtrlSetData($Input1,SetCase($bOut)) EndSwitch Wend George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
gseller Posted October 4, 2007 Author Share Posted October 4, 2007 Cool idea but did work for me. Would be even better if we made the combo box trigger when selected and eliminated all buttons.. Link to comment Share on other sites More sharing options...
GEOSoft Posted October 4, 2007 Share Posted October 4, 2007 Cool idea but did work for me. Would be even better if we made the combo box trigger when selected and eliminated all buttons..You could do that be changing the lineGUICtrlSetData($Combo, "#Crunch|UPPER CASE|lower case|Proper Case|Reverse|Binary", "#Crunch")toGUICtrlSetData($Combo, "#Crunch|UPPER CASE|lower case|Proper Case|Reverse|Binary", "")And change the Case statement toCase $ComboBTW: What didn't work for you? George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
gseller Posted October 4, 2007 Author Share Posted October 4, 2007 Sweet!! Nevermind bout the didn't work for me. I was having a Duh moment, forgot to add the coordinants for combo and button.. LOL The new combo code works well also.. Thanks, always nice to have options.. Link to comment Share on other sites More sharing options...
gseller Posted October 4, 2007 Author Share Posted October 4, 2007 Here is the code at this point with the combo.. expandcollapse popup#NoTrayIcon #include <GUIConstants.au3> #Include <String.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", "") 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 GUICtrlSetData($Input1,SetCase($bOut)) 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 Link to comment Share on other sites More sharing options...
GEOSoft Posted October 4, 2007 Share Posted October 4, 2007 I was having a Duh moment, forgot to add the coordinants for combo and button.That was my first guess. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Valuater Posted October 4, 2007 Share Posted October 4, 2007 Nice!!! Maybe add ...Spell checking???? 8) Link to comment Share on other sites More sharing options...
gseller Posted October 4, 2007 Author Share Posted October 4, 2007 that is a way cool idea.. I wonder if I can use Skizmata's Google code http://www.autoitscript.com/forum/index.ph...eck+spell+check to add to the $r input.. Link to comment Share on other sites More sharing options...
martin Posted October 4, 2007 Share Posted October 4, 2007 The combo idea is definitely better, keep it going. (I still would like an 'undo' though, or even a 'back to original'.) Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
gseller Posted October 5, 2007 Author Share Posted October 5, 2007 (edited) The combo idea is definitely better, keep it going. (I still would like an 'undo' though, or even a 'back to original'.) Here is it with an undo but I can only make it undo the the last text action like deleting and backspacing. It won't undo the functions. Anyone got an ide how to fix this? edit: I see in the helpfile using _GUICtrlEditUndo - Undoes the last edit control operation in the control's undo queue. expandcollapse popup#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) 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 GUICtrlSetData($Input1,SetCase($bOut)) Case $Btn_Go Undo() EndSwitch Wend Func Undo() _GUICtrlEditUndo($Input1) EndFunc 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 Edited October 5, 2007 by gesller Link to comment Share on other sites More sharing options...
Valuater Posted October 5, 2007 Share Posted October 5, 2007 (edited) Maybe... expandcollapse popup#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) Edited October 5, 2007 by Valuater 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