Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
When creating 'exe' can a "mac" with a variable be used
#1
Morning!

If I am creating an 'exe' from a set of a macro and functions, CAN I use:

mac F"Oc_LBX_24k_8item_{LBXliveHotKey}_Hotkey_Live"

where a variable is used?

I'm getting the message:

Warning in <open ":451: /2907">Oc_LBX_24k_8item_S_Hotkey: Cannot automatically add to exe function used with mac (F"Oc_LBX_24k_8item_(LBXliveHotKey). May need to add with <help #IDP_DIR_EXE>#exe addfunction. <help #IDP_DIR_OPT>?
#2
Add all functions whose names match F"Oc_LBX_24k_8item_{LBXliveHotKey}_Hotkey_Live" with #exe addfunction.

Macro Macro2693
Code:
Copy      Help
#exe addfunction "Oc_LBX_24k_8item_1_Hotkey_Live"
#exe addfunction "Oc_LBX_24k_8item_2_Hotkey_Live"
#exe addfunction "Oc_LBX_24k_8item_3_Hotkey_Live"
#exe addfunction "Oc_LBX_24k_8item_4_Hotkey_Live"

#opt nowarnings 1
int LBXliveHotKey
for LBXliveHotKey 1 5
,mac F"Oc_LBX_24k_8item_{LBXliveHotKey}_Hotkey_Live"
#opt nowarnings 0

New functions cannot be created in exe at run time.
#3
WOW, Gentaris, thank you for the prompt reply? What time is it there?

Where do I add this? as a variable at the beginning of the parent macro?

While I have your ear and on a similar note, what about case such as this that also uses a variable:

EndThread F"Oc_LBX_24k_8item_{LBXliveHotKey}_Hotkey_MSG"

Will this work OK?
#4
per the last comment, --What I meant was--

"as you would add or create a variable" at the beginning of a file?
#5
EndThread also would work.

15:39
#6
Gentaris, forgive me ONCE AGAIN for requesting "baby steps" but let me give you an example and then show me how you would create an 'exe' of this:

PARENT MACRO:

mac1 (is the parent-macro name w. content inside the "*******" )
*********************

str+ var1="X"

X=1

mac "func{var1}"
wait 0.01



*********************


FUNCTION 1

func1 (is the function name)
*********************

msg "macro has run"

*********************




FUNCTION 2

func2 (is the function name)
*********************

function content here

*********************
#7
Sorry about the bad syntax in the mac1 body above, should be:

str+ var1

var1=1

;;out var1

mac F"func{var1}"
#8
ADDITIONAL QUESTION: (note, also question in above strings)

What if the variable is a letter, such as "S" Does this work ONLY WITH 'int' and numbers?
#9
Macro mac1
Code:
Copy      Help
;/exe

#exe addfunction "func_one"
#exe addfunction "func_two"

#opt nowarnings 1

str functions=
;one
;two

str s
foreach s functions
,mac F"func_{s}"

MES m.x=500
mes "mac1[][]Click OK to end this macro and all function threads and this process." "" m

;BEGIN PROJECT
;main_function  mac1
;exe_file  $my qm$\mac1.exe
;END PROJECT
Function func_one
Code:
Copy      Help
MES m.x=100
mes "func one" "" m
Function func_two
Code:
Copy      Help
MES m.x=300
mes "func two" "" m
#10
Gintaras, just got back to the desk and I did experiment this morning after your first notes.

THIS ALL WILL HELP!!!!

Thank you!
#11
I've got the 'exe' to work = wonderful! --actually a lot easier that I first surmised; THANKS!

... just another reason that I tell EVERYONE I encounter, that has a macro need, about Quick Macros ...


Forum Jump:


Users browsing this thread: 1 Guest(s)