Post by joe on Jun 20, 2022 20:14:18 GMT
I have two macros that work great on their own.
The problem starts when I try to combine the macros.
In the first macro it opens my surfshark vpn, clicks on the surfshark search bar to erase what ever was in the search bar, and then it types in "albania".
* | Open Vpn And Type Location
1 | RUN ACTION | RUN PROGRAM | C:\Program Files (x86)\Surfshark\Surfshark.exe
2 | RUN ACTION | RUN MACRO INLINE | C:\Users\josep\Desktop\MiniMouseMacros\erase vpn location.mmmacro
7 | RUN ACTION | KEYPRESS | albania
In the second macro it looks for the albania icon and clicks on it if it is located. If it does not locate the albania icon it opens a word document called nice hash.
* | Click on Vpn Location
2 | IF | DETECT IMAGE | image path C:\Users\josep\Desktop\MiniMouseMacros\albania.bmp::at 38 86 177 174::match quick::move mouse yes | IMAGE NOT FOUND | GOTO MACRO LINE | NotDetected
* | ImageDetected
4 | RUN ACTION | MOUSE CLICK | Left click at 113 146 1 times with 0 ms delay
5 | RUN ACTION | GOTO MACRO LINE | AfterDetectionCode
* | NotDetected
7 | RUN ACTION | RUN PROGRAM | C:\Users\josep\Desktop\nice hash.docx
* | AfterDetectionCode
I combine the two macros into the macro below:
* | Open Vpn And Type Location
1 | RUN ACTION | RUN PROGRAM | C:\Program Files (x86)\Surfshark\Surfshark.exe
2 | RUN ACTION | RUN MACRO INLINE | C:\Users\josep\Desktop\MiniMouseMacros\erase vpn location.mmmacro
3 | RUN ACTION | KEYPRESS | albania
* | Click on Vpn Location
4 | IF | DETECT IMAGE | image path C:\Users\josep\Desktop\MiniMouseMacros\albania.bmp::at 38 86 177 174::match quick::move mouse yes | IMAGE NOT FOUND | GOTO MACRO LINE | NotDetected
* | ImageDetected
5 | RUN ACTION | MOUSE CLICK | Left click at 113 146 1 times with 0 ms delay
6 | RUN ACTION | GOTO MACRO LINE | AfterDetectionCode
* | NotDetected
7 | RUN ACTION | RUN PROGRAM | C:\Users\josep\Desktop\nice hash.docx
* | AfterDetectionCode
The macro works perfectly if "albania" is the surfshark search bar when line 1 runs and then in line 2 the macro will delete what was in the search bar and then it will type "albania" in the search bar when it runs line 3. And the rest of the macro runs perfectly.
If any other word besides "albania" is in the search bar before line 2 runs then lines 1-5 will run perfectly but then line 7 will run. Line 7 should not run because lines 1-5 ran perfectly. Its as if the macro remembers what location was in the vpn search bar before it erased it, types in the albania location and clicks on the icon, and then executes line 7.
In summary, if I run the macros separately everything goes according to plan. But when I combine the two macros it doesn't work.
The problem starts when I try to combine the macros.
In the first macro it opens my surfshark vpn, clicks on the surfshark search bar to erase what ever was in the search bar, and then it types in "albania".
* | Open Vpn And Type Location
1 | RUN ACTION | RUN PROGRAM | C:\Program Files (x86)\Surfshark\Surfshark.exe
2 | RUN ACTION | RUN MACRO INLINE | C:\Users\josep\Desktop\MiniMouseMacros\erase vpn location.mmmacro
7 | RUN ACTION | KEYPRESS | albania
In the second macro it looks for the albania icon and clicks on it if it is located. If it does not locate the albania icon it opens a word document called nice hash.
* | Click on Vpn Location
2 | IF | DETECT IMAGE | image path C:\Users\josep\Desktop\MiniMouseMacros\albania.bmp::at 38 86 177 174::match quick::move mouse yes | IMAGE NOT FOUND | GOTO MACRO LINE | NotDetected
* | ImageDetected
4 | RUN ACTION | MOUSE CLICK | Left click at 113 146 1 times with 0 ms delay
5 | RUN ACTION | GOTO MACRO LINE | AfterDetectionCode
* | NotDetected
7 | RUN ACTION | RUN PROGRAM | C:\Users\josep\Desktop\nice hash.docx
* | AfterDetectionCode
I combine the two macros into the macro below:
* | Open Vpn And Type Location
1 | RUN ACTION | RUN PROGRAM | C:\Program Files (x86)\Surfshark\Surfshark.exe
2 | RUN ACTION | RUN MACRO INLINE | C:\Users\josep\Desktop\MiniMouseMacros\erase vpn location.mmmacro
3 | RUN ACTION | KEYPRESS | albania
* | Click on Vpn Location
4 | IF | DETECT IMAGE | image path C:\Users\josep\Desktop\MiniMouseMacros\albania.bmp::at 38 86 177 174::match quick::move mouse yes | IMAGE NOT FOUND | GOTO MACRO LINE | NotDetected
* | ImageDetected
5 | RUN ACTION | MOUSE CLICK | Left click at 113 146 1 times with 0 ms delay
6 | RUN ACTION | GOTO MACRO LINE | AfterDetectionCode
* | NotDetected
7 | RUN ACTION | RUN PROGRAM | C:\Users\josep\Desktop\nice hash.docx
* | AfterDetectionCode
The macro works perfectly if "albania" is the surfshark search bar when line 1 runs and then in line 2 the macro will delete what was in the search bar and then it will type "albania" in the search bar when it runs line 3. And the rest of the macro runs perfectly.
If any other word besides "albania" is in the search bar before line 2 runs then lines 1-5 will run perfectly but then line 7 will run. Line 7 should not run because lines 1-5 ran perfectly. Its as if the macro remembers what location was in the vpn search bar before it erased it, types in the albania location and clicks on the icon, and then executes line 7.
In summary, if I run the macros separately everything goes according to plan. But when I combine the two macros it doesn't work.