07-30-2009, 07:37 PM
Hey All,
I got it working for simple case of user not calling lots of user-defined functions with alternating/intercurrent OutVar calls.
Seems to work for the example. Note that must set counting variable to 0 at beginning of a function.
To make it work for more complex case of simultaneous/alternating/intercurrent OutVar calls in multi-threaded usage of QM, I would have to learn about threading which is above me. But see what you think.
I am afraid that for the QM user who would see the need for this (lots of programming), they would probably be using the complex case of multi-threaded user defined variables.
Maybe someone who finds this potentially useful can take this to the next level!
Function OutVar
Sample macro to call OutVar multiple times
Macro
I got it working for simple case of user not calling lots of user-defined functions with alternating/intercurrent OutVar calls.
Seems to work for the example. Note that must set counting variable to 0 at beginning of a function.
To make it work for more complex case of simultaneous/alternating/intercurrent OutVar calls in multi-threaded usage of QM, I would have to learn about threading which is above me. But see what you think.
I am afraid that for the QM user who would see the need for this (lots of programming), they would probably be using the complex case of multi-threaded user defined variables.
Maybe someone who finds this potentially useful can take this to the next level!
Function OutVar
function str'IntValToOut ;;receives either str or int and makes into str
int+ OutVarCallCounter ;; need counter because need to know which nth "OutVar" in string is doing the calling
str CallingFunctionText.getmacro(getopt(itemid 1)) ;;gets text of calling function
ARRAY(str) OutVarResults ;; Array for number and nth instance of OutVar
int NumOutVars = findrx(CallingFunctionText "(?<=OutVar\s)\w+(?=(\s|;|\r\n))" 0 4 OutVarResults) ;; gets the var name for each instance of OutVar and places in array
out "%s = %s" OutVarResults[0 OutVarCallCounter] IntValToOut ;; gets the nth var name from OutVarResults array and also the value of that var which is sent with this particular time that OutVar function called
OutVarCallCounter = OutVarCallCounter+1 ;;advances counter
if OutVarCallCounter >= NumOutVars; OutVarCallCounter = 0 ;;resets counter if exceeds total number of OutVar callsSample macro to call OutVar multiple times
Macro
out
int+ OutVarCallCounter = 0
int TestInt = 5
OutVar TestInt
TestInt = 7
OutVar TestInt
int hwnd=win("Quick Macros Forum" "IEFrame");err
OutVar hwnd
str HwndProgram.getwinexe(hwnd);err
OutVar HwndProgram
str HwndText.getwintext(hwnd);err
OutVar HwndText
str s = "sample string"
OutVar s
int s_length = s.len
OutVar s_length