p2p2 Posted March 7, 2013 Share Posted March 7, 2013 <p>I created this to convert a text to "graphical Hexidecimal"(think of a letter as a 4x5 image in 1/0 and take it's hexidecimal-codeIt really works perfectly, except one little thing. I getF9998for the "D", but I should get this:E999EI can't find the bug. I'm sure there isn't any! But why doesn't it work??Func _HEX($text) Local $hex1, $hex2, $hex3, $hex4, $hex5 $hex1 = StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace($text, " ", "0 "), "A", "6 "), "B", "e "), "C", "6 "), "D", "e "), "E", "f "), "F", "f "), "G", "6 "), "H", "9 "), "I", "6 "), "J", "f "), "K", "9 "), "L", "8 "), "M", "9 "), "N", "d "), "O", "6 "), "P", "e "), "Q", "6 "), "R", "e "), "S", "6 "), "T", "f "), "U", "9 "), "V", "9 "), "W", "9 "), "X", "9 "), "Y", "9 "), "Z", "f "), " ", " "), "!", "6 ") $hex2 = StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace($text, " ", "0 "), "A", "9 "), "B", "9 "), "C", "8 "), "D", "9 "), "E", "8 "), "F", "8 "), "G", "8 "), "H", "9 "), "I", "6 "), "J", "1 "), "K", "9 "), "L", "8 "), "M", "f "), "N", "d "), "O", "9 "), "P", "9 "), "Q", "9 "), "R", "9 "), "S", "8 "), "T", "6 "), "U", "9 "), "V", "9 "), "W", "9 "), "X", "9 "), "Y", "9 "), "Z", "1 "), " ", " "), "!", "6 ") $hex3 = StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace($text, " ", "0 "), "A", "f "), "B", "e "), "C", "8 "), "D", "9 "), "E", "f "), "F", "f "), "G", "8 "), "H", "f "), "I", "6 "), "J", "1 "), "K", "e "), "L", "8 "), "M", "9 "), "N", "f "), "O", "9 "), "P", "e "), "Q", "9 "), "R", "e "), "S", "6 "), "T", "6 "), "U", "9 "), "V", "9 "), "W", "9 "), "X", "6 "), "Y", "6 "), "Z", "6 "), " ", " "), "!", "6 ") $hex4 = StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace($text, " ", "0 "), "A", "9 "), "B", "9 "), "C", "8 "), "D", "9 "), "E", "8 "), "F", "8 "), "G", "9 "), "H", "9 "), "I", "6 "), "J", "1 "), "K", "9 "), "L", "8 "), "M", "9 "), "N", "b "), "O", "9 "), "P", "8 "), "Q", "b "), "R", "9 "), "S", "1 "), "T", "6 "), "U", "9 "), "V", "6 "), "W", "f "), "X", "9 "), "Y", "6 "), "Z", "8 "), " ", " "), "!", "0 ") $hex5 = StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace($text, " ", "0 "), "A", "9 "), "B", "e "), "C", "6 "), "D", "e "), "E", "f "), "F", "8 "), "G", "7 "), "H", "9 "), "I", "6 "), "J", "6 "), "K", "9 "), "L", "f "), "M", "9 "), "N", "b "), "O", "6 "), "P", "8 "), "Q", "7 "), "R", "9 "), "S", "6 "), "T", "6 "), "U", "6 "), "V", "6 "), "W", "9 "), "X", "9 "), "Y", "6 "), "Z", "f "), " ", " "), "!", "6 ") Return StringReplace(StringReplace($hex1&"!"&@CRLF&$hex2&"!"&@CRLF&$hex3&"!"&@CRLF&$hex4&"!"&@CRLF&$hex5&"!", " ", " "), " !", "") EndFunc ;==>_HEX</p> Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 7, 2013 Moderators Share Posted March 7, 2013 p2p2, I strongly suggest you rewrite your function to use arrays and loops - then it will be easier to debug. This shows how you might do it - you will obviously need to make the array much bigger, but the rest of the code is good. expandcollapse popup#include <Array.au3> $sText = "abcba" $sRet = _HEX($sText) ConsoleWrite($sRet & @CRLF) ConsoleWrite(@CRLF) $sRet = _New_HEX($sText) ConsoleWrite($sRet & @CRLF) Func _New_HEX($text) Local $aTrans[3][6] = [ _ ["A", "6", "9", "f", "9", "9"], _ ["B", "e", "9", "e", "9", "e"], _ ["C", "6", "8", "8", "8", "6"]] Local $aHex[6] = [0, "", "", "", "", ""] For $i = 1 To StringLen($text) $sChar = StringUpper(StringMid($text, $i, 1)) $iIndex = _ArraySearch($aTrans, $sChar) If $iIndex <> -1 Then For $j = 1 To 5 $aHex[$j] &= $aTrans[$iIndex][$j] & " " Next EndIf Next $sRet = "" For $i = 1 To 5 $sRet &= $aHex[$i] & @CRLF Next Return $sRet EndFunc ;==>_HEX Func _HEX($text) Local $hex1, $hex2, $hex3, $hex4, $hex5 $hex1 = StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace($text, " ", "0 "), "A", "6 "), "B", "e "), "C", "6 "), "D", "e "), "E", "f "), "F", "f "), "G", "6 "), "H", "9 "), "I", "6 "), "J", "f "), "K", "9 "), "L", "8 "), "M", "9 "), "N", "d "), "O", "6 "), "P", "e "), "Q", "6 "), "R", "e "), "S", "6 "), "T", "f "), "U", "9 "), "V", "9 "), "W", "9 "), "X", "9 "), "Y", "9 "), "Z", "f "), " ", " "), "!", "6 ") $hex2 = StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace($text, " ", "0 "), "A", "9 "), "B", "9 "), "C", "8 "), "D", "9 "), "E", "8 "), "F", "8 "), "G", "8 "), "H", "9 "), "I", "6 "), "J", "1 "), "K", "9 "), "L", "8 "), "M", "f "), "N", "d "), "O", "9 "), "P", "9 "), "Q", "9 "), "R", "9 "), "S", "8 "), "T", "6 "), "U", "9 "), "V", "9 "), "W", "9 "), "X", "9 "), "Y", "9 "), "Z", "1 "), " ", " "), "!", "6 ") $hex3 = StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace($text, " ", "0 "), "A", "f "), "B", "e "), "C", "8 "), "D", "9 "), "E", "f "), "F", "f "), "G", "8 "), "H", "f "), "I", "6 "), "J", "1 "), "K", "e "), "L", "8 "), "M", "9 "), "N", "f "), "O", "9 "), "P", "e "), "Q", "9 "), "R", "e "), "S", "6 "), "T", "6 "), "U", "9 "), "V", "9 "), "W", "9 "), "X", "6 "), "Y", "6 "), "Z", "6 "), " ", " "), "!", "6 ") $hex4 = StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace($text, " ", "0 "), "A", "9 "), "B", "9 "), "C", "8 "), "D", "9 "), "E", "8 "), "F", "8 "), "G", "9 "), "H", "9 "), "I", "6 "), "J", "1 "), "K", "9 "), "L", "8 "), "M", "9 "), "N", "b "), "O", "9 "), "P", "8 "), "Q", "b "), "R", "9 "), "S", "1 "), "T", "6 "), "U", "9 "), "V", "6 "), "W", "f "), "X", "9 "), "Y", "6 "), "Z", "8 "), " ", " "), "!", "0 ") $hex5 = StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace($text, " ", "0 "), "A", "9 "), "B", "e "), "C", "6 "), "D", "e "), "E", "f "), "F", "8 "), "G", "7 "), "H", "9 "), "I", "6 "), "J", "6 "), "K", "9 "), "L", "f "), "M", "9 "), "N", "b "), "O", "6 "), "P", "8 "), "Q", "7 "), "R", "9 "), "S", "6 "), "T", "6 "), "U", "6 "), "V", "6 "), "W", "9 "), "X", "9 "), "Y", "6 "), "Z", "f "), " ", " "), "!", "6 ") Return StringReplace(StringReplace($hex1&"!"&@CRLF&$hex2&"!"&@CRLF&$hex3&"!"&@CRLF&$hex4&"!"&@CRLF&$hex5&"!", " ", " "), " !", "") EndFunc ;==>_HEX You will notice that the results from the 2 functions are not identical although I did use the data in your function. So I fear that you may have more then the one error in your existing code. At least this way you can check easily that you do have the correct values for each letter. I hope this helps. M23 p2p2 1  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
p2p2 Posted March 7, 2013 Author Share Posted March 7, 2013 (edited) And how to write it as an Include? I don't really understand where the mistake was/is. And I never used Arrays before. (programs were alwaysworking without them, too). I used this code as an include: #include-once ; #INDEX# ======================================================================================================================= ; Title .........: String-To-GraphicalHEX-Converter for AutoIt3 ; AutoIt Version : 3.2 ; Language ......: English ; Description ...: Converts a string to Graphical-Hex code ; Author(s) .....: p2 ; Dll ...........: None ; =============================================================================================================================== #region functions Global $text ; #FUNCTION# =================================================================== ; Name...........: _HEX ; Description ...: Converts a string to Graphical-Hex code ; Syntax.........: _HEX( $text ) ; Parameters ....: $text - Text to convert ; Return values .: On Success - Returns the Graphical-Hex code ; On Failure - Working on it... -.- ; Author ........: p2 ;=============================================================================== Func _HEX($text) Local $hex1, $hex2, $hex3, $hex4, $hex5 $hex1 = StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace($text, " ", "0 "), "A", "6 "), "B", "e "), "C", "6 "), "D", "e "), "E", "f "), "F", "f "), "G", "6 "), "H", "9 "), "I", "6 "), "J", "f "), "K", "9 "), "L", "8 "), "M", "9 "), "N", "d "), "O", "6 "), "P", "e "), "Q", "6 "), "R", "e "), "S", "6 "), "T", "f "), "U", "9 "), "V", "9 "), "W", "9 "), "X", "9 "), "Y", "9 "), "Z", "f "), " ", " "), "!", "6 ") $hex2 = StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace($text, " ", "0 "), "A", "9 "), "B", "9 "), "C", "8 "), "D", "9 "), "E", "8 "), "F", "8 "), "G", "8 "), "H", "9 "), "I", "6 "), "J", "1 "), "K", "9 "), "L", "8 "), "M", "f "), "N", "d "), "O", "9 "), "P", "9 "), "Q", "9 "), "R", "9 "), "S", "8 "), "T", "6 "), "U", "9 "), "V", "9 "), "W", "9 "), "X", "9 "), "Y", "9 "), "Z", "1 "), " ", " "), "!", "6 ") $hex3 = StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace($text, " ", "0 "), "A", "f "), "B", "e "), "C", "8 "), "D", "9 "), "E", "f "), "F", "f "), "G", "8 "), "H", "f "), "I", "6 "), "J", "1 "), "K", "e "), "L", "8 "), "M", "9 "), "N", "f "), "O", "9 "), "P", "e "), "Q", "9 "), "R", "e "), "S", "6 "), "T", "6 "), "U", "9 "), "V", "9 "), "W", "9 "), "X", "6 "), "Y", "6 "), "Z", "6 "), " ", " "), "!", "6 ") $hex4 = StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace($text, " ", "0 "), "A", "9 "), "B", "9 "), "C", "8 "), "D", "9 "), "E", "8 "), "F", "8 "), "G", "9 "), "H", "9 "), "I", "6 "), "J", "1 "), "K", "9 "), "L", "8 "), "M", "9 "), "N", "b "), "O", "9 "), "P", "8 "), "Q", "b "), "R", "9 "), "S", "1 "), "T", "6 "), "U", "9 "), "V", "6 "), "W", "f "), "X", "9 "), "Y", "6 "), "Z", "8 "), " ", " "), "!", "0 ") $hex5 = StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace($text, " ", "0 "), "A", "9 "), "B", "e "), "C", "6 "), "D", "e "), "E", "f "), "F", "8 "), "G", "7 "), "H", "9 "), "I", "6 "), "J", "6 "), "K", "9 "), "L", "f "), "M", "9 "), "N", "b "), "O", "6 "), "P", "8 "), "Q", "7 "), "R", "9 "), "S", "6 "), "T", "6 "), "U", "6 "), "V", "6 "), "W", "9 "), "X", "9 "), "Y", "6 "), "Z", "f "), " ", " "), "!", "6 ") Return StringReplace(StringReplace($hex1&"!"&@CRLF&$hex2&"!"&@CRLF&$hex3&"!"&@CRLF&$hex4&"!"&@CRLF&$hex5&"!", " ", " "), " !", "") EndFunc ;==>_HEX #endregion functions sorry, but code-tags aren't working !? Edited March 7, 2013 by Melba23 Added code tags Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 7, 2013 Moderators Share Posted March 7, 2013 p2p2, sorry, but code-tags aren't workingOh yes they are! Put [autoit][/autoit] around the code - as I just have in the post above. But back to the thread - the code you keep posting is ugly and very difficult to work with. No-one is going to bother to work through it to find the error you say that you have because the code is basically unreadable at present. The script I posted offers a much clearer view of the various replacements that you make - in the array each letter you replace is next to the various replacement values, so a quick check will ensure that you have the correct values to be entered into your $hex# variables. Does the small sample I posted not give you a idea of how to fill the rest of the array? And claiming that you do not need arrays is foolish - they are an essential part of the toolbox of any coder and you should make the effort to learn how to use them. I recommend starting with the Arrays tutorial in the Wiki - and of course you can always ask further questions on the forum. Please ask again if you need a hand getting the code I posted to work as you wish. Your UDF template looks fine, by the way. M23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
p2p2 Posted March 7, 2013 Author Share Posted March 7, 2013 Well, it's just naaaaaany StringTReplaces after another! Capital letters are replaced with small leters and numbers. So nothing will get replaced twice it CAN'T fail! And when scrolling right, you see this: , "D", "e ") , "D", "9 ") , "D", "9 ") , "D", "9 ") , "D", "e ") So the "D" becomes "e 9 9 9 e" (It saves every on the 5 rows in a special var. Then optputs them as a text wit 5 lines.) [autoit]Return StringReplace(StringReplace($hex1&"!"&@CRLF&$hex2&"!"&@CRLF&$hex3&"!"&@CRLF&$hex4&"!"&@CRLF&$hex5&"!", " ", " "), " !", "")[autoit] This code part is also used to remove the " " after the last letter Looks ugly? Jep! Is difficult? Nope Btw: I know how to fill the rest of the array xD But I'm not sure how to put yours into an Including again, without pasting half of my code again. I can try it, but I think I'll get the same error again So I thought you could tell me Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 7, 2013 Moderators Share Posted March 7, 2013 p2p2, I understand perfectly how the code works - but I have no idea how to debug it to find out why it does not work as you want. From what I can see in the mass of text you have the correct replacment variables, but with so many nested functions it is impossible to say why those values are not being returned. So I devised what I believe is a simpler way - and one which is much easier to debug - up to you if you want to use it or not. To convert my script into an include, you just put the function I wrote in place of the function you wrote in the code you posted above - as easy as that. M23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
jdelaney Posted March 7, 2013 Share Posted March 7, 2013 (edited) When you replace D to 'e ', the e is then repaced to 'f ', then the f is replaaced to 'f ' Conceptually, this function will not work. NOTE: you are not setting the option to do case sensitive replaces, so f = F ConsoleWrite( "Non case sensitive replace...should be E: " & StringReplace("f", "F", "E") & @CRLF ) ConsoleWrite( "case sensitive replace...should remain f: " & StringReplace("f", "F", "E", 0, 1) & @CRLF ) output: Non case sensitive replace...should be E: E case sensitive replace...should remain f: f I agree, that the array route is better, but this corrects what is needed: case sensitive searches on the needed ones...rest are fine Func _HEX($text) Local $hex1, $hex2, $hex3, $hex4, $hex5 $hex1 = StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace($text, " ", "0 "), "A", "6 "), "B", "e "), "C", "6 "), "D", "e "), "E", "f ", 0, 1), "F", "f ", 0, 1), "G", "6 "), "H", "9 "), "I", "6 "), "J", "f "), "K", "9 "), "L", "8 "), "M", "9 "), "N", "d "), "O", "6 "), "P", "e "), "Q", "6 "), "R", "e "), "S", "6 "), "T", "f "), "U", "9 "), "V", "9 "), "W", "9 "), "X", "9 "), "Y", "9 "), "Z", "f "), " ", " "), "!", "6 ") $hex2 = StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace($text, " ", "0 "), "A", "9 "), "B", "9 "), "C", "8 "), "D", "9 "), "E", "8 "), "F", "8 "), "G", "8 "), "H", "9 "), "I", "6 "), "J", "1 "), "K", "9 "), "L", "8 "), "M", "f "), "N", "d "), "O", "9 "), "P", "9 "), "Q", "9 "), "R", "9 "), "S", "8 "), "T", "6 "), "U", "9 "), "V", "9 "), "W", "9 "), "X", "9 "), "Y", "9 "), "Z", "1 "), " ", " "), "!", "6 ") $hex3 = StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace($text, " ", "0 "), "A", "f "), "B", "e "), "C", "8 "), "D", "9 "), "E", "f ", 0, 1), "F", "f ", 0, 1), "G", "8 "), "H", "f "), "I", "6 "), "J", "1 "), "K", "e "), "L", "8 "), "M", "9 "), "N", "f "), "O", "9 "), "P", "e "), "Q", "9 "), "R", "e "), "S", "6 "), "T", "6 "), "U", "9 "), "V", "9 "), "W", "9 "), "X", "6 "), "Y", "6 "), "Z", "6 "), " ", " "), "!", "6 ") $hex4 = StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace($text, " ", "0 "), "A", "9 "), "B", "9 "), "C", "8 "), "D", "9 "), "E", "8 "), "F", "8 "), "G", "9 "), "H", "9 "), "I", "6 "), "J", "1 "), "K", "9 "), "L", "8 "), "M", "9 "), "N", "b "), "O", "9 "), "P", "8 "), "Q", "b "), "R", "9 "), "S", "1 "), "T", "6 "), "U", "9 "), "V", "6 "), "W", "f "), "X", "9 "), "Y", "6 "), "Z", "8 "), " ", " "), "!", "0 ") $hex5 = StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace($text, " ", "0 "), "A", "9 "), "B", "e "), "C", "6 "), "D", "e "), "E", "f ", 0, 1), "F", "8 ", 0, 1), "G", "7 "), "H", "9 "), "I", "6 "), "J", "6 "), "K", "9 "), "L", "f "), "M", "9 "), "N", "b "), "O", "6 "), "P", "8 "), "Q", "7 "), "R", "9 "), "S", "6 "), "T", "6 "), "U", "6 "), "V", "6 "), "W", "9 "), "X", "9 "), "Y", "6 "), "Z", "f "), " ", " "), "!", "6 ") Return StringReplace(StringReplace($hex1&"!"&@CRLF&$hex2&"!"&@CRLF&$hex3&"!"&@CRLF&$hex4&"!"&@CRLF&$hex5&"!", " ", " "), " !", "") EndFunc ;==>_HEX Edited March 7, 2013 by jdelaney p2p2 1 IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 7, 2013 Moderators Share Posted March 7, 2013 jdelaney,Conceptually, this function will not workWell picked up - I had forgotten that StringReplace was case-insensitive as a default. And my commiserations for your having had to work your way through that abomination to change the necessary parts! M23 p2p2 1  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
p2p2 Posted March 8, 2013 Author Share Posted March 8, 2013 Thanks jdelaney! I'll try it with StringReplace( ... , 0, 1) *CaseSensitiveAnd thanks,Melba23!I'll rewrite it with arrays, because I want to add an editor for the pictures replcing the lerrers, too. *Because I already found out that a line in a script has a max. length! So It won't work ading the new commands in my ugly code.And I'll try to use readable codes, now 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