Jump to content

Hex to Text


Skrip
 Share

Recommended Posts

#include <GUIConstants.au3>
#include <string.au3>

$Form1 = GUICreate("Hex to Text ~~~ By Firestorm", 657, 722, 199, 111)
$Edit1 = GUICtrlCreateEdit("", 8, 24, 633, 305)
$Edit2 = GUICtrlCreateEdit("", 8, 392, 633, 305)
$Button1 = GUICtrlCreateButton("Text to Hex", 144, 344, 121, 33, 0)
$Button2 = GUICtrlCreateButton("Hex to Text", 360, 344, 129, 33, 0)
$Label1 = GUICtrlCreateLabel("Text:", 8, 8, 28, 17)
GUICtrlSetBkColor(-1, 0xFFFF00)
$Label2 = GUICtrlCreateLabel("Hex:", 8, 376, 26, 17)
GUICtrlSetBkColor(-1, 0xFFFF00)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $info = GUICtrlRead($Edit1)
            $info_set = _StringToHex($info)
            If $info_set = "-1" Then
                GUICtrlSetData($Edit1, "ERROR IN TEXT STRING!!" & @CRLF & "Please revise the string...")
            Else
            GUICtrlSetData($Edit2, $info_set)
            EndIf
        Case $Button2
            $info = GUICtrlRead($Edit2)
            $info_set = _HexToString($info)
            If $info_set = "-1" Then
                GUICtrlSetData($Edit1, "ERROR IN HEX STRING!!" & @CRLF & "Please revise the string...")
            Else
            GUICtrlSetData($Edit1, $info_set)
            EndIf
    EndSwitch
WEnd

I know this has probably been made before, but I felt like making my own. I know this will help me. I seem to work with hex more than I used to.

Edit: Added error checking.

Edited by Firestorm

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

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...