Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Learned A Bit, Still Need Guidance
#2
Quote:if it's a good idea to create functions with have "steps" of a macro
...
And instead of writing a big long list which the macro runs through, you could split up the list into separate functions? So instead of writing a long list, you would put each step of the macro within a function then the main macro would consist of only those functions perhaps.
Yes, if you like it. If these functions will be used only in that same macro, it is better to use sub-functions. Else create new function through menu File -> New.

Macro Macro2479
Code:
Copy      Help
if sub.isAtHome(5 "k")
,sub.step2


#sub isAtHome
function param1 str'param2
;...


#sub step2
;...

Quote:how you can use if and else with finding an image on the screen
In dialog "Find image" uncheck "Error if not found". Then the dialog will create code with if.
Macro Macro2478
Code:
Copy      Help
int w=win("..." "...")
if(scan("image:hCD137C70" w 0 1|16))
,

Then you can add more code, and combine several scan in if/else.
Macro Macro2478
Code:
Copy      Help
int w=win("..." "...")
if(scan("image:hCD137C70" w 0 1|16))
,lef
else if(scan("image:hCD137C71" w 0 1|16))
,lef

;scan with flag 1: if found, moves the mouse and returns 1. If not found, returns 0.


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)