Send % as a keystroke

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
rwarshawski
Posts: 4
Joined: 10 May 2016, 09:52

Send % as a keystroke

28 Aug 2019, 12:19

Hello all-

I have a need to send the percent sign % as part of text string ? eg, "... activity will be assessed as ___ % of normal."
I am a rudimentary user of scripts and I don't really know what the % key means in a script.
Thanx!

Bob
gregster
Posts: 9114
Joined: 30 Sep 2013, 06:48

Re: Send % as a keystroke

28 Aug 2019, 12:40

Well, it has a special meaning - it is used for retrieving the contents of variables and, as a single %, for "forcing expression syntax":
see https://www.autohotkey.com/docs/Variables.htm

So, you'll have to "escape" the character or make otherwise clear that it is a literal %:
Some Options:

Code: Select all

send ... activity will be assessed as ___ `% of normal.		; escaped %
send % "... activity will be assessed as ___ % of normal."	 ; forced expression
; or use SendInput
sendInput ... activity will be assessed as ___ `% of normal.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 318 guests