Code :
#include <string.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
Global $Form1 = GUICreate("StrHex - by fr0g & Gr4ph0s", 489, 170, 192, 124)
Global $Group1 = GUICtrlCreateGroup("Origin@l t3xt", 8, 16, 185, 129)
Global $Edit1 = GUICtrlCreateEdit("", 16, 32, 169, 105, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL,$WS_HSCROLL))
GUICtrlSetData(-1, StringFormat("Entrez ici votre texte..."))
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Group2 = GUICtrlCreateGroup("C0nvert3d Text", 288, 16, 193, 129)
Global $Edit2 = GUICtrlCreateEdit("", 296, 32, 177, 105, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL,$WS_HSCROLL))
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Button1 = GUICtrlCreateButton("C0nvert", 200, 112, 81, 25, $WS_GROUP)
Global $Combo1 = GUICtrlCreateCombo("", 200, 56, 81, 25)
GUICtrlSetData(-1, "STR -> HEX|STR -> INT|STR -> BIN|STR -> DEC| |HEX -> STR|HEX -> INT|HEX -> BIN|HEX -> DEC| |BIN -> HEX|BIN -> STR|BIN -> DEC | |DEC -> STR|DEC -> HEX|DEC -> BIN| |INT -> HEX|INT -> BIN|")
Global $Label1 = GUICtrlCreateLabel("http://hwc-crew.com", 190, 152, 131, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $GUI_EVENT_CLOSE
exit 1
Case $Button1
$initial_text = GuiCtrlRead($Edit1)
$method = GuiCtrlRead($combo1)
if ($method == "STR -> HEX") Then
$output_hex = _StringToHex($initial_text)
GUICtrlSetData($Edit2, $output_hex)
ElseIf ($method == "STR -> INT") Then
$output_int = Int($initial_text)
GUICtrlSetData($Edit2, $output_int)
ElseIf ($method == "STR -> BIN") Then
$initial_text_split = StringSplit($initial_text, "")
$output_bin = ""
For $a = 1 to $initial_text_split[0]
$asc = Asc($initial_text_split[$a])
$mod = ""
For $b = 1 to 8
$mod = Mod($asc, 2) & $mod
$asc = Floor($asc/2)
Next
$output_bin &= " "&$mod
Next
GUICtrlSetData($Edit2, $output_bin)
ElseIf ($method == "STR -> DEC") Then
$output_dec =""
Local $lettre = StringSplit($initial_text,'')
For $i = 1 To $lettre[0]
$lettre_dec = Asc($lettre[$i])
$output_dec &= " "& $lettre_dec
Next
GUICtrlSetData($Edit2, $output_dec)
ElseIf ($method == "HEX -> STR") Then
$output_text = _HexToString($initial_text)
GUICtrlSetData($Edit2, $output_text)
ElseIf ($method == "HEX -> INT") Then
$output_int = _HexToString($initial_text)
$output_int = Int($output_int)
GUICtrlSetData($Edit2, $output_int)
ElseIf ($method == "HEX -> BIN") Then
$output_bin = _HexToString($initial_text)
$output_text_split = StringSplit($output_bin, "")
$output_bin = ""
For $a = 1 to $output_text_split[0]
$asc = Asc($output_text_split[$a])
$mod = ""
For $b = 1 to 8
$mod = Mod($asc, 2) & $mod
$asc = Floor($asc/2)
Next
$output_bin &= " "&$mod
Next
GUICtrlSetData($Edit2, $output_bin)
ElseIf ($method == "HEX -> DEC") Then
$input_hex = _HexToString($initial_text)
$input_hex = StringReplace($input_hex,"0x","")
$input_hex = StringReplace($input_hex," ","")
$input_hex = _HexToString($input_hex)
$input_hex = StringReplace($input_hex,"0x","")
$output_dec =""
$lettre = StringSplit($input_hex,'')
For $i = 1 To $lettre[0]
$lettre_dec = Asc($lettre[$i])
$output_dec &= " "& $lettre_dec
Next
GUICtrlSetData($Edit2, $output_dec)
$initial_text_split = StringSplit($initial_text, "")
$output_bin = ""
For $a = 1 to $initial_text_split[0]
$asc = Asc($initial_text_split[$a])
$mod = ""
For $b = 1 to 8
$mod = Mod($asc, 2) & $mod
$asc = Floor($asc/2)
Next
$output_bin &= " "&$mod
Next
GUICtrlSetData($Edit2, $output_bin)
ElseIf ($method == "BIN -> HEX") Then
$initial_text = StringReplace($initial_text," ","")
$initial_text_split = StringSplit($initial_text, "")
$output_hex = ""
For $a = 1 to $initial_text_split[0] Step 8
$temp = ""
For $b = 0 To 7
$temp &= $initial_text_split[$a+$b]
Next
$chr = 0
$temp = StringSplit($temp, "")
For $c = 1 to $temp[0]
$chr *= 2
$chr += Number($temp[$c])
Next
$output_hex &= " "&Chr($chr)
Next
$output_hex = StringReplace($output_hex," ","")
$lettre = StringSplit($output_hex,'')
$output_hex_final = ""
For $i = 1 To $lettre[0]
$lettre_hex = _StringToHex($lettre[$i])
$output_hex_final &= " "& $lettre_hex
Next
GUICtrlSetData($Edit2, $output_hex_final)
ElseIf ($method == "BIN -> STR") Then
$initial_text_split = StringSplit($initial_text, "")
$output_text = ""
For $a = 1 to $initial_text_split[0] Step 8
$temp = ""
For $b = 0 To 7
$temp &= $initial_text_split[$a+$b]
Next
$chr = 0
$temp = StringSplit($temp, "")
For $c = 1 to $temp[0]
$chr *= 2
$chr += Number($temp[$c])
Next
$output_text &= " "&Chr($chr)
Next
GUICtrlSetData($Edit2, $output_text)
ElseIf ($method == "BIN -> DEC") Then
$initial_text = StringReplace($initial_text," ","")
$initial_text_split = StringSplit($initial_text, "")
$output_dec = ""
For $a = 1 to $initial_text_split[0] Step 8
$temp = ""
For $b = 0 To 7
$temp &= $initial_text_split[$a+$b]
Next
$chr = 0
$temp = StringSplit($temp, "")
For $c = 1 to $temp[0]
$chr *= 2
$chr += Number($temp[$c])
Next
$output_dec &= " "&Chr($chr)
Next
$output_dec_final =""
$output_dec = StringReplace($output_dec," ","")
$lettre = StringSplit($output_dec,'')
For $i = 1 To $lettre[0]
$lettre_dec = Asc($lettre[$i])
$output_dec_final &= " "& $lettre_dec
Next
GUICtrlSetData($Edit2, $output_dec_final)
ElseIf ($method == "DEC -> STR") Then
$output_str =""
$lettre = StringReplace($initial_text," ","")
$lettre = StringSplit($lettre,'')
For $i = 1 To $lettre[0] Step 2
$lettre_str = Chr($lettre[$i]&$lettre[$i+1])
$output_str &= " "& $lettre_str
Next
GUICtrlSetData($Edit2, $output_str)
ElseIf ($method == "DEC -> HEX") Then
$output_hex =""
$lettre = StringReplace($initial_text," ","")
$lettre = StringSplit($lettre,'')
For $i = 1 To $lettre[0] Step 2
$lettre_hex = Chr($lettre[$i]&$lettre[$i+1])
$output_hex &= " "& $lettre_hex
Next
$output_hex = StringReplace($output_hex," ","")
$lettre = StringSplit($output_hex,'')
$output_hex_final = ""
For $i = 1 To $lettre[0]
$lettre_hex = _StringToHex($lettre[$i])
$output_hex_final &= " "& $lettre_hex
Next
GUICtrlSetData($Edit2, $output_hex_final)
ElseIf ($method == "DEC -> BIN") Then
$output_bin =""
$lettre = StringReplace($initial_text," ","")
$lettre = StringSplit($lettre,'')
For $i = 1 To $lettre[0] Step 2
$lettre_bin = Chr($lettre[$i]&$lettre[$i+1])
$output_bin &= " "& $lettre_bin
Next
$output_bin = stringreplace($output_bin," ","")
$output_text_split = StringSplit($output_bin, "")
$output_bin = ""
For $a = 1 to $output_text_split[0]
$asc = Asc($output_text_split[$a])
$mod = ""
For $b = 1 to 8
$mod = Mod($asc, 2) & $mod
$asc = Floor($asc/2)
Next
$output_bin &= " "&$mod
Next
GUICtrlSetData($Edit2, $output_bin)
ElseIf ($method == "INT -> HEX") Then
$output_int = String($initial_text)
$output_int = hex($output_int)
GUICtrlSetData($Edit2, $output_int)
ElseIf ($method == "INT -> BIN") Then
$initial_text_split = StringSplit($initial_text, "")
$output_bin = ""
For $a = 1 to $initial_text_split[0]
$asc = Asc($initial_text_split[$a])
$mod = ""
For $b = 1 to 8
$mod = Mod($asc, 2) & $mod
$asc = Floor($asc/2)
Next
$output_bin &= " "&$mod
Next
GUICtrlSetData($Edit2, $output_bin)
Else
MsgBox(64,"Err0r","Erreur : Méthode inconnue par le programme")
EndIf
Case $Label1
MsgBox(64,"Infos...","Developper :" & @CRLF & " - fr0g(HWC te@m)" & @CRLF & " - Gr4ph0s // Ptifou78(HWC te@m)"& @CRLF & "Website : http://hwc-crew.com" & @CRLF & "Th@nk's :"& @CRLF &" - All HWC members")
EndSwitch
WEnd