Insert Macro in Custom Macros


Joe_Carrick
 Share

Recommended Posts

  • 4 weeks later...
On 2018-05-24 at 8:40 AM, Joe_Carrick said:

I've just been playing with this X10 feature.  It's pretty awesome, allowing a composite macro to be easily created from existing global, object, & user macros.  

 

I LOVE IT !!!!

 

I just tried creating a composite macro, but all my user macros are greyed out. I can only use Chief's OOB macros. Are you saying it's different for you?

Link to comment
Share on other sites

user macros are only "greyed out" if they are not currently considered valid.  If you use error handling constructs in your macros you can essential guarantee that they will always be valid.  IOW:

 

  • begin
  •   result = some code that might fail
  • rescue
  •   result = code that never fails
  • end
  • Upvote 1
Link to comment
Share on other sites

3 minutes ago, LevisL said:

 

I just tried creating a composite macro, but all my user macros are greyed out. I can only use Chief's OOB macros. Are you saying it's different for you?

 

You have to use the macros.name format, and if it's an evaluated macro, the Insert> won't work anyway. 

Link to comment
Share on other sites

I'm not sure we're all even talking about the same thing here so I'll take a moment to clarify.

 

Imagine we have 2 evaluated macros:

Macro #1:

Name:  macro_1

Context: none

Value:  1+2

 

Macro #2:

Name:  macro_2

Context: none

Value:  2*3

 

 

We have the Insert> button in TMM that has actually been there for quite some time now.  Using that button you can insert both macros into a new non-evaluated macro as dumb text like this:

 

%macro_1% + %macro_2%

 

The result would be 3 + 6

 

 

 

What's new in X10 however is that you could also use an evaluated  macro and enter the macros like this:

 

macros.macro_1 + macros.macro_2

 

The result would be 9

 

Link to comment
Share on other sites

I understand but I don't think that was Levis's problem. 

 

IAE, I will probably never need the 2nd form that was made possible in X10 since there are other ways of accomplishing those results - which I am very comfortable with using.  Both "rb" files and custom class methods are capable of providing the same functionality and are IMO more consistent with Ruby standards.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share