Jump to content

Hex Encoder


turbox
 Share

Recommended Posts

Here is the script:

#include <GUIConstants.au3>

$Form1 = GUICreate("Hex Encoder", 473, 240, 193, 125)
$Label1 = GUICtrlCreateLabel("Enter Url:", 24, 8, 82, 28)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0054E3)
GUICtrlSetBkColor(-1, 0x000000)
$Label2 = GUICtrlCreateLabel("Hex Encoded:", 24, 80, 124, 28)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetBkColor(-1, 0x000000)
GUISetBkColor(0x808080)
$inp = GUICtrlCreateInput("", 24, 40, 393, 21)
$edit = GUICtrlCreateEdit("", 24, 120, 393, 73)
$Encode = GUICtrlCreateButton("Encode", 328, 208, 89, 25, 0)
GUISetState(@SW_SHOW)
$check = 0
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Encode
            if $check <> 1 Then GUICtrlSetData($edit, "")
            $readurl = GUICtrlRead($inp)
            $encoded = urlenc($readurl)
            GUICtrlSetData($edit, $encoded)
            $check = 1
    EndSwitch
WEnd

Func urlenc($strw)
    $out= ""
    $bin = StringToBinary($strw)
    $nstrw = StringMid($bin, 3, StringLen($bin)-2)
    for $i=1 to Stringlen($nstrw) step 2
        $enct = StringMid($nstrw, $i, 2)
        $out &= "%" & $enct
    Next
    Return $out
EndFunc
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...