|
Post by boyco3 on May 12, 2020 10:49:14 GMT
I am processing data on Google Sheet, I copy the cells and check it with Clipboard. However, it cannot work with spaces. I tried many times but there still does not work. I want Clipboard to check and stop when I encounter a gap. Code demo:
|
|
|
Post by Steve on May 14, 2020 23:14:44 GMT
Hi boyco3 The issue here is that a blank entry in google sheets is not equal to ' ' no text. A blank entry in google sheets is equal to a carriage return and linefeed, like someone pressed the 'Enter' key in the tile. To get around this we have to do something tricky with MMM. We need to store the value of a carriage return and linefeed into a variable. Have a look at the demo i made below. At the start it shows selecting the empty tile, opening up a text doc, and then pasting the value in. Later in the macro (at line 2) we pull the value of the carriage return and linefeed into the STRING variable. Also take note of line 6. Here we display the value of the clipboard with a '.' at the start and a '.' at the end. 1 | RUN ACTION | DEFINE INTEGER VARIABLE | %INTEGER%::0 2 | RUN ACTION | INPUT FROM FILE | STRING::NO_REFRESH::D:\Macro\INPUT\blankline.txt 3 | 976 | 222 | 0 | Left Click * | start 4 | RUN ACTION | DEFINE INTEGER VARIABLE | %INTEGER%::+1 5 | X | X | 300 | Keypress Ctrl+ | c 6 | RUN ACTION | MESSAGE PROMPT | .%clipboard%.::::1 7 | X | X | 300 | Keypress right 8 | IF | STRING VARIABLE | %clipboard% | IS | %string% | GOTO MACRO LINE | empty 9 | X | X | 300 | Keypress Ctrl+ | v 10 | X | X | 300 | Keypress down 11 | X | X | 300 | Keypress left 12 | IF | INTEGER VARIABLE | %INTEGER% | IS | 7 | GOTO MACRO LINE | end 13 | RUN ACTION | GOTO MACRO LINE | start * | empty 14 | X | X | 300 | Keypress x 15 | X | X | 300 | Keypress down 16 | X | X | 300 | Keypress left 17 | RUN ACTION | GOTO MACRO LINE | start * | end
|
|
|
Post by boyco3 on May 17, 2020 7:15:49 GMT
Thanks Steve, I have followed your instructions and the program worked.
I also found another way, which is to take advantage of the INTEGER variable, because it only takes a numeric value and will remove whitespace or other things. I add any number (eg number: 0) after the clipboard variable is copied and compared to the result, if the variable INTEGER = 0 is empty, if INTEGER != 0 is valid.
* | begin 1 | X | X | 500 | Keypress Ctrl+ | c 2 | RUN ACTION | DEFINE INTEGER VARIABLE | %INTEGER%::%CLIPBOARD%0 3 | IF | INTEGER VARIABLE | %INTEGER% | = | 0 | GOTO MACRO LINE | empty 4 | X | X | 300 | Keypress right 5 | X | X | 300 | Keypress v 6 | X | X | 300 | Keypress left 7 | X | X | 300 | Keypress down 8 | RUN ACTION | GOTO MACRO LINE | begin * | empty 9 | X | X | 300 | Keypress right 10 | X | X | 300 | Keypress x 11 | X | X | 300 | Keypress left 12 | X | X | 300 | Keypress down * | end
|
|