QTP ASCII CHR() CODE CHART

Ascii art
PerfectoTopAd

QTP / UFT & ASCII

Entering/Reading ASCII codes – when using Unified Functional Testing previously known as Quick Test Professional (QTP) – is sometimes needed to achieve certain functionality.

FYI this info here is not specific to QTP since ASCII is a standard any tool/language that you use would use the same Chr codes below.

ASCII stand for American Standard Code for Information Interchange and it is a character encoding scheme based on the English alphabet.

Why does this matter?

QTP/UFT has two built in functions (ASC and Chr) that are helpful to know when you need to work with ASCII info. Make sure to also check out  3 ways to use keyboard input in QuickTest Professional: Type, SendKeys and Device Replay for other ideas similar to using the  ASCII methods.

Common ASCII codes for QTP and UFT Or Any other tool

Here are some of the most common QTP ascii character codes I often use:

QTP CODESYMBOLDESCRIPTION
Chr(34)Double Quotes
Chr(10)Line Feed
Chr(13)Carriage Return
Chr(32)Space

Chart for all the QTP/UFT Chr() codes:

QTP CODESYMBOLDESCRIPTION
Chr(0)NULNull char
Chr(1)SOHStart of Heading
Chr(2)STXStart of Text
Chr(3)ETXEnd of Text
Chr(4)EOTEnd of Transmission
Chr(5)ENQEnquiry
Chr(6)ACKAcknowledgment
Chr(7)BELBell
Chr(8)BSBack Space
Chr(9)HTHorizontal Tab
Chr(10)LFLine Feed
Chr(11)VTVertical Tab
Chr(12)FFForm Feed
Chr(13)CRCarriage Return
Chr(14)SOShift Out / X-On
Chr(15)SIShift In / X-Off
Chr(16)DLEData Line Escape
Chr(17)DC1Device Control 1 (oft. XON)
Chr(18)DC2Device Control 2
Chr(19)DC3Device Control 3 (oft. XOFF)
Chr(20)DC4Device Control 4
Chr(21)NAKNegative Acknowledgement
Chr(22)SYNSynchronous Idle
Chr(23)ETBEnd of Transmit Block
Chr(24)CANCancel
Chr(25)EMEnd of Medium
Chr(26)SUBSubstitute
Chr(27)ESCEscape
Chr(28)FSFile Separator
Chr(29)GSGroup Separator
Chr(30)RSRecord Separator
Chr(31)USUnit Separator
Chr(32)Space
Chr(33)!Exclamation mark
Chr(34)Double quotes (or speech marks)
Chr(35)#Number
Chr(36)$Dollar
Chr(37)%Procenttecken
Chr(38)&Ampersand
Chr(39)Single quote
Chr(40)(Open parenthesis (or open bracket)
Chr(41))Close parenthesis (or close bracket)
Chr(42)*Asterisk
Chr(43)+Plus
Chr(44),Comma
Chr(45)Hyphen
Chr(46).Period, dot or full stop
Chr(47)/Slash or divide
Chr(48)0Zero
Chr(49)1One
Chr(50)2Two
Chr(51)3Three
Chr(52)4Four
Chr(53)5Five
Chr(54)6Six
Chr(55)7Seven
Chr(56)8Eight
Chr(57)9Nine
Chr(58):Colon
Chr(59);Semicolon
Chr(60)<Less than (or open angled bracket)
Chr(61)=Equals
Chr(62)>Greater than (or close angled bracket)
Chr(63)?Question mark
Chr(64)@At symbol
Chr(65)AUppercase A
Chr(66)BUppercase B
Chr(67)CUppercase C
Chr(68)DUppercase D
Chr(69)EUppercase E
Chr(70)FUppercase F
Chr(71)GUppercase G
Chr(72)HUppercase H
Chr(73)IUppercase I
Chr(74)JUppercase J
Chr(75)KUppercase K
Chr(76)LUppercase L
Chr(77)MUppercase M
Chr(78)NUppercase N
Chr(79)OUppercase O
Chr(80)PUppercase P
Chr(81)QUppercase Q
Chr(82)RUppercase R
Chr(83)SUppercase S
Chr(84)TUppercase T
Chr(85)UUppercase U
Chr(86)VUppercase V
Chr(87)WUppercase W
Chr(88)XUppercase X
Chr(89)YUppercase Y
Chr(90)ZUppercase Z
Chr(91)[Opening bracket
Chr(92)\Backslash
Chr(93)]Closing bracket
Chr(94)^Caret – circumflex
Chr(95)_Underscore
Chr(96)`Grave accent
Chr(97)aLowercase a
Chr(98)bLowercase b
Chr(99)cLowercase c
Chr(100)dLowercase d
Chr(101)eLowercase e
Chr(102)fLowercase f
Chr(103)gLowercase g
Chr(104)hLowercase h
Chr(105)iLowercase i
Chr(106)jLowercase j
Chr(107)kLowercase k
Chr(108)lLowercase l
Chr(109)mLowercase m
Chr(110)nLowercase n
Chr(111)oLowercase o
Chr(112)pLowercase p
Chr(113)qLowercase q
Chr(114)rLowercase r
Chr(115)sLowercase s
Chr(116)tLowercase t
Chr(117)uLowercase u
Chr(118)vLowercase v
Chr(119)wLowercase w
Chr(120)xLowercase x
Chr(121)yLowercase y
Chr(122)zLowercase z
Chr(123){Opening brace
Chr(124)|Vertical bar
Chr(125)}Closing brace
Chr(126)~Equivalency sign – tilde
Chr(127)Delete

How can you actually use this?

ASC() Function

ASC()  is a QTP function that returns the code of the character passed to it. For example if you wanted to know what the ASCII/ANSI code for the pound symbol #:

Msgbox Asc(“#”)

The above will return the code 35

Chr() Function

If you wanted to enter or search for the pound key in a string you would use the QTP Chr() function. This function will return the character associated with the code passed to it. For example:

Msgbox Chr(35)

This will return the pound sign.

That's not all…

What about mouse and keyboard actions in UFT or QTP?

There may be time when you actually need to perform mouse or keyboard actions using screen coordinates. For a step-by-step example on how to do this with QuickTest Professional or Unified Functional Testing check out:
QTP Secret Code Chart Revealed For DeviceReplay PressKey, KeyDown, KeyUp and PressNKeys

Or

3 Ways to use keyboard input in QuickTest Professional or Unified Functional Testing

5 comments
QTP’s VBscript SendKeys FAQ — Joe Colantonio -- Test Automation Geek | Bibliomaniac | Software Imagineer - July 26, 2011

[…] objSendKey.SendKeys(Chr(13)) (For more ASCII codes to use in QTP check out :QTP ASCII CHR() CODE CHART ) […]

[WORDPRESS HASHCASH] The comment’s actual post text did not contain your blog url (https://www.joecolantonio.com/2011/07/26/qtp-ascii-chr-code-chart) and so is spam.

Reply
QTP Using the Replace Function to remove Line Feed and Carriage Return characters — Joe Colantonio -- Test Automation Geek | Bibliomaniac | Software Imagineer - July 26, 2011

[…] yourString = Replace(yourString,Chr(10) & Chr(13),"") To see a chart of all ASCII QTP CHR() check out: QTP ASCII CHR() CODE CHART […]

[WORDPRESS HASHCASH] The comment’s actual post text did not contain your blog url (https://www.joecolantonio.com/2011/07/26/qtp-ascii-chr-code-chart) and so is spam.

Reply
Douglas Vynalek - February 3, 2015

How do you press the Windows Logo key?

Thanks
Doug

Reply
Michael K - April 13, 2015

I am having a heck of a time trying to figure out why my customer says they cannot see the RS/ chr(30) in this string. I am using vb script for a barcode. Can you tell why?

“[)>”&Chr(30)&”06″&Chr(29)&”1P”&Field(“psr120.1_part_no”)&Chr(29)&”Q”&Field(“psr120.6_act_wgt”)&Chr(29)& “K”&Field(“psr120.4_cust_order”)&Field(“psr120.cust_po_release”)&Chr(29)&”1T”&Field(“psr120.mat_cert_num”)& Chr(29)&”3S”&Field(“psr120.tag”)& Chr(30)&Chr(04)

TIA

Reply
Click here to add a comment

Leave a comment: