Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Functions vs. macros
#1
Hi,
I just discovered the "Convert to Function" Option in the properties page.

Anyway, I just wanted to know whether I should change all my macros to functions.

I know that one of the advantages is that I can call other functions from within a macro without ending that macro

Is there any benefit for free-standing macros i.e. they don't return variables from other macros/functions?

Any other benefits vs. downsides of converting my macros to function?

Are they more stable?

Will they run faster?

(I know that you sometimes have to put in a
Code:
Copy      Help
spe -1
to keep things running at the same rate?

Thanks for any insight!

Stuart
#2
I already wrote about it somewhere but maybe writing again will be faster than searching.

There is no need to convert macros to functions if they run well as macros. It is safer to run a macro, because you can easily end it with Pause key, and you see that it is running (red tray icon).

Convert to function if:
1. Need to call from other macro or function.
2. Need to run using mac from other macro.
3. If runs for long time, and during that time other macros should be able to run (because only single macro can run at a time).
4. If starts unattended (eg scheduler, file trigger, etc), and it is important that it will always start (a macro would not start if another macro is running at that time). Sometimes it is better to select 'Wait' in Properties instead of converting to function.
5. If runs shortly and you don't want to see red tray icon.

I usually use macros for tasks that automate something in a window, for example using keyboard and mouse commands. Usually such macros run from 0 to several seconds. Normally there is no need for other macros to run at that time.

For simple tasks that automate something, you'll probably choose to use macros in most cases. For various QM extensions (mini applications running inside QM), you'll probably choose to use functions in most cases. Also there are many cases where macros cannot be used, for example filter functions, smart dialog functions, toolbar hook functions.

If using spe -1, the speed is the same.
#3
Thanks for such a precise answer!
Stuart


Forum Jump:


Users browsing this thread: 1 Guest(s)