Auto Add Comma's?

Discussion, questions and support.
Post Reply
DVT
Posts: 8
Joined: May 6th, ’20, 18:13

Post by DVT » Dec 3rd, ’20, 20:31

Hello,

Here is a script I made.

Walk Score (%INPUT_Walk%), Transit Score (%INPUT_Transit%), 1 Mi Population (%INPUT_Population%), 1 Mi Median HH Income ($%INPUT_Income%).

Is there any way to make the text inserted auto include a comma automatically. For example, "1000" keyed in becomes "1,000" automatically.

Thanks!
User avatar
Marko
Posts: 1301
Joined: Mar 2nd, ’13, 21:02

Post by Marko » Dec 4th, ’20, 11:48

Currently the user input is shown exactly as entered.
You could use Insert Command Code macro to further manipulate the result. For example, the code for adding the thousands separators could be:

Code: Select all

Send, % ThousandsSep(INPUT_Income)

ThousandsSep(x, s=",") {
	return RegExReplace(x, "\G\d+?(?=(\d{3})+(?:\D|$))", "$0" s)
}
return
DVT
Posts: 8
Joined: May 6th, ’20, 18:13

Post by DVT » Dec 4th, ’20, 21:51

That's not working. Can you show me using the script above? Sorry, I am new to this.
Post Reply