Jump to content
Macro Express Forums

Subprogram?


Granny182

Recommended Posts

Hello guys! I'm learning programming in pascal language, where we have subprogramas to symplify our code. so my question is, is there any "submacro" command to do somthing like that?

 

For those who don't know about subprograms, the idea is to write a piece of code in the top of the program and then use it as if it was a command like the ones ME has as "default". When the program runs, the subprogram at the top doesn't run unless you ask it to run...

 

Hope I make myself clear.. English aint my fort

Link to comment
Share on other sites

the command is "Macro Run xxx", which calls another macro, in this case 'xxx' is the name. I always break

my programs down into modules, the first being a variables declaration module that then calls the macro

I want to run This way the variables are always available throughout your code (although you have to run or

call the variables module for each module you want to debug).

 

if you look below, there are code "snippets" that others have written and you can use them as modules...

 

http://www.macros.com/sharedmacros.htm

 

I took a "mouse move" module on the site and modified it and use it EVERYWHERE, because I find

macro express often "outruns" the ability of my computer, so i like to slow it down.

I also added the ability for the move to test for pixel colors, moving vertically or horizontally.

So look at the attached file

MouseMoveSEARCH

and at the top is documentation of how it works and what its doing, then

the "disabled" commands are the "calling routine" used to call MouseMoveSEARCH.

Note that there are variables shown in the "calling routine" BUT there are other variables

shown in the documentation section that are (or may be) needed.

 

You'll notice that MouseMoveSEARCH even calls other "modules", which I have attached too.

You will have to modify the "Case DL" (aka Divider Line) which is specific to the program I use,

BUT it simply looks for the type of cursor change that occurs when this "divider Line" is found.

 

I think I've covered everything needed as well as attached the files needed but note that I try

to document reasonably well so I may not respond to further inquiries

(not sure why I responded to this one!).

 

Good Luck - if you program reasonably well, it's simply a trial and error process of learning

the new code, in this case MacroExpress. I'm no wiz but it seems to have everything you

should need.

MouseMoveSEARCH.mex

MouseMove_ONLY.mex

CheckPixelColor.mex

Link to comment
Share on other sites

thanks men, I can't belive I didn't thought about the macro run command, I've even seen it before but never thought of using it. well... I'm checking that out, thanks again!

 

*Edit*

 

Crap, I have an older version of ME, your files aren't compatible with mine. Could you paste the code here? And if it is not much to ask, a code for the "variable declaration" macro you mentioned above. I have a question about that... When you put a value in a variable and then the macro calls another macro, does that variable contain the same value that it had before the first macro called it?

Edited by Granny
Link to comment
Share on other sites

I have an older version of ME, your files aren't compatible with mine.

The macros on the Shared Macros page have versions for both Macro Express 3 and Macro Express Pro.

 

When you put a value in a variable and then the macro calls another macro, does that variable contain the same value that it had before the first macro called it?

Variables are global within the scope of a single macro thread. If one macro calls another using the Macro Run command and the called macro alters the variable, that altered value is in the variable in the main macro.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...