Couple of Questions

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
WantedMan

Couple of Questions

Post by WantedMan » Mon Nov 22, 2004 9:58 pm

First off I want to tell you how much this program has helped me.. but I have two questions first one..
I need the ability to remove the log file but the problem is is the file is in use the second time the macro is running.. let me explain.
(1stmacro starts)
Label>Start
.
.
Macro>c:\2ndmacro.scp
(2ndmacro starts)
Label>Start2
.
DeleteFile>c:\1stmacro.scp
copyfile>c:\1stmacrobackup.scp c:\1stmacro.scp
Macro>c:\1stmacro.scp

the problem lies in when I try to delete the file (OR log file) it is in use even tho it really is not..

2nd question
GetPixelColor>545,645,WHATCOLOR
If>WHATCOLOR=0,whatever,whatever2
GetPixelColor>546,645,WHATCOLOR
.
.
and that macro goes on forever basically looking at each pixel on the screen for a match. My questions is this if the pixel color is 0 at 545,645 and then it jumps to Label>whatever is there anyway to find out the 545,645 without me havcing to do anything? maybe putting them into a variable of sorts?

sorry if my questions are a little confusing.. Hope you get the idea.

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Mon Nov 22, 2004 10:46 pm

Are you sure that the value of the WHATCOLOR could be 0 (zero)?

Please try:
GetPixelColor>545,645,WHATCOLOR
Msg>WHATCOLOR
Goto>End
If>WHATCOLOR=0,whatever,whatever2
GetPixelColor>546,645,WHATCOLOR
Label>End

Enjoy using Macro Scheduler.

Guest

Post by Guest » Mon Nov 22, 2004 11:04 pm

well I guess my question should be this.. I need to be able to call the 545,645 agtain. is there a way to put those into a variable if I won't know for sure what the location will be. (keep in mind there is over 1000 of these lines looking for a certain color code)
and yes 0 is black

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Mon Nov 22, 2004 11:10 pm

What do you mean by "call the 546,645 again ..." I don't think I understand what you want to achieve.

As for variables. Yes you can put these values into variables:

Let>x=546
Let>y=645
GetPixelColor>x,y,whatcolor

If you want to loop thru all pixels on your screen use two nested loops. E.g. something like this for an 800x600 screen res:


Let>xmax=800
Let>ymax=600
Let>x=0
Repeat>x
Let>x=x+1
Let>y=0
Repeat>y
Let>y=y+1
GetPixelColor>x,y,color
If>color=whatever
bla bla bla
endif
Until>y,ymax
Until>x,xmax


Modify the If>color section to do whatever you want when it finds the color you're looking for. You may also want to jump out of the loops here. You may not. I don't know what you're trying to do. But maybe this helps?
MJT Net Support
[email protected]

WantedMan

Awesome

Post by WantedMan » Wed Nov 24, 2004 3:36 am

thank you for your help. you provided me with a great piece of code that made my macro super clean.. thanks again.

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