Jump to content
Sign in to follow this  
mrbig1479

ASCII Characters help please

Recommended Posts

mrbig1479

Hey i was looking in the help file for ASCII Characters.

there are 2 Columns there

the first one give you the ASCII code for a character E.G

$=36 for example

the second one give you another code

$=24 for example

how do i get the sec one when i script ?

i use the command

AscW("A") returns 65

i want to get 41 (the other code its not ascii its like URL Encoding)

Any idea?

hope i made myself clear

Edited by mrbig1479

Share this post


Link to post
Share on other sites
Triblade

Pfff, it took me a while.

But you seemed to mean you want the HEX code of the character.

Do this by simple translate the 65 into hex.

Hex(65)
;)

If you dont want the leading zero's you have to remove them somehow.

I'm not a AutoIt guru so my simplistic methode would be:

$ascii = 65
$ascii = Hex($ascii)
While StringLeft($ascii, 1) = 0
    $ascii = StringTrimLeft($ascii, 1)
WEnd

msgbox(0,"",$ascii)

(Note that the MsgBox is only to show the result)

EDIT: !!! My previous methode was stupid!!!

This one is realistic. The last stupid code removed, for example, the 0 after 40 as well!

Edited by Triblade

My active project(s): A-maze-ing generator (generates a maze)

My archived project(s): Pong3 (Multi-pinger)

Share this post


Link to post
Share on other sites
mrbig1479

Pfff, it took me a while.

But you seemed to mean you want the HEX code of the character.

Do this by simple translate the 65 into hex.

Hex(65)
;)

If you dont want the leading zero's you have to remove them somehow.

I'm not a AutoIt guru so my simplistic methode would be:

$ascii = 65
$ascii = Hex($ascii)
While StringLeft($ascii, 1) = 0
    $ascii = StringTrimLeft($ascii, 1)
WEnd

msgbox(0,"",$ascii)

(Note that the MsgBox is only to show the result)

EDIT: !!! My previous methode was stupid!!!

This one is realistic. The last stupid code removed, for example, the 0 after 40 as well!

thanks buddy :D

Share this post


Link to post
Share on other sites
martin

thanks buddy ;)

$ascii = 65
$ascii = Hex($ascii,2)
;While StringLeft($ascii, 1) = 0
;   $ascii = StringTrimLeft($ascii, 1)
;WEnd

msgbox(0,"",$ascii)

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.