joe
Full Member
Posts: 46
|
Post by joe on Mar 24, 2023 2:45:14 GMT
The first macro copies a number from a website and then it determines whether or not that number is greater than or equal to 100. This number is saved as %swapgold%. If %swapgold% is greater than or equal to 100 the below macro runs. The below macro takes %swapgold% and then it divides it by 100. Then the macro takes %swapgold% and multiplies it by 100, and then it types out the answer. The problem that I am having is that answer gets rounded up or down. For example, if the number that becomes %swapgold% is 150 then the answer is rounded up to 200. When the macro concludes that 150/100=1.5, I want the macro to round down or ignore digits to the right of the decimal. Is this possible to do with MMM?
Microsoft Excel has a function called floor.math that lets you put in a number and then excel will round the number down to what ever number you want it to. So if you put in 299 and told excel to round down to the nearest hundred it would give you the 200. If I could make the macro do floor.math that would work as well, but it doesn't look like MMM does floor math. Is it possible to do floor.math with MMM?
100plus.mmmacro * | greater than or equal to 100 1 | RUN ACTION | WAIT MILLISECONDS | 500 2 | RUN ACTION | MOUSE CLICK | Left click at 654 303 1 times with 0 ms delay 3 | RUN ACTION | WAIT MILLISECONDS | 500 4 | RUN ACTION | DEFINE INTEGER VARIABLE | %swapgold%::/100 5 | RUN ACTION | DEFINE INTEGER VARIABLE | %swapgold%::*100 6 | RUN ACTION | KEYPRESS | %swapgold%
Thanks
|
|
|
Post by philranger on Mar 24, 2023 11:11:45 GMT
Hello,
I’d try to Substract 50 before dividing?
100-50= 50, rounds up to 100 199-50=149, rounds down to 100
|
|
joe
Full Member
Posts: 46
|
Post by joe on Mar 24, 2023 16:12:53 GMT
Thanks again philranger!
I had a feeling that I could do what is essentially the same as the floor.math function in microsoft excel with MMM but I just couldn't get it right. Thank you for your help, again.
Below is a copy of the two macros that I created (with the help of the great MMM community) that copies a number from a website, then rounds the number down to the nearest hundred, and then paste the answer at a different spot.
1 | RUN ACTION | WAIT MILLISECONDS | 500 * | copy from website 2 | RUN ACTION | MOUSE CLICK | Left click at 653 279 2 times with 77 ms delay 3 | 653 | 279 | 500 | Keypress Ctrl+ | c 4 | RUN ACTION | WAIT MILLISECONDS | 500 5 | RUN ACTION | DEFINE INTEGER VARIABLE | %swapgold%::%clipboard% 6 | RUN ACTION | WAIT MILLISECONDS | 500 7 | IF | INTEGER VARIABLE | %swapgold% | GREATER THAN | 100 | LOAD MACRO | C:\Users\josep\Desktop\MiniMouseMacros\100plus.mmmacro 8 | RUN ACTION | LOAD MACRO | C:\Users\josep\Desktop\MiniMouseMacros\100minus.mmmacro
* | greater than or equal to 100 1 | RUN ACTION | WAIT MILLISECONDS | 500 2 | RUN ACTION | MOUSE CLICK | Left click at 654 303 1 times with 0 ms delay 3 | RUN ACTION | WAIT MILLISECONDS | 500 4 | RUN ACTION | DEFINE INTEGER VARIABLE | %swapgold%::-50 5 | RUN ACTION | DEFINE INTEGER VARIABLE | %swapgold%::/100 6 | RUN ACTION | DEFINE INTEGER VARIABLE | %swapgold%::*100 7 | RUN ACTION | KEYPRESS | %swapgold%
|
|
|
Post by philranger on Mar 25, 2023 1:49:39 GMT
Happy it worked!
|
|