ngskicker Posted March 21, 2009 Share Posted March 21, 2009 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 CODEAttribute 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 More sharing options...
MrMitchell Posted March 22, 2009 Share Posted March 22, 2009 Have you done any research at all to at least get you started? You should do that then post what you come up with... What is the purpose of your code; what does it need to do? Link to comment Share on other sites More sharing options...
BrettF Posted March 22, 2009 Share Posted March 22, 2009 Whats wrong with this? $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) Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Andreik Posted March 22, 2009 Share Posted March 22, 2009 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 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