Executing a macro in the background?

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
loginphp
Newbie
Posts: 5
Joined: Sat Jul 06, 2013 7:04 am

Executing a macro in the background?

Post by loginphp » Sat Jul 06, 2013 7:20 am

Hi, is there any way to exec my macro and have it working in the background so I can still use my mouse and keyboard? or is that pushing it too far?

It would be nice to use my mouse and keyboard still while a macro is working on an app in the background hehe

I have another question while I'm here....

I'm having a slight issue with something that probably has an easy fix.

I'm using WaitPixelColor, but the issue I'm running into is I need this command to recognize TWO colors on the same coordinate! Either one or the other I want to be recognized.

So I'm looking for a command that allows "this color code OR that color code". I need an 'either-or' action to be taken on this.

Look below to see what I mean.

WaitPixelColor>9479616,515,255,1
WaitPixelColor>10927853,515,255,1

As you can see, the coords are exactly the same on these two lines. However, the color code is different because it will depend on the application I'm using if either color code will appear ,and it's random.

So how do I incorporate these two color codes together? I need the macro to recognize either one or the other.

I tried this....

WaitPixelColor>9479616; 10927853,515,255,1 (this did not work)
WaitPixelColor>9479616-10927853,515,255,1 (this did not work)
WaitPixelColor>9479616/10927853,515,255,1 (this did not work)
WaitPixelColor>(9479616;10927853),515,255,1 (this did not work)

I can easily get the macro to recognize one color, but the application i'm working on has 2 different color codes at those coords and it's random whic one appears, yet I need to recognize either 1 or the other.

Thanks in advance!

User avatar
Rain
Automation Wizard
Posts: 550
Joined: Tue Aug 09, 2005 5:02 pm
Contact:

Post by Rain » Sat Jul 06, 2013 12:04 pm

It depends, a window has to be visible (Or at least the X,Y coordinates) for Macro Scheduler to detect the pixel color...the same goes for the image recognition commands. If you can't see the color then Macro Scheduler can't see it either. Makes sense?

I have written numerous scripts that run in the background but none of them use any Pixel or image recognitions commands.

loginphp
Newbie
Posts: 5
Joined: Sat Jul 06, 2013 7:04 am

Post by loginphp » Sun Jul 07, 2013 12:48 am

Rain wrote:It depends, a window has to be visible (Or at least the X,Y coordinates) for Macro Scheduler to detect the pixel color...the same goes for the image recognition commands. If you can't see the color then Macro Scheduler can't see it either. Makes sense?

I have written numerous scripts that run in the background but none of them use any Pixel or image recognitions commands.
Oh yeah, I understand about the image recognition and GetPixel and how they need to be visible for the script to execute properly. However, speaking of scripts in general, how can you get them to run without tying up your mouse and keyboard?

Is there a simple command I need to use in my scripts? I'm new to this, so I was hoping it was something simple but I'm willing to study up a bit on it.

Thanks a lot for your help :)

I really do appreciate it, including the reply in my other topic.

User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Sun Jul 07, 2013 1:29 am

Really depends on what you want to do. Macro Scheduler emulates the user. Somethings can be run as a background task but if your doing things like mouse clicks. Then not normally. What are you trying to do / automate?
FIREFIGHTER

loginphp
Newbie
Posts: 5
Joined: Sat Jul 06, 2013 7:04 am

Post by loginphp » Sun Jul 07, 2013 7:34 am

CyberCitizen wrote:Really depends on what you want to do. Macro Scheduler emulates the user. Somethings can be run as a background task but if your doing things like mouse clicks. Then not normally. What are you trying to do / automate?
I'm trying to do even the most basic of things. Something that involves a lot of mouse movement and mouse clicks. I'm just wondering if Macro Scheduler can execute these by a method or process that doesn't involve tying up your mouse and keyboard.

I want an effect much like autoit by doing even the most basic things, not having to tie up my mouse or keyboard. However, I guess that's asking for too much from a macro program but Macro Scheduler is SO good for a macro that it almost has me believing that it can pull off miracles as if it wasn't a macro lol

I apologize to everyone for asking such a silly question =]

User avatar
Rain
Automation Wizard
Posts: 550
Joined: Tue Aug 09, 2005 5:02 pm
Contact:

Post by Rain » Sun Jul 07, 2013 11:54 am

You can have MS execute seemingly invisible mouse moves and clicks by getting the cursor position before executing the mouse move and click and then returning the mouse to its original position.

Like so:

Code: Select all

GetCursorPos>XPos,YPos
MouseMove>500,500
LClick
MouseMove>XPos,YPos

Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

Post by Jerry Thomas » Mon Jul 08, 2013 4:12 pm

For your 2 colors, can you use a loop?

(syntax may not be quite correct - I am free handing this and can't test it right now)

Code: Select all

Let>ColorFound=False
Let>cnt=0

While>(ColorFound=False)and(cnt LESSTHANSYMBOL 100)
  WaitPixelColor>9479616,515,255,1 
    Let>ColorFound=WPC_RESULT
  If>ColorFound=False
    WaitPixelColor>10927853,515,255,1 
    Let>ColorFound=WPC_RESULT
  Endif
  Let>cnt=cnt+1
Endwhile
Thanks,
Jerry

[email protected]

User avatar
PepsiHog
Automation Wizard
Posts: 511
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Post by PepsiHog » Tue Jul 09, 2013 2:00 am

@ Jerry Thomas

Good suggestion. But if I may suggest, if you're going to use a loop then waitpixelcolor is not needed. Why not just use GetPixelColor?

Code: Select all

Let>ColorFound=0
Let>cnt=0

While>(ColorFound=0)and(cnt<100)
  GetPixelColor>515,255,ColorFound
  If>{(%ColorFound%=9479616)or(%ColorFound%=10927853)}
      // Do Something.........
  Endif
  Let>cnt=cnt+1
Endwhile
Also, you could have this macro call the macro that needs to execute based on the color.

PepsiHog
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2021) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts