I currently have this line of code:
Code: Select all
AMT := Round(PD * PE,2)
if (SC = "") {
Send {$}%AMT%
} else {
SC := SC
OC := round(SC + AMT,2)
Send {$}%OC%
}
Say %OC% = 1000.00, how could I get it to output 1,000.00?
Thank you in advance!
Code: Select all
AMT := Round(PD * PE,2)
if (SC = "") {
Send {$}%AMT%
} else {
SC := SC
OC := round(SC + AMT,2)
Send {$}%OC%
}
Code: Select all
AMT := Round(PD * PE,2)
if (SC = "") {
Send {$}%AMT%
} else {
SC := SC
OC := round(SC + AMT,2)
Send,% "$" ThSep(OC)
}
ThSep(x, s=",")
{ ; s = thousands separator
Return, RegExReplace(x, "\G\d+?(?=(\d{3})+(?:\D|$))", "$0" s)
} ; https://autohotkey.com/board/topic/50019-add-thousands-separator/
Thank you so much <3, worked perfectly!Rohwedder wrote: ↑29 Jul 2021, 03:53Hallo,
try:Code: Select all
AMT := Round(PD * PE,2) if (SC = "") { Send {$}%AMT% } else { SC := SC OC := round(SC + AMT,2) Send,% "$" ThSep(OC) } ThSep(x, s=",") { ; s = thousands separator Return, RegExReplace(x, "\G\d+?(?=(\d{3})+(?:\D|$))", "$0" s) } ; https://autohotkey.com/board/topic/50019-add-thousands-separator/