I wondered if anyone might be so kind as to help me with a small template problem I once gave up on but am now giving another try..
I have MyMacros 1.11 and want to use %RegExp with %InputBox so that I can enter several dollar values into a series of %InputBox popups, store them in variables, total them up (I have this part working fine).. then make sure the total is rounded to 2 decimal places before displaying it in the message.
ie. if my total comes out to $39.5 or $295.5, I want it to change it to $39.50 or $295.50 respectively. But if it's $9.99 for example, I don't want it to do anything.
I'm pretty sure I have to use %RegExp to look for any \d (digit) after a '.' where the next character is null (or anything other than a digit), then append a "0" onto the end of it.. but I think maybe the syntax is confusing me!
Anyone be so kind as to help me out here?
This is all I have so far:
I guess I probably need to put the total into a variable as well to evaluate it??
I have MyMacros 1.11 and want to use %RegExp with %InputBox so that I can enter several dollar values into a series of %InputBox popups, store them in variables, total them up (I have this part working fine).. then make sure the total is rounded to 2 decimal places before displaying it in the message.
ie. if my total comes out to $39.5 or $295.5, I want it to change it to $39.50 or $295.50 respectively. But if it's $9.99 for example, I don't want it to do anything.
I'm pretty sure I have to use %RegExp to look for any \d (digit) after a '.' where the next character is null (or anything other than a digit), then append a "0" onto the end of it.. but I think maybe the syntax is confusing me!
Anyone be so kind as to help me out here?
This is all I have so far:
Code |
---|
%VARitemA=%InputBox('price of item one: $') %- %VARitemB=%InputBox('price of item two: $') %- %VARitemC=%InputBox('price of item three: $') %- %VARitemD=%InputBox('price of item four: $') %- total: %calc("%VARitemA + %VARitemB + %VARitemC + %VARitemD") |
I guess I probably need to put the total into a variable as well to evaluate it??