Jump to content

Can someone help me


Recommended Posts

I have some vb code, i want to convert to auto it, but i can imagine how to do it, can someone help me please

this my vb

CODE
Attribute VB_Name = "Module1"

Option Explicit

Public Function HextoAscii(inputstr As String) As String 'fungsi untuk mengubah hexa ke ascii

Dim spilter As Variant, i As Integer, finnal As String

If InStr(1, inputstr, " ") <> 0 Then

spilter = Split(inputstr, " ")

For i = 0 To UBound(spilter)

finnal = finnal & Chr(Val("&H" & spilter(i)))

Next i

HextoAscii = finnal

ElseIf Len(inputstr) = 2 Then

finnal = Chr(Val("&H" & inputstr))

HextoAscii = finnal

End If

End Function

Public Function Asciitohex(inputstr As String) As String 'fungsi untuk mengubah assci ke hexa

On Error Resume Next

Dim spilter As Variant, i As Integer, finnal As String

For i = 1 To Len(inputstr)

finnal = finnal & Hex(Asc(Mid(inputstr, i, 1))) & " "

Next i

Asciitohex = Mid(finnal, 1, Len(finnal) - 1)

End Function

Link to comment
Share on other sites

Whats wrong with this? :P

$hex = 0x31; Number 1 key (ASII = 49)

;Convert from Hex to ASCII
$asc = Asc(Chr(0x31))
;Convert from ASCII to HEX
$hex = Hex($asc, 2)

;Show it
MsgBox (0, "ASCII representation of the hex value for #1", $Asc)
MsgBox (0, "Hex representation of the ASCII value for #1", $hex)
Link to comment
Share on other sites

Func AscToHex($STR)
    Local $FINAL = ""
    For $INDEX = 1 To StringLen($STR)
        $FINAL &= Hex(Asc(StringMid($STR,$INDEX,1))) & " "
    Next
    Return StringTrimRight($FINAL,1)
EndFunc

You can write first function just looking at this. Good luck.

When the words fail... music speaks.

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