joe
Full Member
Posts: 46
|
Post by joe on Mar 19, 2023 20:44:42 GMT
Good evening,
I am trying to create an ocr if then else statement and I can't get it to work properly. I want the ocr to look at cell A1 in an excel spreadsheet and determine whether cell A1 has the number 100 in it. If cell A1 is 100 then I want the macro to open the saved word page that says "press swap gold button once." If cell A1 is not 100 then I want the macro to open the saved word page that says "stop". Each time I run the macro it opens the word page that says stop. Can someone please help me figure out what is wrong with my code? Below is the actual code.
1 | RUN ACTION | WAIT MILLISECONDS | 500
2 | IF | OCR | At location [X:25 Y:257 W:60 H:19]::Lang eng - English::To string OCR | TEXT CONTAINS | 100 | THEN
3 | RUN ACTION | WAIT MILLISECONDS | 500
4 | RUN ACTION | RUN PROGRAM | C:\Users\josep\Desktop\Press gold swap button once.docx
5 | RUN ACTION | STOP
6 | IF | ELSE
7 | RUN ACTION | RUN PROGRAM | C:\Users\josep\Desktop\Stop.docx
8 | RUN ACTION | STOP
9 | IF | END IF
|
|
joe
Full Member
Posts: 46
|
Post by joe on Mar 19, 2023 21:10:57 GMT
I also have another issue that is related to my post regarding "does ocr work with if then else statements?"
I think what I should have asked first was can I make a macro that does the below stuff without using an excel spreadsheet? I made a macro that copies a number from a web page, pastes it into cell b1 of an excel spreadsheet.
This spreadsheet is set up so that when I paste a number into cell b1 it rounds the number down to the nearest 100 into cell a1. So for example if I paste 1295 into cell b1, then 1200 will appear in cell a1.
|
|
|
Post by philranger on Mar 19, 2023 23:51:17 GMT
Hello, If you already have a copy in the clipboard, just copy it to an integer and check if it is 100?
|
|
joe
Full Member
Posts: 46
|
Post by joe on Mar 20, 2023 19:12:48 GMT
Hello Phil, thanks for replying.
I think another way of stating what I am trying to do is that I want to make a macro that copies a number from a website, then determines whether that number is greater than or equal to 100. Then if that number is greater than or equal to 100 I want the macro to do A, but if that number is less than 100 I want the macro to do B.
The code below is what I came up with but its not working the way I want it to. Regardless of what number the macro copies it keeps loading the 100minus macro.
1 | RUN ACTION | WAIT MILLISECONDS | 500 * | copy 2 | RUN ACTION | MOUSE CLICK | Left click at 28 267 1 times with 0 ms delay 3 | RUN ACTION | WAIT MILLISECONDS | 1000 4 | RUN ACTION | MOUSE CLICK | Right click at 28 267 1 times with 0 ms delay 5 | RUN ACTION | WAIT MILLISECONDS | 1000 6 | RUN ACTION | MOUSE CLICK | Left click at 40 336 1 times with 0 ms delay 7 | RUN ACTION | WAIT MILLISECONDS | 500 8 | IF | INTEGER VARIABLE | %INTEGER% | GREATER THAN EQUAL TO | 100 | LOAD MACRO | C:\Users\josep\Desktop\MiniMouseMacros\100plus.mmmacro 9 | RUN ACTION | LOAD MACRO | C:\Users\josep\Desktop\MiniMouseMacros\100minus.mmmacro
thanks!
|
|
joe
Full Member
Posts: 46
|
Post by joe on Mar 21, 2023 19:54:26 GMT
I fixed it! Thanks philranger and the help I found on a different post minimousemacro.proboards.com/thread/294/custom-clipboardThis is a copy of my working macro in case anyone else is interested: 1 | RUN ACTION | WAIT MILLISECONDS | 500 * | copy from website 2 | RUN ACTION | MOUSE CLICK | Left click at 1020 582 2 times with 77 ms delay 3 | 1020 | 582 | 500 | Keypress Ctrl+ | c 4 | RUN ACTION | WAIT MILLISECONDS | 500 5 | RUN ACTION | DEFINE STRING VARIABLE | %CLIPBOARD% 6 | RUN ACTION | WAIT MILLISECONDS | 500 7 | IF | INTEGER VARIABLE | %CLIPBOARD% | GREATER THAN EQUAL TO | 100 | LOAD MACRO | C:\Users\josep\Desktop\MiniMouseMacros\100plus.mmmacro 8 | RUN ACTION | LOAD MACRO | C:\Users\josep\Desktop\MiniMouseMacros\100minus.mmmacro
|
|